JumpRateModelV3
Overview
License: MIT
V3 interest rate Model.
Structs info
BlendingTokenInfo
RateInfo
Events info
NewInterestParams
Emitted when the owner of the interest rate model is updated.
Parameters:
Name | Type | Description |
---|---|---|
gainPerBlock | uint256 | The new gainPerBlock. |
jumGainPerBlock | uint256 | The new jumGainPerBlock. |
targetUtil | uint256 | The new targetUtil. |
NewOwner
Emitted when the owner of the contract is updated.
Parameters:
Name | Type | Description |
---|---|---|
newOwner | address | The address of the new owner. |
NewInterest
Emitted when a new interest rate is set.
Parameters:
Name | Type | Description |
---|---|---|
appliedBlock | uint256 | The block number at which the interest rate was applied. |
interestRate | uint256 | The new interest rate. |
Constants info
MODERATOR_ROLE (0x797669c9)
State variables info
blocksPerYear (0xa385fb96)
The approximate number of blocks per year that is assumed by the interest rate model.
blendingTokenInfo (0x582d785a)
rateInfo (0x3a86fb41)
isBlendingTokenSupport (0xb7979487)
Modifiers info
onlyBlendingToken
Modifier to restrict access to only the blending token contract.
onlyAdmin
Modifier to check if the caller is the default admin role.
onlyModerator
Modifier to check if the caller has the moderator role.
Functions info
initialize (0xfe4b84df)
Constructs an interest rate model.
Parameters:
Name | Type | Description |
---|---|---|
blocksPerYear_ | uint256 | Number of blocks in a year for compounding. |
grantModerator (0x6981c7ae)
Grants the MODERATOR_ROLE
to a new address. The caller must have the ADMIN_ROLE
.
Parameters:
Name | Type | Description |
---|---|---|
newModerator | address | The address to grant the role to. |
revokeModerator (0x36445636)
Revokes the moderator role from the specified address. The caller must have the admin role.
Parameters:
Name | Type | Description |
---|---|---|
moderator | address | The address of the moderator to revoke the role from. |
updateJumpRateModel (0x10b86276)
Updates the parameters of the interest rate model (only callable by owner, i.e. Timelock). Only the contract moderator can call this function.
Parameters:
Name | Type | Description |
---|---|---|
gainPerYear | uint256 | The rate of increase in interest rate wrt utilization (scaled by 1e18). |
jumGainPerYear | uint256 | The jumGainPerBlock after hitting a specified utilization point. |
targetUtil_ | uint256 | The utilization point at which the jump multiplier is applied. |
setBlockPerYear (0x03700d6b)
Sets the number of blocks per year for the JumpRateModelV3 contract. Only the contract moderator can call this function.
Parameters:
Name | Type | Description |
---|---|---|
blocksPerYear_ | uint256 | The new number of blocks per year. |
addBLendingTokenSupport (0xf9828944)
Adds support for a new blending token to the JumpRateModelV3 contract.
Requirements:
blendingToken
cannot be the zero address.Only the contract moderator can call this function.
Parameters:
Name | Type | Description |
---|---|---|
blendingToken | address | The address of the blending token to add support for. |
gainPerYear | uint256 | The gain per year for the blending token. |
jumGainPerYear | uint256 | The jump gain per year for the blending token. |
targetUtil_ | uint256 | The target utilization rate for the blending token. |
newMaxBorrow | uint256 | The new maximum borrow rate for the blending token. |
removeBLendingTokenSupport (0xff60fb68)
Removes blending token support for the specified blending token address.
Requirements:
_blending
cannot be the zero address._blending
must be a supported blending token.
Parameters:
Name | Type | Description |
---|---|---|
_blending | address | The address of the blending token to remove support for. |
setMaxBorrowRate (0xa8801029)
Sets the maximum borrow rate for a blending token.
Requirements:
The caller must have the
onlyModerator
modifier.The blending token must be supported by the contract.
Parameters:
Name | Type | Description |
---|---|---|
blendingToken | address | The address of the blending token. |
newMaxBorrow | uint256 | The new maximum borrow rate to be set. |
updateBlockNumber (0x938c9cf6)
Updates the block number for a given blending token.
Requirements:
The caller must have the
onlyModerator
modifier.The blending token must be supported.
Parameters:
Name | Type | Description |
---|---|---|
blendingToken | address | The address of the blending token to update. |
utilizationRate (0x6e71e2d8)
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). |
Return values:
Name | Type | Description |
---|---|---|
[0] | uint256 | The utilization rate as a mantissa between [0, 1e18]. |
getInterestRateChange (0x86959d81)
Calculates the change in the interest rate per block 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. |
Return values:
Name | Type | Description |
---|---|---|
[0] | int256 | The change in the interest rate per block per block as a mantissa (scaled by 1e18). |
getBlockNumber (0x42cbb15c)
Function to simply retrieve block number. This exists mainly for inheriting test contracts to stub this result.
storeBorrowRate (0x5eeaafea)
Calculates and stores the current borrow interest rate per block for the specified blending token.
Parameters:
Name | Type | Description |
---|---|---|
cash | uint256 | The total amount of cash the market has. |
borrows | uint256 | The total amount of borrows the market has outstanding. |
reserves | uint256 | The total amount of reserves the market has. |
Return values:
Name | Type | Description |
---|---|---|
[0] | uint256 | The calculated borrow rate per block, represented as a percentage and scaled by 1e18. |
getSupplyRate (0x32dc9b1c)
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. |
Return values:
Name | Type | Description |
---|---|---|
[0] | uint256 | The supply rate percentage per block as a mantissa (scaled by 1e18). |
getBorrowRate (0x89469df9)
Calculates the current borrow 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. |
Return values:
Name | Type | Description |
---|---|---|
[0] | uint256 | The borrow rate percentage per block as a mantissa (scaled by 1e18). |
Last updated