Implements the calculation of the interest rates depending on the reserve state. The model of interest rate is based on two slopes, one before the OPTIMAL_USAGE_RATIO point of usage and another from that point to 100%.
An instance of this same contract can't be used across different Aave markets
due to the caching of the PoolAddressesProvider.
Returns the variable rate slope below the optimal usage ratio for the specified reserve. This is the variable rate when the usage ratio is between 0 and OPTIMAL_USAGE_RATIO.
Returns the variable rate slope above the optimal usage ratio for the specified reserve. This is the variable rate when the usage ratio is greater than OPTIMAL_USAGE_RATIO.
Calculates the interest rates depending on the reserve's state and configurations. This function returns only two values: the liquidity rate and the variable borrow rate.
Input Parameters:
Name
Type
Description
params
DataTypes.CalculateInterestRatesParams
The parameters needed to calculate interest rates
The DataTypes.CalculateInterestRatesParams struct is composed of the following fields:
Name
Type
Description
unbacked
uint256
The amount of unbacked tokens
liquidityAdded
uint256
The liquidity added during the operation
liquidityTaken
uint256
The liquidity taken during the operation
totalDebt
uint256
The total borrowed from the reserve
reserveFactor
uint256
The reserve portion of the interest that goes to the treasury of the market
reserve
address
The address of the reserve
usingVirtualBalance
bool
Flag to indicate if the virtual balance is being used
virtualUnderlyingBalance
uint256
The virtual balance of underlying asset used for mintable assets