| layout | title |
|---|---|
default |
AlkemiRateModel |
View Source: contracts/AlkemiRateModel.sol
↗ Extends: Exponential
{{ContractName}}
See Model here
Enums
enum IRError {
NO_ERROR,
FAILED_TO_ADD_CASH_PLUS_BORROWS,
FAILED_TO_GET_EXP,
FAILED_TO_MUL_PRODUCT_TIMES_BORROW_RATE
}Constants & Variables
//internal members
uint256 internal constant blocksPerYear;
struct Exponential.Exp internal SpreadLow;
struct Exponential.Exp internal BreakPointLow;
struct Exponential.Exp internal ReserveLow;
struct Exponential.Exp internal ReserveMid;
struct Exponential.Exp internal SpreadMid;
struct Exponential.Exp internal BreakPointHigh;
struct Exponential.Exp internal ReserveHigh;
struct Exponential.ExpNegative internal SpreadHigh;
struct Exponential.Exp internal MinRateActual;
struct Exponential.Exp internal HealthyMinURActual;
struct Exponential.Exp internal HealthyMinRateActual;
struct Exponential.Exp internal MaxRateActual;
struct Exponential.Exp internal HealthyMaxURActual;
struct Exponential.Exp internal HealthyMaxRateActual;
//public members
address public owner;
address public newOwner;
string public contractName;Events
event OwnerUpdate(address indexed owner, address indexed newOwner);modifier onlyOwner() internalArguments
| Name | Type | Description |
|---|
- changeRates(string _contractName, uint256 MinRate, uint256 HealthyMinUR, uint256 HealthyMinRate, uint256 HealthyMaxUR, uint256 HealthyMaxRate, uint256 MaxRate)
- transferOwnership(address newOwner_)
- acceptOwnership()
- getUtilizationRate(uint256 cash, uint256 borrows)
- getUtilizationAndAnnualBorrowRate(uint256 cash, uint256 borrows)
- getSupplyRate(address _asset, uint256 cash, uint256 borrows)
- getBorrowRate(address asset, uint256 cash, uint256 borrows)
function changeRates(string _contractName, uint256 MinRate, uint256 HealthyMinUR, uint256 HealthyMinRate, uint256 HealthyMaxUR, uint256 HealthyMaxRate, uint256 MaxRate) public nonpayable onlyOwner Arguments
| Name | Type | Description |
|---|---|---|
| _contractName | string | |
| MinRate | uint256 | |
| HealthyMinUR | uint256 | |
| HealthyMinRate | uint256 | |
| HealthyMaxUR | uint256 | |
| HealthyMaxRate | uint256 | |
| MaxRate | uint256 |
function transferOwnership(address newOwner_) external nonpayable onlyOwner Arguments
| Name | Type | Description |
|---|---|---|
| newOwner_ | address |
function acceptOwnership() external nonpayableArguments
| Name | Type | Description |
|---|
function getUtilizationRate(uint256 cash, uint256 borrows) internal pure
returns(enum AlkemiRateModel.IRError, struct Exponential.Exp)Arguments
| Name | Type | Description |
|---|---|---|
| cash | uint256 | |
| borrows | uint256 |
function getUtilizationAndAnnualBorrowRate(uint256 cash, uint256 borrows) internal view
returns(enum AlkemiRateModel.IRError, struct Exponential.Exp, struct Exponential.Exp)Arguments
| Name | Type | Description |
|---|---|---|
| cash | uint256 | |
| borrows | uint256 |
Gets the current supply interest rate based on the given asset, total cash and total borrows
function getSupplyRate(address _asset, uint256 cash, uint256 borrows) public view
returns(uint256, uint256)Returns
Success or failure and the supply interest rate per block scaled by 10e18
Arguments
| Name | Type | Description |
|---|---|---|
| _asset | address | The asset to get the interest rate of |
| cash | uint256 | The total cash of the asset in the market |
| borrows | uint256 | The total borrows of the asset in the market |
Gets the current borrow interest rate based on the given asset, total cash and total borrows
function getBorrowRate(address asset, uint256 cash, uint256 borrows) public view
returns(uint256, uint256)Returns
Success or failure and the borrow interest rate per block scaled by 10e18
Arguments
| Name | Type | Description |
|---|---|---|
| asset | address | The asset to get the interest rate of |
| cash | uint256 | The total cash of the asset in the market |
| borrows | uint256 | The total borrows of the asset in the market |