Skip to Content
docs

Aave V3 Interest Rate Strategy

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 reserve’s optimal usage ratio and another from that point to 100%. Rates are set per reserve through PoolConfigurator.setReserveInterestRateData.

With utilization U and optimal usage ratio Uoptimal, the variable borrow rate is:

R={Rbase+Rslope1⋅UUoptimalU≤UoptimalRbase+Rslope1+Rslope2⋅U−Uoptimal1−UoptimalU>UoptimalR = \begin{cases} R_{base} + R_{slope1} \cdot \dfrac{U}{U_{optimal}} & U \le U_{optimal} \\ R_{base} + R_{slope1} + R_{slope2} \cdot \dfrac{U - U_{optimal}}{1 - U_{optimal}} & U > U_{optimal} \end{cases}
RateUtilizationOptimal UsageBorrowSupply
Interest Rates by Utilization

Each Aave market needs its own instance of this contract, because it caches the PoolAddressesProvider.

The source code is available on GitHub.

View Methods

getInterestRateData

Solidity
function getInterestRateData(address reserve) external view returns (InterestRateDataRay memory)

Returns the interest rate parameters of the specified reserve, in ray.

Input Parameters:

NameTypeDescription
reserveaddressThe address of the reserve

Return Values:

TypeDescription
InterestRateDataRayoptimalUsageRatio, baseVariableBorrowRate, variableRateSlope1 and variableRateSlope2, all expressed in ray

getInterestRateDataBps

Solidity
function getInterestRateDataBps(address reserve) external view returns (InterestRateData memory)

Returns the interest rate parameters of the specified reserve, in bps.

Input Parameters:

NameTypeDescription
reserveaddressThe address of the reserve

Return Values:

TypeDescription
InterestRateDataoptimalUsageRatio, baseVariableBorrowRate, variableRateSlope1 and variableRateSlope2, all expressed in bps

getOptimalUsageRatio

Solidity
function getOptimalUsageRatio(address reserve) external view returns (uint256)

Returns the optimal usage ratio of the specified reserve.

Input Parameters:

NameTypeDescription
reserveaddressThe address of the reserve

Return Values:

TypeDescription
uint256The optimal usage ratio, expressed in ray

getVariableRateSlope1

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

Returns the variable rate slope below the optimal usage ratio for the specified reserve. Applies while the usage ratio is below the optimal usage ratio.

Input Parameters:

NameTypeDescription
reserveaddressThe address of the reserve

Return Values:

TypeDescription
uint256The variable rate slope, expressed in ray

getVariableRateSlope2

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

Returns the variable rate slope above the optimal usage ratio for the specified reserve. Applies while the usage ratio is above the optimal usage ratio.

Input Parameters:

NameTypeDescription
reserveaddressThe address of the reserve

Return Values:

TypeDescription
uint256The variable rate slope, expressed in ray

getBaseVariableBorrowRate

Solidity
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

Solidity
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

Solidity
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 reserve deficit (field kept under its pre-V3.4 name); added to the denominator of the supply usage ratio
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
usingVirtualBalanceboolDeprecated since Aave V3.4, always true
virtualUnderlyingBalanceuint256The virtual balance of the underlying asset held by the reserve

Return Values:

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