Liquidations, ADL & insurance
Liquidation closes a subaccount's positions when its equity falls below the maintenance margin. If closing is not enough and collateral goes negative, the deficit is covered in order by the insurance fund, counterparties and ADL.
When liquidation starts
- Condition. The subaccount's equity at the oracle price is below its total maintenance margin.
- When it is checked. At the end of every block. Subaccounts with the largest margin shortfall are liquidated first.
- How many per block. Up to 500 subaccounts and 2,000 positions; the rest go in the next block.
- Stale price. If the oracle price is stale, liquidation waits for a fresh price. If the oracle has closed the pair (a pause or the circuit breaker), its positions are valued at the oracle's last price and liquidated without waiting.
How positions are closed
- Book. The protocol sends a market reduce order to the book; trades execute at the prices of orders in the book. The liquidated account pays no taker fee.
- Pairing. The remainder that found no orders in the book is closed against opposite positions at the oracle price, without fees. Their owners close the same part of their positions. Positions with the highest return on margin (PnL / IM) go first.
- Penalty. After the close, a penalty of 0.5% of the closed notional is charged and goes to the insurance fund. The penalty never pushes a subaccount below zero: if collateral is short, the penalty is reduced or skipped.
If the market is paused, by governance or automatically because of a stale price, or its oracle pair is paused, the book is skipped and the whole position is closed by pairing.
Bankruptcy
If collateral is negative after the close, the deficit is covered in this order:
- Insurance fund. Pays as long as it has funds.
- Pairing counterparties. The profit they made when closed in step 2 is returned, up to the deficit.
- ADL. Profit is taken from profitable positions on the opposite side, starting with the highest return on margin. Positions are not closed: the profit taken shows up as a shift of the entry price. Only profit is taken; it never pushes a position into a loss.
- Bad debt. The remainder is recorded as bad debt. If accumulated bad debt exceeds 10,000 USDC, trading stops until governance decides.
After a bankruptcy with a deficit of 0.1 USDC or more, withdrawals and transfers across the network are frozen for 50 blocks. Details are in Subaccounts & margin.
Insurance fund
- Inflows:
- 20% of trading fees;
- liquidation penalties;
- contributions: any address can top up the fund with
MsgSeedInsuranceFund.
- Outflows. Only covering bankruptcy deficits.
- Warnings. If the fund's balance falls below 10,000 USDC and below 1,000 USDC, the network emits warning events.
Recovery after a halt
Governance tops up the fund, writes off the recorded debt with MsgClearBadDebt and resumes trading with a proposal.