optimise lending rates
"we are exploring ways to change lending fees parameters to icrease competitiveness an example of how we need to be able to change parameters to get different lending fees lenders pour liquidity into a loanToken and depending on base rate, utility rate, kink level etc. (keywords to search) the borrower will pay lending fees which we need to be attractive for the lenders https://docs.google.com/spreadsheets/d/18I2dn77k_P3JSZ8_9u0oR5mI3RCUSO25MNdo3SxdCYo/edit?usp=sharing the file above gives an idea of how it should work to change params and get different curves what we need to do is to set correspondence between variables and algorithms in the code and the formulas in the sheet to see what and how needs to be changed in the params of the protocol to get the same result as in the file"
Did an initial analysis to understand the flow. Saving it here for future reference.
Lending Fees – Flow Analysis
- The demand curve is set while deployment. LoanTokenSettingsLowerAdmin. setDemandCurve() is called for setting the following:
baseRate: The interest rate. rateMultiplier: The precision multiplier for base rate. lowUtilBaseRate: The credit utilization rate (CUR) low value. lowUtilRateMultiplier: The precision multiplier for low util base rate. targetLevel: The target level. - Is it Threshold as per the spreadsheet? kinkLevel: The level that interest rates cluster on kinked model. - Is it Maximum as per the spreadsheet? maxScaleRate: The maximum rate of the scale. - Is it Rate Multiplier as per the spreadsheet?
-
Interest Rate Calculation Interest is calculated using the LoanTokenLogicStandard.nextBorrowInterestRate() which internally calls _nextBorrowInterestRate. Although it hits a dead-end calling _nextBorrowInterestRate2 Looks like the calculation in the spreadsheet needs to be put in the below function of LoanTokenLogicStandard: function(uint256 newBorrowAmount, uint256 assetSupply) internal view returns (uint256 nextRate)
-
FeesHelper We have a mapping but that doesn’t seem useful as well. mapping(address => uint256) public lendingFeeTokensHeld;