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
DP is 18 decimal points used for integer calculations
Returns
_0
int256
undefined
RCOMP_MAX
maximum value of compound interest the model will return
Returns
_0
uint256
undefined
X_MAX
maximum value of X for which, RCOMP_MAX should be returned
Returns
_0
int256
undefined
acceptOwnership
Transfers ownership of the contract to a pending owner Can only be called by the pending owner.
calculateCompoundInterestRate
pure function that calculates interest rate based on raw input data
Parameters
_c
IInterestRateModel.Config
configuration object, InterestRateModel.Config
_u
int256
asset untilization
_interestRateTimestamp
uint256
timestamp of last interest rate update
_blockTimestamp
uint256
current block timestamp
Returns
rcomp
uint256
compounded interest rate from last update until now
ri
int256
current integral part of the rate
Tcrit
int256
time during which the utilization exceeds the critical value
calculateCurrentInterestRate
pure function that calculates current annual interest rate
Parameters
_c
IInterestRateModel.Config
configuration object, InterestRateModel.Config
_u
int256
asset untilization
_interestRateTimestamp
uint256
timestamp of last interest rate update
_blockTimestamp
uint256
current block timestamp
Returns
rcur
uint256
current annual interest rate
config
Parameters
_0
address
undefined
_1
address
undefined
Returns
uopt
int256
undefined
ucrit
int256
undefined
ulow
int256
undefined
ki
int256
undefined
kcrit
int256
undefined
klow
int256
undefined
klin
int256
undefined
beta
int256
undefined
ri
int256
undefined
Tcrit
int256
undefined
getCompoundInterestRate
get compound interest rate
Parameters
_silo
address
address of Silo
_asset
address
address of an asset in Silo for which interest rate should be calculated
_blockTimestamp
uint256
current block timestamp
Returns
rcomp
uint256
compounded interest rate from last update until now
getCompoundInterestRateAndUpdate
get compound interest rate and update model storage
Parameters
_asset
address
address of an asset in Silo for which interest rate should be calculated
_blockTimestamp
uint256
current block timestamp
Returns
rcomp
uint256
compounded interest rate from last update until now
getConfig
Get config for giver asset in a Silo. If dedicated config is not set, default one will be returned.
Parameters
_silo
address
Silo address for which config should be set
_asset
address
asset address for which config should be set
Returns
_0
IInterestRateModel.Config
Config sturct for asset in Silo
getCurrentInterestRate
get current annual interest rate
Parameters
_silo
address
address of Silo
_asset
address
address of an asset in Silo for which interest rate should be calculated
_blockTimestamp
uint256
current block timestamp
Returns
rcur
uint256
current annual interest rate
interestRateModelPing
just a helper method to see if address is a InterestRateModel
Returns
_0
bool
always true
owner
Returns the address of the current owner.
Returns
_0
address
undefined
pendingOwner
Returns the address of the pending owner.
Returns
_0
address
undefined
renounceOwnership
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
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
_silo
address
Silo address for which config should be set
_asset
address
asset address for which config should be set
_config
IInterestRateModel.Config
undefined
transferOwnership
Transfers ownership of the contract to a new account (newOwner
). Can only be called by the current owner.
Parameters
newOwner
address
undefined
transferPendingOwnership
Transfers pending ownership of the contract to a new account (newPendingOwner
). Can only be called by the current owner.
Parameters
newPendingOwner
address
undefined
Events
ConfigUpdate
Emitted on config change
Parameters
silo indexed
address
Silo address for which config should be set
asset indexed
address
asset address for which config should be set
config
IInterestRateModel.Config
config sturct for asset in Silo
OwnershipPending
Emitted when ownership transfer is proposed, aka pending owner is set
Parameters
previousOwner indexed
address
undefined
newOwner indexed
address
undefined
OwnershipTransferred
Emitted when ownership is transferred on transferOwnership
and acceptOwnership
Parameters
previousOwner indexed
address
undefined
newOwner indexed
address
undefined
Last updated