↪ interest rate strategy
Implements the computation of interest rates based on the current state of the reserve. This interest rate model utilizes two distinct slopes: one applicable before reaching the OPTIMAL_USAGE_RATIO
, and another that applies from that point up to full utilization (100%).
Due to caching of the PoolAddressesProvider
, an instance of this contract cannot be shared across different Hyperlend markets.
The source code is available on GitHub.
View Methods
getVariableRateSlope1
Provides the variable rate slope for the specified reserve when the usage ratio is below the optimal threshold. This rate is relevant when the usage ratio ranges from 0 up to OPTIMAL_USAGE_RATIO
.
Input Parameters:
reserve
address
The address of the reserve asset
Return Values:
uint256
The variable rate slope value
getVariableRateSlope2
Provides the variable rate slope for the specified reserve when the usage ratio exceeds the optimal threshold. This rate applies when the usage ratio is greater than OPTIMAL_USAGE_RATIO
.
Input Parameters:
reserve
address
The address of the reserve asset
Return Values:
uint256
The variable rate slope value
getBaseVariableBorrowRate
Returns the base variable borrow rate for the given reserve.
Input Parameters:
reserve
address
The address of the reserve asset
Return Values:
uint256
The base variable borrow rate, in ray
getMaxVariableBorrowRate
Returns the maximum variable borrow rate for the specified reserve.
Input Parameters:
reserve
address
The address of the reserve asset
Return Values:
uint256
The maximum variable borrow rate, in ray
calculateInterestRates
Calculates the interest rates based on the reserve's current state and configurations. This function returns two values: the liquidity rate and the variable borrow rate.
Input Parameters:
params
DataTypes.CalculateInterestRatesParams
Parameters required to compute interest rates
The DataTypes.CalculateInterestRatesParams
struct includes the following fields:
unbacked
uint256
The amount of unbacked tokens
liquidityAdded
uint256
Liquidity added during the operation
liquidityTaken
uint256
Liquidity withdrawn during the operation
totalDebt
uint256
Total amount borrowed from the reserve
reserveFactor
uint256
Portion of interest allocated to the market's treasury
reserve
address
The address of the reserve
usingVirtualBalance
bool
Indicates if a virtual balance is being utilized
virtualUnderlyingBalance
uint256
Virtual balance of the underlying asset for mintable assets
Return Values:
liquidityRate
uint256
The liquidity rate, expressed in ray
variableBorrowRate
uint256
The variable borrow rate, expressed in ray
Last updated