Abax Documentation
  • 🧮Meet Abax!
    • Overview
    • Glossary
  • Lending
    • Collateral & Borrowing
    • Health Factor
    • Market Rules
    • Interest Rate Model
    • Liquidation
      • Liquidation Formula
    • Protocol Fee
  • Tokenomics
    • Abax Token
    • Public Contribution
    • Promotional Campaigns
  • How to Use Abax
    • How to Start Using Abax?
    • How Can I Make a Deposit?
    • How Do I Withdraw?
    • How Can I Borrow?
    • How Do I Repay Debt?
  • Governance
    • Governance System
  • Contracts
    • Lending Protocol
      • Lending Pool
        • Messages
          • Lending Pool Actions
          • Lending Pool Flash
          • Lending Pool Maintain
          • Lending Pool Manage
          • Lending Pool View
          • A Token Interface
          • V Token Interface
        • Storage
          • Types
          • Structs
        • Calculations
          • Interest Accumulation
          • Account Interest Accumulation
          • Rate Recalculation
          • Calculate Lending Power
        • Errors
    • Abax DAO
Powered by GitBook
On this page
  • Corresponding to each Asset
  • Reserve Data
  • Reserve Indexes And Fees
  • Reserve Restrictions
  • Reserve Abacus Tokens
  • Corresponding to each Account
  • AccountConfig
  • Corresponding to a pair (Account, Asset);
  • AccountReserveData
  1. Contracts
  2. Lending Protocol
  3. Lending Pool
  4. Storage

Structs

Corresponding to each Asset

Reserve Data

pub struct ReserveData {
    pub activated: bool,
    pub frozen: bool,

   
    pub total_deposit: Balance,
    pub total_debt: Balance,

    pub current_deposit_rate_e18: u64,
    pub current_debt_rate_e18: u64,
}

Each asset has it's corresponding Reserve Data that describes

  • activated - if false depositing/withdrawing and borrowing/repaying of the asset is not possible.

  • frozen - if true depositing and borrowing of the asset is not possible.

  • total_deposit - a sum of all deposits of the asset made by all account's including already accumulated interests.

  • total_debt - a sum of all all debts in the asset made by all account's including already accumulated interests.

  • current_deposit_rate_e18 - a current interest earned on the deposits of the asset per millisecond multiplied by 10^18. This rate includes fee thus to real interest earned by an account is reduced by the fee.

  • current_debt_rate_e18 - a current interest paid on the debt in the asset per millisecond multiplied by 10^18. This rate does NOT include fee thus the real interest paid by an account is increased by the fee.

Reserve Indexes And Fees

pub struct ReserveIndexesAndFees {
    pub indexes: ReserveIndexes,
    pub fees: ReserveFees,
}

pub struct ReserveIndexes {
    pub deposit_index_e18: u128,
    pub debt_index_e18: u128,
    pub update_timestamp: Timestamp,
}

pub struct ReserveFees {
    pub deposit_fee_e6: u32,
    pub debt_fee_e6: u32,
}

Each asset has it's corresponding Reserve Indexes And Fees which is built from Reserve Indexes and Reserve Fees.

Reserve Indexes struct describes:

  • deposit_index_e18 - a measure of the accumulated deposit interest - a number that should multiply an initial deposit to get the current deposit + interest (including fees) - multiplied by 10^18.

  • debt_index_e18 - a measure of the accumulated debt interest - a number that should multiply an initial debt to get the current debt + interest(excluding fees) - multiplied by 10^18.

  • update_timestamp - a last timestamp at which the indexes where updated.

Reserve Fees struct describes:

  • deposit_fee_e6 - a part of accumulated deposit interest that is distributed to an account that is charged by the protocol multiplied by 10^6.

  • debt_fee_e6 - a part of accumulated debt interest that that is accumulated to an account that is additionally added to the account's debt and charged by the protocol.

Reserve Restrictions

pub struct ReserveRestrictions {
    pub maximal_total_deposit: Option<Balance>,
    pub maximal_total_debt: Option<Balance>,
    pub minimal_collateral: Balance,
    pub minimal_debt: Balance,
}

Each asset has it's corresponding Reserve Restrictions that describes:

  • maximal_total_deposit - a value that total_deposit can not exceed after deposit action. If None there is no limit.

  • maximal_total_debt - a value that total_debt can not exceed after borrow action. If None there is no limit.

  • minimal_collateral - a value that: - 1) the account's deposit must exceed so the asset can be used as collateral. - 2) if the account deposit falls below after withdraw/liquidation/transfer the asset will not be used as collateral any more.

  • minimal_debt - a value that the account's debt must exceed after borrow/repay/liquidation/transfer.

Reserve Abacus Tokens

pub struct ReserveAbacusTokens {
    pub a_token_address: AccountId,
    pub v_token_address: AccountId,
}

Each asset has it's corresponding Reserve Abacus Tokens that describes:

  • a_token_address - an AccountId of a proxy PSP22 Token representing accounts' deposits.

  • v_token_address - an AccountId of a proxy PSP22 Token representing accounts' debts.

Corresponding to each Account

AccountConfig

pub struct AccountConfig {
    pub deposits: Bitmap128,
    pub collaterals: Bitmap128,
    pub borrows: Bitmap128,
    pub market_rule_id: RuleId,
}

Each account has a corresponding AccountConfig that describes:

  • deposits - a bitmap in which bit on i-th position denotes if an account has deposit of an asset with AssetId = i.

  • collaterals - a bitmap in which bit on i-th position denotes if an account has active collateral of an asset with AssetId = i.

  • borrows - a bitmap in which bit on i-th position denotes if an account has debt of an asset with AssetId = i.

  • market_rule_id - a RuleId that represents a MarketRule chosen by the account.

Corresponding to a pair (Account, Asset);

AccountReserveData

pub struct AccountReserveData {
    pub deposit: Balance,
    pub debt: Balance,
    pub applied_deposit_index_e18: u128,
    pub applied_debt_index_e18: u128,
}

Each account has a AccountReserveData that corresponds to some asset and describes:

  • deposit - amount of the asset the Lending Prtocol owes the account - deposits + interests.

  • debt - amount of the asset the account owes the Lending Protocol - borrows + interests.

  • applied_deposit_index_e18 - the value of deposit_index_e18 of the asset on the last interaction (interest accumulation).

  • applied_debt_index_e18 - the value of the debt_index_e18 of the asset on the last interaction (interest accumulation).

PreviousTypesNextCalculations

Last updated 1 year ago