Earn Interest Rate Model (AlkemiRateModel.sol)

View Source: contracts/AlkemiRateModel.sol

↗ Extends: Exponential

See Model here

Enums

IRError

enum IRError {
 NO_ERROR,
 FAILED_TO_ADD_CASH_PLUS_BORROWS,
 FAILED_TO_GET_EXP,
 FAILED_TO_MUL_PRODUCT_TIMES_BORROW_RATE
}

Contract Members

Constants & Variables

//public members
uint256 public blocksPerYear;
address public owner;
address public newOwner;
string public contractName;

//private members
uint8 private hundred;

//internal members
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.Exp 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;

Events

event OwnerUpdate(address indexed owner, address indexed newOwner);
event blocksPerYearUpdated(uint256  oldBlocksPerYear, uint256  newBlocksPerYear);

Modifiers

  • onlyOwner

onlyOwner

modifier onlyOwner() internal

Arguments

Functions

  • changeRates(string _contractName, uint256 MinRate, uint256 HealthyMinUR, uint256 HealthyMinRate, uint256 HealthyMaxUR, uint256 HealthyMaxRate, uint256 MaxRate)

  • changeBlocksPerYear(uint256 _blocksPerYear)

  • 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)

changeRates

function changeRates(string _contractName, uint256 MinRate, uint256 HealthyMinUR, uint256 HealthyMinRate, uint256 HealthyMaxUR, uint256 HealthyMaxRate, uint256 MaxRate) public nonpayable onlyOwner

Arguments

changeBlocksPerYear

function changeBlocksPerYear(uint256 _blocksPerYear) external nonpayable onlyOwner

Arguments

transferOwnership

function transferOwnership(address newOwner_) external nonpayable onlyOwner

Arguments

acceptOwnership

function acceptOwnership() external nonpayable

Arguments

getUtilizationRate

function getUtilizationRate(uint256 cash, uint256 borrows) internal view
returns(enum AlkemiRateModel.IRError, struct Exponential.Exp)

Arguments

getUtilizationAndAnnualBorrowRate

function getUtilizationAndAnnualBorrowRate(uint256 cash, uint256 borrows) internal view
returns(enum AlkemiRateModel.IRError, struct Exponential.Exp, struct Exponential.Exp)

Arguments

getSupplyRate

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 1e18

Arguments

getBorrowRate

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 1e18

Arguments

Last updated