Liquidation

ERC20 Liquidation can be done through calling liquidateERC20() from the PoolCore contract.

function liquidateERC20(
    address collateralAsset,
    address liquidationAsset, 
    address borrower, 
    uint256 liquidationAmount, 
    bool receivePToken 
) external;

Prerequisites

When making a liquidateERC20() call, you must:

  • Know the account (i.e. the ethreum address: borrower) whose health factor is below 1.

  • Supply an asset that the user is currently using in a borrow position (liquidationAsset)

  • Know the user debt amount and asset address (i.e. liquidationAmount & liquidationAsset)

    • If the HF is above CLOSE_FACTOR_HF_THRESHOLD, then only a maximum of 50% (i.e. DEFAULT_LIQUIDATION_CLOSE_FACTOR) of the debt can be liquidated per valid liquidationCall()

    • If the HF is below CLOSE_FACTOR_HF_THRESHOLD, then 100% (i.e. MAX_LIQUIDATION_CLOSE_FACTOR) of the debt can be liquidated in single valid liquidationCall()

    • You can set the liquidationAmount to MAX_UINT = uint256(-1) and the protocol will proceed with the highest possible liquidation allowed.

    • You must already have sufficient balance of the liquidation asset, which will be used by the liquidationCall to pay back the debt.

  • Know the ERC20 collateral asset collateralAsset you closing, i.e. the asset that the user has backing their outstanding loan that you will receive as a bonus.

  • Whether you want to receive p_Tokens or the underlying asset after a successful liquidateERC20()

ERC20 Liquidation Flow Chart

Last updated