InterestRateModel

InterestRateModel

Dynamic interest rate model implementation

Model stores some Silo specific data. If model is replaced, it needs to set proper config after redeployment for seamless service. Please refer to separte litepaper about model for design details.

Methods

DP

function DP() external view returns (int256)

DP is 18 decimal points used for integer calculations

Returns

RCOMP_MAX

function RCOMP_MAX() external view returns (uint256)

maximum value of compound interest the model will return

Returns

X_MAX

function X_MAX() external view returns (int256)

maximum value of X for which, RCOMP_MAX should be returned

Returns

acceptOwnership

function acceptOwnership() external nonpayable

Transfers ownership of the contract to a pending owner Can only be called by the pending owner.

calculateCompoundInterestRate

function calculateCompoundInterestRate(IInterestRateModel.Config _c, int256 _u, uint256 _interestRateTimestamp, uint256 _blockTimestamp) external pure returns (uint256 rcomp, int256 ri, int256 Tcrit)

pure function that calculates interest rate based on raw input data

Parameters

Returns

calculateCurrentInterestRate

function calculateCurrentInterestRate(IInterestRateModel.Config _c, int256 _u, uint256 _interestRateTimestamp, uint256 _blockTimestamp) external pure returns (uint256 rcur)

pure function that calculates current annual interest rate

Parameters

Returns

config

function config(address, address) external view returns (int256 uopt, int256 ucrit, int256 ulow, int256 ki, int256 kcrit, int256 klow, int256 klin, int256 beta, int256 ri, int256 Tcrit)

Parameters

Returns

getCompoundInterestRate

function getCompoundInterestRate(address _silo, address _asset, uint256 _blockTimestamp) external view returns (uint256 rcomp)

get compound interest rate

Parameters

Returns

getCompoundInterestRateAndUpdate

function getCompoundInterestRateAndUpdate(address _asset, uint256 _blockTimestamp) external nonpayable returns (uint256 rcomp)

get compound interest rate and update model storage

Parameters

Returns

getConfig

function getConfig(address _silo, address _asset) external view returns (struct IInterestRateModel.Config)

Get config for giver asset in a Silo. If dedicated config is not set, default one will be returned.

Parameters

Returns

getCurrentInterestRate

function getCurrentInterestRate(address _silo, address _asset, uint256 _blockTimestamp) external view returns (uint256 rcur)

get current annual interest rate

Parameters

Returns

interestRateModelPing

function interestRateModelPing() external pure returns (bool)

just a helper method to see if address is a InterestRateModel

Returns

owner

function owner() external view returns (address)

Returns the address of the current owner.

Returns

pendingOwner

function pendingOwner() external view returns (address)

Returns the address of the pending owner.

Returns

renounceOwnership

function renounceOwnership() external nonpayable

Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

setConfig

function setConfig(address _silo, address _asset, IInterestRateModel.Config _config) external nonpayable

Set dedicated config for giver asset in a Silo. Config is per asset per Silo so different assets in different Silo can have different configs.

Parameters

transferOwnership

function transferOwnership(address newOwner) external nonpayable

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters

transferPendingOwnership

function transferPendingOwnership(address newPendingOwner) external nonpayable

Transfers pending ownership of the contract to a new account (newPendingOwner). Can only be called by the current owner.

Parameters

Events

ConfigUpdate

event ConfigUpdate(address indexed silo, address indexed asset, IInterestRateModel.Config config)

Emitted on config change

Parameters

OwnershipPending

event OwnershipPending(address indexed previousOwner, address indexed newOwner)

Emitted when ownership transfer is proposed, aka pending owner is set

Parameters

OwnershipTransferred

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Emitted when ownership is transferred on transferOwnership and acceptOwnership

Parameters

Last updated