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

Liquidate Borrow

A user who has negative account liquidity is subject to liquidation by other users of the protocol to return his/her account liquidity back to positive (i.e. above the collateral requirement). When a liquidation occurs, a liquidator may repay some or all of an outstanding borrow on behalf of a borrower and in return receive a discounted amount of collateral held by the borrower; this discount is defined as the liquidation incentive.

A liquidator may close up to a certain fixed percentage (i.e. close factor) of any individual outstanding borrow of the underwater account. When collateral is seized, the liquidator is transferred qTokens, which they may redeem the same as if they had supplied the asset themselves.

Qore

function liquidateBorrow(address qTokenBorrowed, address qTokenCollateral, address borrower, uint amount) external payable;
  • msg.sender: The account which shall liquidate the borrower by repaying their debt and seizing their collateral.

  • msg.value: (BNB only) The amount of BNB to be repaid and converted into collateral, in wei.

  • qTokenBorrowed: The address of the qToken market to repay.

  • qTokenCollateral: The address of the qToken currently held as collateral by a borrower, that the liquidator shall seize.

  • borrower: The account with negative account liquidity that shall be liquidated.

  • amount: The amount of the borrowed asset to be repaid and converted into collateral, specified in units of the underlying borrowed asset.

Solidity

// BNB
Qore qore = Qore(<qoreAddress>);
qore.liquidateBorrow{ value: <underlyingAmount> }(<qBNBAddress>, <qTokenCollateralAddress>, <borrower>, <underlyingAmount>);

// Others
Qore qore = Qore(<qoreAddress>);
qore.liquidateBorrow(<qTokenBorrowedAddress>, <qTokenCollateralAddress>, <borrower>, <underlyingAmount>);

Ethers.js

// BNB
const qore = await ethers.getContractAt(<qoreABI>, <qoreAddress>);
await qore.liquidateBorrow(<qBNBAddress>, <borrower>, <underlyingAmount>, { value: <underlyingAmount> });

// Others
const qore = await ethers.getContractAt(<qoreABI>, <qoreAddress>);
await qore.liquidateBorrow(<qTokenBorrowedAddress>, <qTokenCollateralAddress>, <borrower>, <underlyingAmount>);
PreviousRepay Borrow BehalfNextGet Account Liquidity

Last updated 3 years ago

Was this helpful?