TwoKinksInterestRateModel

TwoKinksInterestRateModel

An interest rate model with two different slope increase or decrease each after a certain utilization threshold called kink is reached.

Solidity API

MULTIPLIER_PER_BLOCK_OR_SECOND

The multiplier of utilization rate per block or second that gives the slope 1 of the interest rate scaled by EXP_SCALE

int256 MULTIPLIER_PER_BLOCK_OR_SECOND

BASE_RATE_PER_BLOCK_OR_SECOND

The base interest rate per block or second which is the y-intercept when utilization rate is 0 scaled by EXP_SCALE

int256 BASE_RATE_PER_BLOCK_OR_SECOND

KINK_1

The utilization point at which the multiplier2 is applied

int256 KINK_1

MULTIPLIER_2_PER_BLOCK_OR_SECOND

The multiplier of utilization rate per block or second that gives the slope 2 of the interest rate scaled by EXP_SCALE

int256 MULTIPLIER_2_PER_BLOCK_OR_SECOND

BASE_RATE_2_PER_BLOCK_OR_SECOND

The base interest rate per block or second which is the y-intercept when utilization rate hits KINK_1 scaled by EXP_SCALE

int256 BASE_RATE_2_PER_BLOCK_OR_SECOND

RATE_1

The maximum kink interest rate scaled by EXP_SCALE

int256 RATE_1

KINK_2

The utilization point at which the jump multiplier is applied

int256 KINK_2

JUMP_MULTIPLIER_PER_BLOCK_OR_SECOND

The multiplier of utilization rate per block or second that gives the slope 3 of interest rate scaled by EXP_SCALE

int256 JUMP_MULTIPLIER_PER_BLOCK_OR_SECOND

RATE_2

The maximum kink interest rate scaled by EXP_SCALE

int256 RATE_2

constructor

Construct an interest rate model

constructor(int256 baseRatePerYear_, int256 multiplierPerYear_, int256 kink1_, int256 multiplier2PerYear_, int256 baseRate2PerYear_, int256 kink2_, int256 jumpMultiplierPerYear_, bool timeBased_, uint256 blocksPerYear_) public

Parameters


getBorrowRate

Calculates the current borrow rate per slot (block or second)

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

Parameters

Return Values


getSupplyRate

Calculates the current supply rate per slot (block or second)

function getSupplyRate(uint256 cash, uint256 borrows, uint256 reserves, uint256 reserveFactorMantissa, uint256 badDebt) public view virtual returns (uint256)

Parameters

Return Values


utilizationRate

Calculates the utilization rate of the market: (borrows + badDebt) / (cash + borrows + badDebt - reserves)

function utilizationRate(uint256 cash, uint256 borrows, uint256 reserves, uint256 badDebt) public pure returns (uint256)

Parameters

Return Values


Last updated