IInterestRateModel

Git Source

Interface for the interest rate contracts

Functions

isInterestRateModel

Should return true

function isInterestRateModel() external view returns (bool);

blocksPerYear

The approximate number of blocks per year that is assumed by the interest rate model

function blocksPerYear() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The number of blocks per year

multiplierPerBlock

The multiplier of utilization rate that gives the slope of the interest rate

function multiplierPerBlock() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The multiplier per block

baseRatePerBlock

The base interest rate which is the y-intercept when utilization rate is 0

function baseRatePerBlock() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The base rate per block

jumpMultiplierPerBlock

The multiplierPerBlock after hitting a specified utilization point

function jumpMultiplierPerBlock() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The jump multiplier per block

kink

The utilization point at which the jump multiplier is applied

function kink() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The utilization point (kink)

name

A name for user-friendliness, e.g. WBTC

function name() external view returns (string memory);

Returns

NameTypeDescription
<none>stringThe name of the interest rate model

utilizationRate

Calculates the utilization rate of the market

function utilizationRate(uint256 cash, uint256 borrows, uint256 reserves) external pure returns (uint256);

Parameters

NameTypeDescription
cashuint256The total cash in the market
borrowsuint256The total borrows in the market
reservesuint256The total reserves in the market

Returns

NameTypeDescription
<none>uint256The utilization rate as a mantissa between [0, 1e18]

getBorrowRate

Returns the current borrow rate per block for the market

function getBorrowRate(uint256 cash, uint256 borrows, uint256 reserves) external view returns (uint256);

Parameters

NameTypeDescription
cashuint256The total cash in the market
borrowsuint256The total borrows in the market
reservesuint256The total reserves in the market

Returns

NameTypeDescription
<none>uint256The current borrow rate per block, scaled by 1e18

getSupplyRate

Returns the current supply rate per block for the market

function getSupplyRate(uint256 cash, uint256 borrows, uint256 reserves, uint256 reserveFactorMantissa)
    external
    view
    returns (uint256);

Parameters

NameTypeDescription
cashuint256The total cash in the market
borrowsuint256The total borrows in the market
reservesuint256The total reserves in the market
reserveFactorMantissauint256The current reserve factor for the market

Returns

NameTypeDescription
<none>uint256The current supply rate per block, scaled by 1e18

Events

NewInterestParams

Emitted when interest rate parameters are updated

event NewInterestParams(
    uint256 baseRatePerBlock, uint256 multiplierPerBlock, uint256 jumpMultiplierPerBlock, uint256 kink
);

Parameters

NameTypeDescription
baseRatePerBlockuint256The base rate per block
multiplierPerBlockuint256The multiplier per block for the interest rate slope
jumpMultiplierPerBlockuint256The multiplier after hitting the kink
kinkuint256The utilization point where the jump multiplier is applied