Interest rate
The loan interest rate is an Annual Percentage Rate (APR) paid by the borrower for the period of the loan.
The getInterestRates
function sets the interest rate for borrowing money, making it cheaper when there's a lot of money available and more expensive when funds are running low.
Interest rates are calculated for the borrowed amount (loanAmount
). Where taking a loan of 1,000 ADA will have a lower interest rate than taking a loan of 100,000 ADA (if taken from the same pool).
The loan interest rate is fixed for every loan and does not change for as long as the loan exists.
getInterestRates()
Parameters
loanAmount
: The amount to be loaned.lentOut
: The total amount already loaned out by the system.balance
: The total amount of funds in the system.
Constants
Constants are protocol-set values to ensure a fluent lending/borrowing experience.
optimalUtilizationBN
: Optimal rate at which the system should be loaning out funds.baseInterestRateBN
: The minimum interest rate to be charged.rslope1BN
andrslope2BN
: Rates at which interest increases.
Utilization Rate
Formula:
(loanAmount + lentOut) / (balance + lentOut)
Purpose: It measures how much of the available balance is being loaned out.
Interest Rate Calculation
If Utilization Rate ≤ Optimal Utilization Rate
Formula:
baseInterestRateBN + (utilizationRateBN * rslope1BN)
If Utilization Rate > Optimal Utilization Rate
Formula: A more complicated formula involving both
rslope1BN
andrslope2BN
is used to calculate the interest rate.
Last updated