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

uint256 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

uint256 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

contract IPoolAddressesProvider ADDRESSES_PROVIDER

_baseVariableBorrowRate

uint256 _baseVariableBorrowRate

_variableRateSlope1

uint256 _variableRateSlope1

_variableRateSlope2

uint256 _variableRateSlope2

constructor

constructor(contract IPoolAddressesProvider provider, uint256 optimalUsageRatio, uint256 baseVariableBorrowRate, uint256 variableRateSlope1, uint256 variableRateSlope2) public

Constructor.

Parameters

getVariableRateSlope1

function getVariableRateSlope1() external view returns (uint256)

Returns the variable rate slope below optimal usage ratio

Its the variable rate when usage ratio > 0 and <= OPTIMAL_USAGE_RATIO

Return Values

getVariableRateSlope2

function getVariableRateSlope2() external view returns (uint256)

Returns the variable rate slope above optimal usage ratio

Its the variable rate when usage ratio > OPTIMAL_USAGE_RATIO

Return Values

getBaseVariableBorrowRate

function getBaseVariableBorrowRate() external view returns (uint256)

Returns the base variable borrow rate

Return Values

getMaxVariableBorrowRate

function getMaxVariableBorrowRate() external view returns (uint256)

Returns the maximum variable borrow rate

Return Values

CalcInterestRatesLocalVars

struct CalcInterestRatesLocalVars {
  uint256 availableLiquidity;
  uint256 totalDebt;
  uint256 currentVariableBorrowRate;
  uint256 currentLiquidityRate;
  uint256 borrowUsageRatio;
  uint256 supplyUsageRatio;
  uint256 availableLiquidityPlusDebt;
}

calculateInterestRates

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

Calculates the interest rates depending on the reserve's state and configurations

Parameters

Return Values