Interest Rate Strategy

Borrow / WithdrawSupply / RepayBorrow rateSupply rate

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.

The source code is available on GitHub.

View Methods

getVariableRateSlope1

function getVariableRateSlope1(address reserve) external view returns (uint256)

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.

Input Parameters:

NameTypeDescription
reserveaddressThe address of the reserve

Return Values:

TypeDescription
uint256The variable rate slope

getVariableRateSlope2

function getVariableRateSlope2(address reserve) external view returns (uint256)

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.

Input Parameters:

NameTypeDescription
reserveaddressThe address of the reserve

Return Values:

TypeDescription
uint256The variable rate slope

getBaseVariableBorrowRate

function getBaseVariableBorrowRate(address reserve) external view override returns (uint256)

Returns the base variable borrow rate for the specified reserve.

Input Parameters:

NameTypeDescription
reserveaddressThe address of the reserve

Return Values:

TypeDescription
uint256The base variable borrow rate, expressed in ray

getMaxVariableBorrowRate

function getMaxVariableBorrowRate(address reserve) external view override returns (uint256)

Returns the maximum variable borrow rate for the specified reserve.

Input Parameters:

NameTypeDescription
reserveaddressThe address of the reserve

Return Values:

TypeDescription
uint256The maximum variable borrow rate, expressed in ray

calculateInterestRates

function calculateInterestRates(    DataTypes.CalculateInterestRatesParams memory params) external view override returns (uint256, uint256)

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:

NameTypeDescription
paramsDataTypes.CalculateInterestRatesParamsThe parameters needed to calculate interest rates

The DataTypes.CalculateInterestRatesParams struct is composed of the following fields:

NameTypeDescription
unbackeduint256The amount of unbacked tokens
liquidityAddeduint256The liquidity added during the operation
liquidityTakenuint256The liquidity taken during the operation
totalDebtuint256The total borrowed from the reserve
reserveFactoruint256The reserve portion of the interest that goes to the treasury of the market
reserveaddressThe address of the reserve
usingVirtualBalanceboolFlag to indicate if the virtual balance is being used
virtualUnderlyingBalanceuint256The virtual balance of underlying asset used for mintable assets

Return Values:

NameTypeDescription
liquidityRateuint256The liquidity rate, expressed in ray
variableBorrowRateuint256The variable borrow rate, expressed in ray

Aave.com provides information and resources about the fundamentals of the decentralised non-custodial liquidity protocol called the Aave Protocol, comprised of open-source self-executing smart contracts that are deployed on various permissionless public blockchains, such as Ethereum (the "Aave Protocol" or the "Protocol"). Aave Labs does not control or operate any version of the Aave Protocol on any blockchain network.