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

Last updated