TwoKinksInterestRateModel
An interest rate model with two different slope increase or decrease each after a certain utilization threshold called kink is reached.
MULTIPLIER_PER_BLOCK_OR_SECOND
The multiplier of utilization rate per block or second that gives the slope 1 of the interest rate scaled by EXP_SCALE
int256 MULTIPLIER_PER_BLOCK_OR_SECOND
BASE_RATE_PER_BLOCK_OR_SECOND
The base interest rate per block or second which is the y-intercept when utilization rate is 0 scaled by EXP_SCALE
int256 BASE_RATE_PER_BLOCK_OR_SECOND
The utilization point at which the multiplier2 is applied
MULTIPLIER_2_PER_BLOCK_OR_SECOND
The multiplier of utilization rate per block or second that gives the slope 2 of the interest rate scaled by EXP_SCALE
BASE_RATE_2_PER_BLOCK_OR_SECOND
The base interest rate per block or second which is the y-intercept when utilization rate hits KINK_1 scaled by EXP_SCALE
The maximum kink interest rate scaled by EXP_SCALE
The utilization point at which the jump multiplier is applied
JUMP_MULTIPLIER_PER_BLOCK_OR_SECOND
The multiplier of utilization rate per block or second that gives the slope 3 of interest rate scaled by EXP_SCALE
The maximum kink interest rate scaled by EXP_SCALE
Construct an interest rate model
Parameters
The approximate target base APR, as a mantissa (scaled by EXP_SCALE)
The rate of increase or decrease in interest rate wrt utilization (scaled by EXP_SCALE)
The utilization point at which the multiplier2 is applied
The rate of increase or decrease in interest rate wrt utilization after hitting KINK_1 (scaled by EXP_SCALE)
The additonal base APR after hitting KINK_1, as a mantissa (scaled by EXP_SCALE)
The utilization point at which the jump multiplier is applied
The multiplier after hitting KINK_2
A boolean indicating whether the contract is based on time or block.
The number of blocks per year
Calculates the current borrow rate per slot (block or second)
Parameters
The amount of cash in the market
The amount of borrows in the market
The amount of reserves in the market
The amount of badDebt in the market
Return Values
The borrow rate percentage per slot (block or second) as a mantissa (scaled by EXP_SCALE)
Calculates the current supply rate per slot (block or second)
Parameters
The amount of cash in the market
The amount of borrows in the market
The amount of reserves in the market
The current reserve factor for the market
The amount of badDebt in the market
Return Values
The supply rate percentage per slot (block or second) as a mantissa (scaled by EXP_SCALE)
utilizationRate
Calculates the utilization rate of the market: (borrows + badDebt) / (cash + borrows + badDebt - reserves)
Parameters
The amount of cash in the market
The amount of borrows in the market
The amount of reserves in the market (currently unused)
The amount of badDebt in the market
Return Values
The utilization rate as a mantissa between [0, MANTISSA_ONE]