Liquidate Borrow

A user who has negative Account Liquidity is subject to forced liquidation by other users of the protocol to return his/her account liquidity back to positive (above the max collateral ratio). 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 of any individual outstanding borrow of the underwater account.

Liquidators must interact with each fToken contract in which they wish to repay a borrow and seize another asset as collateral. When collateral is seized, the liquidator is transferred fTokens, which they may redeem the same as if they had supplied the asset themselves. Users must approve each fToken contract before calling liquidate, as they are transferring funds into the contract.

FBep20

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

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

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

  • fTokenCollateral: The address of the fToken currently held as collateral by a borrower, that the liquidator shall seize

  • RETURN: 0 on success, otherwise an Error Code

Before repaying an asset, users must first approve the fToken to access their token balance.

FBnb

function liquidateBorrow(address borrower, address fTokenCollateral) payable
  • msg.value: payable The amount of ether to be repaid and converted into collateral, in wei

  • msg.sender: The account which shall liquidate the borrower by repaying their debt and seizing their collateral

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

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

  • RETURN: No return, reverts on error

Solidity

FBnb fToken = FBnb(0x3FDB...);
FBep20 fTokenCollateral = FBep20(0x3FDA...);
require(fToken.liquidateBorrow.value(100)(0xBorrower, fTokenCollateral) == 0, "borrower underwater??");

Web3 1.0

const fToken = FBep20.at(0x3FDA...);
const fTokenCollateral = FBnb.at(0x3FDB...);
await fToken.methods.liquidateBorrow(0xBorrower, 33, fTokenCollateral).send({from: 0xLiquidator});

Last updated