Fliquidator

The Fliquidator contract facilitates the liquidation of users across the vault-pair-type contracts.

Liquidation is the event-process of selling a portion of a user’s collateral to repay the user’s debt. This occurs when the value of their crypto-collateral-asset falls below a predefine threshold to back-up a percentage level of their debt value.

Liquidations are an important key operation job for the safety and protection of the pooled funds in a vault-pair contract.

FUNCTIONS

batchLiquidate()

Liquidate a user or set of users when their position is undercollateralized and get a bonus (defined in parameter bonusL in Vault). Calling user require to own and approve (ERC20) the Fliquidator contract to spend the debt crypto asset of the positions to be liquidated.

function batchLiquidate(address[] calldata _addrs, address _vault)
    external
    payable
    nonReentrant
    isValidVault(_vault) {

flashbatchLiquidate()

Liquidate a user or set of users when their position is undercollateralized and get a bonus (defined in parameter bonusL in Vault) by using a flashloan. Calling user does not require to own the debt crypto asset amount position to be liquidated. However, the bonus for a caller of flashbatchLiquidate is less than batchLiquidate() due to flashloan fees involved at flashloan provider.

function flashBatchLiquidate(
    address[] calldata _addrs,
    address _vault,
    uint8 _flashnum
  ) external isValidVault(_vault) nonReentrant {

executeFlashbatchLiquidation()

This function is the callback of flashloan providers. This call is restricted to the flasher contract and it executes the operations of a flashbatchLiquidation().

function executeFlashBatchLiquidation(
    address[] calldata _addrs,
    uint256[] calldata _borrowBals,
    address _liquidator,
    address _vault,
    uint256 _amount,
    uint256 _flashloanFee
  ) external payable onlyFlash {

flashClose()

Initiates a flashloan used to repay partially or fully the debt position of the caller (msg.sender). Caller can pass (-1) to fully close a debt position, otherwise the specific amount of debt to be repaid. Passing a number above msg.sender debt position will revert transaction.

function flashClose(
    int256 _amount,
    address _vault,
    uint8 _flashnum
  ) external nonReentrant isValidVault(_vault) {

executeflashClose()

This function is the callback of flashloan providers. This call is restricted to the flasher contract and it executes the operations of a flashClose().

function executeFlashClose(
    address payable _userAddr,
    address _vault,
    uint256 _amount,
    uint256 _flashloanFee
  ) external payable onlyFlash {

Last updated