Docs · Concepts

Liquidation

When a position can be liquidated, what the liquidator pays and receives, what returns to the owner, and what the chain shows.

A position can be liquidated only after it has lapsed and only if it is unhealthy. A position that keeps renewing cannot be liquidated, because it cannot be read.

The two conditions

  1. It has lapsed. The current time is past the position's deadline, so the drand round at that deadline is out and the position's last timelock ciphertext decrypts. Its collateral, debt and entry terms are now readable by anyone.
  2. It is unhealthy. At the oracle price the program reads, the renewal inequality fails:
text
borrow:  collateral · price · liq_threshold  <  debt · index / entry
perp:    collateral + pnl − funding          <  size · price · maint_margin

A lapsed position that is still healthy cannot be liquidated. Its owner, or its watcher, renews it and it is sealed again.

Liquidating a borrow

Anyone with a Mesa balance of the borrowed asset can call liquidate.

  • The liquidator repays the position's debt from their balance. It goes to the pool.
  • The liquidator receives collateral worth debt · (1 + liq_bonus) at the oracle price, or the whole collateral if the position holds less than that.
  • The rest of the collateral returns to the owner's account, to the home holder recorded in the position.

For example, in a pool with a liq_bonus_bps of 500, a position owing 1,000 USDC against SOL collateral is liquidated with SOL at 150.00. The liquidator pays 1,000 USDC and receives 1,050 USDC worth of SOL, which is 7 SOL. If the position held 7.5 SOL, the remaining 0.5 SOL returns to its owner.

The liquidator's proof takes the lapsed position as its input and fixes all three outputs, so the liquidator cannot take more than the bonus or redirect the remainder.

Liquidating a perp

A lapsed perp whose margin is below maintenance is closed against the perps vault at the oracle price. The liquidator receives liq_bonus_bps of the position's collateral, and the rest goes to the vault.

The parameters

ParameterWhereMeaning
collateral_factor_bpsPoolThe most that can be borrowed against collateral at entry
liq_threshold_bpsPoolThe fraction of collateral value a debt must stay under to renew
liq_bonus_bpsPool, PerpMarketThe liquidator's bonus
max_leveragePerpMarketThe most size per unit of collateral at entry
maint_margin_bpsPerpMarketThe margin a perp must keep to renew
heartbeatConfigHow long a proof of health stands

The gap between collateral_factor_bps and liq_threshold_bps is the room a new borrow has before it can no longer renew. Current values are in Markets, pools and their parameters.

What the owner sees and can do

Your liquidation price is computed in your browser from your own position and shown only to you. Before the deadline you can add collateral, repay part of the debt, or close. Each of those also renews the position. The app shows each position's health and the time of its next deadline, and who is set to renew it.

After a liquidation, your portfolio shows the position as closed and the remainder as a balance note.

What the chain shows

A liquidation publishes the lapsed position's fields, the amount the liquidator repaid, and the bonus. It does not show the owner: the remainder is paid to a holder key that appears nowhere else.

To liquidate positions yourself, see Run a liquidator.