Base Jump Rate Model V 2

Compound (modified by Dharma Labs, refactored by Arr00)

Logic for Compound's JumpRateModel Contract V2.

Version 2 modifies Version 1 by enabling updateable parameters.

Methods

baseRatePerBlock

function baseRatePerBlock() external view returns (uint256)

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

Returns

Name
Type
Description

_0

uint256

undefined

blocksPerYear

function blocksPerYear() external view returns (uint256)

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

Returns

Name
Type
Description

_0

uint256

undefined

getSupplyRate

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

Calculates the current supply rate per block

Parameters

Name
Type
Description

cash

uint256

The amount of cash in the market

borrows

uint256

The amount of borrows in the market

reserves

uint256

The amount of reserves in the market

reserveFactorMantissa

uint256

The current reserve factor for the market

Returns

Name
Type
Description

_0

uint256

The supply rate percentage per block as a mantissa (scaled by 1e18)

jumpMultiplierPerBlock

function jumpMultiplierPerBlock() external view returns (uint256)

The multiplierPerBlock after hitting a specified utilization point

Returns

Name
Type
Description

_0

uint256

undefined

kink

function kink() external view returns (uint256)

The utilization point at which the jump multiplier is applied

Returns

Name
Type
Description

_0

uint256

undefined

multiplierPerBlock

function multiplierPerBlock() external view returns (uint256)

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

Returns

Name
Type
Description

_0

uint256

undefined

owner

function owner() external view returns (address)

The address of the owner, i.e. the Timelock contract, which can update parameters directly

Returns

Name
Type
Description

_0

address

undefined

updateJumpRateModel

function updateJumpRateModel(uint256 baseRatePerYear, uint256 multiplierPerYear, uint256 jumpMultiplierPerYear, uint256 kink_) external nonpayable

Update the parameters of the interest rate model (only callable by owner, i.e. Timelock)

Parameters

Name
Type
Description

baseRatePerYear

uint256

The approximate target base APR, as a mantissa (scaled by 1e18)

multiplierPerYear

uint256

The rate of increase in interest rate wrt utilization (scaled by 1e18)

jumpMultiplierPerYear

uint256

The multiplierPerBlock after hitting a specified utilization point

kink_

uint256

The utilization point at which the jump multiplier is applied

utilizationRate

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

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

Parameters

Name
Type
Description

cash

uint256

The amount of cash in the market

borrows

uint256

The amount of borrows in the market

reserves

uint256

The amount of reserves in the market (currently unused)

Returns

Name
Type
Description

_0

uint256

The utilization rate as a mantissa between [0, 1e18]

Events

NewInterestParams

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

Parameters

Name
Type
Description

baseRatePerBlock

uint256

undefined

multiplierPerBlock

uint256

undefined

jumpMultiplierPerBlock

uint256

undefined

kink

uint256

undefined

Last updated