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

1
function liquidateBorrow(address qTokenBorrowed, address qTokenCollateral, address borrower, uint amount) external payable;
Copied!
  • 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

1
// BNB
2
Qore qore = Qore(<qoreAddress>);
3
qore.liquidateBorrow{ value: <underlyingAmount> }(<qBNBAddress>, <qTokenCollateralAddress>, <borrower>, <underlyingAmount>);
4
5
// Others
6
Qore qore = Qore(<qoreAddress>);
7
qore.liquidateBorrow(<qTokenBorrowedAddress>, <qTokenCollateralAddress>, <borrower>, <underlyingAmount>);
Copied!

Ethers.js

1
// BNB
2
const qore = await ethers.getContractAt(<qoreABI>, <qoreAddress>);
3
await qore.liquidateBorrow(<qBNBAddress>, <borrower>, <underlyingAmount>, { value: <underlyingAmount> });
4
5
// Others
6
const qore = await ethers.getContractAt(<qoreABI>, <qoreAddress>);
7
await qore.liquidateBorrow(<qTokenBorrowedAddress>, <qTokenCollateralAddress>, <borrower>, <underlyingAmount>);
Copied!
Last modified 2mo ago
Copy link