perpDocs
v1.0
DOCS / §06

Liquidation & ADL

When equity falls to the maintenance margin, a position is liquidated under strict per-block caps, executing against the order book first. If book liquidity can't complete the close, auto-deleveraging handles the remainder; the Insurance Fund is the final financial backstop.

Liquidation trigger

The Liquidation Engine scans open positions on a schedule and marks a position liquidatable when its equity — position margin plus unrealized PnL plus accrued funding, valued at the mark price — reaches the maintenance margin. Status moves OPEN → LIQUIDATING and a close order is submitted to the matching engine — liquidation always attempts to execute against the order book first.

If the available book liquidity cannot complete the liquidation, ADL handles the remaining amount before the Insurance Fund is used.

Pricing a liquidation

Liquidations don't close at market — they close at a fillable price derived from two primitives:

Bankruptcy price
The price at which closing the position exactly zeros total net collateral. It's the floor for the fillable price and the basis for detecting bad debt.
Fillable price
The bankruptcy price moved back toward the mark by a smooth haircut scaled to how distressed the account is. Healthier accounts get a tighter, better fill; deeper-distress accounts give more edge to the liquidator and fund.

The smooth haircut prevents two failure modes at once: thin-book blow-throughs that hand away too much, and undercharging accounts that are only mildly distressed.

Per-block caps

Liquidation is partial-by-default and rate-limited so a single position or a cascade can't drain the system in one block:

CapPurpose
One liquidation per position per blockPrevents same-block cascades on a single position.
Max position portion per liquidationCloses at most a fraction of the position at a time (partial-by-default).
Min position notional liquidatedTiny positions close in one shot rather than dust-cascading.
Max notional per account per blockCaps total liquidated across a user's markets each block.
Max insurance draw per blockBounds how much the fund can be tapped per block; excess defers to the next block.
Max liquidation feeCaps the fee as a fraction of fill notional.
Self-cure A distressed account can keep adjusting as long as each change leaves it no riskier than before — so users can de-risk or self-close instead of being hard-blocked straight into liquidation.

Auto-deleveraging (ADL)

ADL engages when the order book cannot absorb a liquidation — it deleverages the remainder directly against counterparties instead of the book, before any Insurance Fund draw.

In-flight ADL

Fires when the available order-book liquidity is insufficient to complete a liquidation — the close order cannot be filled within the per-block caps. The unfilled remainder is deleveraged directly against counterparties. It does not fire on healthy distress; book execution is always attempted first.

  • Counterparty selection: PnL-ranked. The highest-PnL traders on the opposite side of the distressed position are deleveraged first — those who profited most from the move absorb the residual. Ties break by larger notional, then by older position age. The rule is deterministic and auditable.
  • Execution price: the bankruptcy price of the distressed account — the price that zeros the loser's collateral.
Current behavior In-flight ADL is governed by the committed trigger and selection rules above. Where the in-flight engine is not yet active for a market, the fallback is to halt the market and freeze new opens for operator review; final settlement runs in all cases.

Insurance Fund

The final financial backstop. When book execution and ADL together can't clear the loss — the fillable price is worse than the bankruptcy price and residual bad debt remains — the on-chain Insurance Fund covers it from accumulated fees and liquidation residuals, drawing through the market's escrow, subject to the per-block draw cap.

Order of defense

  1. Position crosses maintenance margin → liquidation executes against the order book at the fillable price, partial and capped by the per-block rate limits.
  2. Book liquidity insufficient → in-flight ADL handles the remaining amount, PnL-ranked, at the bankruptcy price (or market halt where the engine is not yet live).
  3. Residual bad debt → Insurance Fund draw, the final backstop, within the per-block cap.

Final settlement

Separate from the liquidation-loss waterfall above. When the settling window ends, at the Resolved → Settled transition, any remaining open position closes at the final interpolated mark and the market settles. This always runs — it's an ordinary close at the settlement price, not counterparty deleveraging.