Developers
Search…
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

1
function accountLiquidityOf(address account) external view returns (uint collateralInUSD, uint supplyInUSD, uint borrowInUSD);
Copied!
  • 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

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

Ethers.js

1
const qore = await ethers.getContractAt(<qoreABI>, <qoreAddress>);
2
const { collateralInUSD, supplyInUSD, borrowInUSD } = await qore.accountLiquidityOf(<accountAddress>);
Copied!
Last modified 2mo ago
Copy link