Dev Diary #2 — Gas Fee Reductions & New Credit Rating System

dFund
4 min readFeb 17, 2022

Wednesday, 16th Feb 2022.

Happy Wednesday! I want to update you all by drawing your attention to the three most impactful areas we’ve been working on over here at the development team. The first area is going to be crucial for dFund’s competitiveness within the loan platform space, as we’ve made significant improvements behind-the-scenes that will noticeably lower gas fees. The second area involves the loan customization features we announced in last week’s dev diary. And the third area revolves around the credit rating system that was also announced last week.

So, without further ado, let’s jump into things…

Saving on Gas Fees

Now that our new development team has grown comfortable working with and documenting the existing setup, we decided to completely re-haul our smart contracts. That’s right: we rewrote almost every line of our solidity files, as well as the singletons associated with them on the frontend. The result is drastically improved readability and noticeably lower gas fees. I’ll spare you the most banal details, but I do want to give you a high-level overview of what this overhaul looks like.

First off was a distillation of loan offers and requests into a single loan contract, so if you look behind-the-scenes you will notice that we no longer have separate contracts for offers and requests; instead, the loan management contract maintains two arrays of generic loans — one for offers and the other for requests — and it keeps track of metadata using state variables. What this means for the user is that getting a loan now requires deploying one less contract, which is one of the biggest gas-guzzlers out there.

Second, we removed a factory contract that was no longer necessary due to the fact that we collapsed offers and requests into a single contract. And, finally, we optimized several functions to use less expensive and more readable logic, partly thanks to improvements we made to the way we manage state variables. Essentially the cost reduction here is two-fold: less gas is needed to store loan variables on the blockchain, AND less gas is needed to perform checks on those variables.

Customization Options for Collateral and Duration

Last week I explained the importance of allowing our users to set collateral and duration options for their loans, especially when it comes to managing risk — for both the lender and the borrower. Now, today I am pleased to announce that we have successfully implemented the backend logic for these features; the smart contracts are fully tested, deployed, and ready to go. The next step we are taking to fully implement collateral and duration customization is, of course, to integrate the features into the frontend. That will be our primary focus this week, aside from working the credit rating system, which I want to briefly explain next.

Our Credit Rating System Explained

We envision a simple yet comprehensive credit rating system that will aim to provide comfort to our users as they seek to get a better sense of who they can trust to borrow from and lend to. While I don’t want to reveal the exact details of the algorithm, I’m pleased that I can now announce the factors that will be considered.

Our credit rating system will score borrowers and lenders separately — on a scale of 1–300 on the backend, which on the frontend will be shown as a A-D credit rating scale more similar to traditional finance for user convenience. In addition to displaying a numerical score next to each loan offer and request, we will also be displaying a few key stats to make the credit score more transparent. For loan requests, we will show the number of loans previously repaid by the borrower, the value of those loans, the number & value of loans previously defaulted, and the ratio of loans the borrower canceled before collateralizing.

Similarly, for loan offers, we will show the number & value of loans the lender has previously lent without issue, the number & value of loans where the lender called in collateral early, and the lender’s cancellation ratio.

Rest assured that behind the scenes, we are also implementing fraud checks to ensure that users cannot artificially inflate their scores. These fraud checks are the secret sauce, so to speak, of our credit rating system, so we are going to keep them under wraps indefinitely. As of now, we have a preliminary set of checks planned, with more checks sure to come as our development team collaborates with the rest of project management to hammer out the most comprehensive credit rating system possible.

Community Engagement

That’s all, folks. Thanks for reading, and as always, don’t be a stranger! I’m already very excited about everything we have in the works, but we certainly welcome any thoughts or suggestions you might have — especially during this early stage of the project’s development. Right now is your best opportunity to make an impact on the direction we will take going forward, so please feel free to send over anything you would like us to take into consideration. Looking forward to

hearing from you!

--

--

dFund

Decentralized hedge funds and loans powered by smart contracts on Polkadot.