How to perform liquidations on Ionise? Liquidations involve seizing collateral from under-collateralized accounts to repay outstanding debts.

Account Liquidity Calculations

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.

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

Iterating over all accounts and checking the liquidity and shortfall for every account is extremely inefficient.

Instead, liquidators should rely on off-chain computations and maintain an off-chain mapping for accounts and balances. Using functions like Comptroller.getAccountLiquidity() and VenusLens.vTokenBalancesAll()can help retrieve balances efficiently for multiple iTokens associated with an account. By combining the information obtained from oracles and these functions, one can accurately identify under-collateralized accounts that are suitable for liquidation.

Finding Under-Collateralized Accounts

The first step to performing a liquidation is to identify under-collateralized accounts. Here's a suggested approach to finding under-collateralized accounts:

  1. Create a record of account balances: To identify under-collateralized accounts efficiently, liquidators can maintain an off-chain mapping of accounts and balances by indexing market events to detect new positions and update existing ones:

    • Mint: Event emitted when tokens are minted.

    • Redeem: Event emitted when tokens are redeemed.

    • Borrow: Event emitted when underlying is borrowed.

    • RepayBorrow: Event emitted when a borrow is repaid. By listening to these events, liquidators can track changes in positions and update the balances of users accordingly.

  2. Get account balances: Use the vTokenBalancesAll function provided by VenusLens to retrieve supply and borrow balances for multiple iTokens associated with an account. This function takes an array of iTokens and the account address as parameters.

  3. Get underlying asset prices: Use the vTokenUnderlyingPriceAll function provided by the VenusLens to retrieve the underlying asset prices for multiple iTokens. This function takes an array of iTokens as a parameter.

  4. Calculate liquidity shortfall: With the supply and borrow balances obtained from step 2 and the underlying asset prices from step 3, calculate the liquidity shortfall for each account. This can be done by taking the scalar product of the balances and prices and comparing them against the LT values.

By following this approach, you can efficiently identify under-collateralized accounts.

t's important to stay updated with any changes or updates to Ionise Protocol that may impact the process of finding under-collateralized accounts.

Performing the Liquidation

Once an under-collateralized account has been identified, the liquidation process can be initiated using the liquidateBorrow function. liquidateBorrow is provided by the Liquidator contract. Regardless of which market is used as collateral or which should be seized, this is the contract to call.

There are two important values to know for this process:

  1. The close factor. This is the percent of a under-collateralized loan that can be repaid in a single transaction. If a user has multiple borrowed assets, the closeFactor applies to any single asset (not the aggregate borrow balance). Example: If Alice has under-collateralized loan of 10,000 USDT, and the close factor is 50%, you can max liquidate 5000 USDT in a single transaction.

  2. The Liquidation incentive. This is how much additional collateral is given to liquidators. For example, if incentive is 1.1, liquidators receive an extra 10% of the borrower's collateral for every unit they close.

Here's an overview of the steps involved:

  1. Calculate the liquidation amount: Determine the amount of debt to be repaid and the collateral to be seized. This is typically calculated by examining the borrower's debt balance, the market's close factor and liquidation incentive.

  2. Call the liquidateBorrow() function on the liquidator contract

Collateral > minLiquidatableCollateral --> liquidateBorrow(): Call the liquidateBorrow function on the relevant vToken contract. This function requires several parameters, including the borrower's address, the amount of debt to be repaid, and the collateral to be seized. Refer to the iToken contract documentation for specific details on the function's required parameters.


Close Factor: 50% Liquidation Threshold: 80% Borrow Amount: $13,000 Collateral Amount: $20,000 Liquidation Incentive: 110%

The liquidation threshold is triggered when the borrow amount reaches 80% or greater than the value of the collateral. In this case, if the collateral value drops to $16,250 ( $ 13 , 000 ÷ 0.80 $13,000÷0.80), the position becomes eligible for liquidation.

Liquidators can repay up to $6,500 of the borrower's debt ( $ 13,000 x 50 %). Let's assume the liquidator chooses to repay $1,000 of the borrower's debt. We can calculate the Collateral Seized Amount (the amount that is seized from the borrower's collateral) as follows: Collateral Seized Amount = Repayment Amount * Liquidation Incentive Collateral Seized Amount = $1,000 * 1.1 Collateral Seized Amount = $1,100

Calculating the Collateral Seized Amount:

  • The liquidator chooses to repay $1,000 of the borrower's debt.

  • Considering the Liquidation Incentive of 110%, the calculation becomes: Collateral Seized Amount= $1,000 × 1.1 = $1,100


  • The liquidator will provide $1,000 for the liquidation.

  • After the liquidation, the liquidator will receive collateral worth $1,100.

  • This ensures the liquidator is properly incentivized, and the protocol’s stability is maintained by making sure positions are adequately collateralized.

In conclusion, the liquidator will provide $1,000 for the liquidation. After the liquidation, the liquidator will receive $1,050 and the rest $50 will go to the protocol.

After invoking liquidateBorrow, monitor the transaction's success and handle any resulting events or errors. Successful liquidations will transfer the seized collateral to the liquidator's address and repay the debt from the borrower's account. Please note that the liquidation process involves complex calculations and requires a deep understanding of Ionise Protocol. It's essential to thoroughly test and validate your liquidation bot before deploying it in a production environment. Additionally, keep track of any changes or updates to the Ionise Protocol that may impact the liquidation process.

Last updated