Developers
  • Introduction
  • QTokens
    • Transfer
    • Total Supply
    • Underlying Balance
    • Exchange Rate
    • Get Cash
    • Total Borrow
    • Borrow Balance
    • Borrow Rate
    • Supply Rate
    • Total Reserve
    • Reserve Factor
    • Key Events
  • Qore
    • Market List
    • Enter Markets
    • Exit Markets
    • Get Markets In
    • Supply
    • Redeem with QToken
    • Redeem with Underlying
    • Borrow
    • Repay Borrow
    • Repay Borrow Behalf
    • Liquidate Borrow
    • Get Account Liquidity
    • Market Information
    • Close Factor
    • Liquidation Incentive
    • Qubit Distribution Speeds
    • Pending Qubit (or Accrued Qubit)
    • Claim Qubit
    • Key Events
  • Qubit Locker
    • qScore
    • Total qScore
    • Deposit
    • Locked Balance
    • Locked Period
    • Extend Lock Period
    • Unlocked Balance
    • Withdraw
Powered by GitBook
On this page
  • Qore
  • Solidity
  • Ethers.js

Was this helpful?

  1. Qore

Get Account Liquidity

Account Liquidity represents the USD value borrowable by a user, before it reaches liquidation. Users with a shortfall (negative liquidity) are subject to liquidation, and can’t withdraw or borrow assets until Account Liquidity is positive again.

For each market the user has entered into, their supplied balance is multiplied by the market’s collateral factor, and summed; borrow balances are then subtracted, to equal Account Liquidity. Borrowing an asset reduces Account Liquidity for each USD borrowed; withdrawing an asset reduces Account Liquidity by the asset’s collateral factor times each USD withdrawn.

Qore

function accountLiquidityOf(address account) external view returns (uint collateralInUSD, uint supplyInUSD, uint borrowInUSD);
  • account: The account whose liquidity shall be calculated.

  • RETURN: Tuple of values (collateral value in USD, supply value in USD, borrow value in USD). The liquidity can be calculated by subtracting borrow value from collateral value. If the borrow value exceeds the collateral value, the account is currently below his/her collateral requirement and is subject to liquidation.

Solidity

Qore qore = Qore(<qoreAddress>);
(uint collateralInUSD, uint supplyInUSD, uint borrowInUSD) = qore.accountLiquidityOf(<accountAddress>);

Ethers.js

const qore = await ethers.getContractAt(<qoreABI>, <qoreAddress>);
const { collateralInUSD, supplyInUSD, borrowInUSD } = await qore.accountLiquidityOf(<accountAddress>);
PreviousLiquidate BorrowNextMarket Information

Last updated 3 years ago

Was this helpful?