DefaultReserveInterestRateStrategy
Implements the calculation of the interest rates depending on the reserve state
_The model of interest rate is based on 2 slopes, one before the OPTIMAL_USAGE_RATIO
point of usage and another from that one to 100%.
An instance of this same contract, can't be used across different ParaSpace markets, due to the caching of the PoolAddressesProvider_
OPTIMAL_USAGE_RATIO
This constant represents the usage ratio at which the pool aims to obtain most competitive borrow rates. Expressed in ray
MAX_EXCESS_USAGE_RATIO
This constant represents the excess usage ratio above the optimal. It's always equal to 1-optimal usage ratio. Added as a constant here for gas optimizations. Expressed in ray
ADDRESSES_PROVIDER
_baseVariableBorrowRate
_variableRateSlope1
_variableRateSlope2
constructor
Constructor.
Parameters
Name | Type | Description |
---|---|---|
provider | contract IPoolAddressesProvider | The address of the PoolAddressesProvider contract |
optimalUsageRatio | uint256 | The optimal usage ratio |
baseVariableBorrowRate | uint256 | The base variable borrow rate |
variableRateSlope1 | uint256 | The variable rate slope below optimal usage ratio |
variableRateSlope2 | uint256 | The variable rate slope above optimal usage ratio |
getVariableRateSlope1
Returns the variable rate slope below optimal usage ratio
Its the variable rate when usage ratio > 0 and <= OPTIMAL_USAGE_RATIO
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The variable rate slope |
getVariableRateSlope2
Returns the variable rate slope above optimal usage ratio
Its the variable rate when usage ratio > OPTIMAL_USAGE_RATIO
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The variable rate slope |
getBaseVariableBorrowRate
Returns the base variable borrow rate
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The base variable borrow rate, expressed in ray |
getMaxVariableBorrowRate
Returns the maximum variable borrow rate
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The maximum variable borrow rate, expressed in ray |
CalcInterestRatesLocalVars
calculateInterestRates
Calculates the interest rates depending on the reserve's state and configurations
Parameters
Name | Type | Description |
---|---|---|
params | struct DataTypes.CalculateInterestRatesParams | The parameters needed to calculate interest rates |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | liquidityRate The liquidity rate expressed in rays |
[1] | uint256 | variableBorrowRate The variable borrow rate expressed in rays |