Liquidations
A position is liquidated when its equity falls to the 10% maintenance margin — roughly a 90% loss. Liquidation on Levant is permissionless, priced at the raw oracle mark with no adverse spread, isolated to that one position, and structured so LPs never take bad debt.
When a position becomes liquidatable
Your position's equity is its collateral (the net margin backing the position, after the open fee) plus unrealized PnL, minus accrued funding. As the mark moves against you and funding accrues, equity falls. A position becomes liquidatable the instant equity drops to or below the maintenance margin, which Levant sets at 10% of collateral. In practice that is roughly a 90% loss on your margin, funding included.
equity = collateral + unrealizedPnL - accruedFunding
liquidatable when equity <= 0.10 x collateral
i.e. loss >= 0.90 x collateralThe trigger is an equity trigger, not a raw-price one: it folds in funding, so a position on the crowded side that pays funding drifts toward liquidation over time even if the price is flat. The contract's liquidatePosition re-derives PnL and funding at the reported mark and reverts with NotLiquidatable unless equity is genuinely at or below the 10% threshold. A read-only previewLiquidation(positionId, markPrice) view returns the same liquidatable / equity / effectivePnl numbers, so you (or a keeper) can check the exact on-chain condition before acting.
Priced at the raw oracle mark — no adverse spread
Ordinary closes fill at the mid plus a spread that always moves the exit price against you. Liquidation does not. The trigger check and the settlement PnL are both computed at the raw verified oracle mark, with no price-impact or skew spread applied. A position can therefore only be liquidated when it is truly underwater at the real oracle price — the engine will not tip you over the line with a spread you never chose.
Permissionless liquidation
Liquidation is permissionless. There is no privileged liquidator: anyone can call liquidatePosition on an eligible position by submitting a signed oracle price report. The mark must carry a valid oracle signature, so a caller cannot forge a price to force a liquidation, and the contract re-checks the maintenance-margin condition against that verified price before settling. Today the oracle is 1-of-1 — the keeper is the sole signer (m-of-n across independent machines is on the roadmap) — so in practice a liquidation is settled at a keeper-signed mark. But liquidatePosition itself grants the keeper no special right: it carries no keeper-only guard, and anyone relaying a valid signed price can trigger it inside the exact same on-chain checks.
What happens on liquidation
Levant follows the gTrade Model A rule: a liquidated trader forfeits all remaining collateral and receives nothing back. That collateral is split — the liquidator (whoever called it) is paid 5% of collateral as a reward, and the remaining 95% funds the LP loss buffer in the Levant Vault, the same vault that was the counterparty to the trade. The position is deleted, its reserved liquidity (margin x 9, locked to fund the capped max profit) is released back to the vault, and any pending close flag is cleared.
| Component | Amount | Goes to |
|---|---|---|
| Maintenance margin (trigger) | 10% of collateral | — equity threshold |
| Liquidation fee (reward) | 5% of collateral | the liquidator (msg.sender) |
| Remainder | 95% of collateral | LP loss buffer (vault) |
| Returned to trader | 0 | — (full forfeiture) |
| Reserved liquidity | margin x 9 | released back to the vault |
Isolated — only the liquidated position is touched
Margin is isolated per position. A liquidation deletes and settles only that one position; it cannot reach into your other open positions, your wallet, or any unrelated trader's margin. The most you can ever lose from a single trade is that trade's own collateral. Two positions in the same market are still independent — one can be liquidated while the other stays open and healthy.
Why liquidations never create bad debt
The numbers are ordered so the vault is always made whole. On-chain, setMarketConfig rejects any market unless the liquidation fee is strictly below the maintenance margin, which is itself between 0 and 100% — here 5% < 10% < 100%. Because the position is force-closed while ~10% of collateral still remains as equity, and the trader forfeits all of it, there is always more than enough to pay the 5% reward and still hand the vault more than the trader's realized loss. Liquidation fee < maintenance < 100% means a liquidation can never leave the vault covering a shortfall it cannot fund — Levant does not accumulate bad debt from liquidations, and the collateral - reward split can never underflow.
Estimating your liquidation price
Liquidation lands near a 90% loss on margin, and a position's loss scales with leverage. So the adverse price move you can absorb before liquidation is approximately 0.9 divided by your leverage. Higher leverage means a much tighter buffer.
Long: P_liq ~= entry x (1 - 0.9 / leverage)
Short: P_liq ~= entry x (1 + 0.9 / leverage)
0.9 = 1 - maintenance margin (10%)
leverage = notional / margin
Accrued funding pushes P_liq closer to entry over time.| Leverage | Approx. adverse move to liquidation |
|---|---|
| 2x | ~45% |
| 5x | ~18% |
| 10x | ~9% |
| 20x | ~4.5% |
| 50x | ~1.8% |
| 100x (max) | ~0.9% |
The liquidatable-at-open guard
Levant will not open a position that is already dead on arrival. At fill time, executeOpen checks the fresh position against the same maintenance-margin rule at the mark it filled against; if it would already be at or under maintenance, the whole open reverts with `LiquidatableAtOpen`. This matters at very high leverage, where the entry spread alone can push a position under the 10% threshold in the same block it is created. When the guard trips, the transaction reverts entirely: the position is never minted, no open fee is taken, and your escrowed collateral stays fully reclaimable with cancelIntent. It protects you from paying a fee only to be liquidated in the next block.
How to avoid liquidation
- Add margin.
addMargindeposits more collateral into the open position; size (notional) stays the same, so effective leverage falls and the liquidation price moves further away. It needs no price and is always safe. - Use less leverage. Opening at lower leverage widens the adverse move you can absorb — the single biggest lever on how far your liquidation price sits from entry.
- Set a stop-loss. A keeper closes the position at market when the mark crosses your stop, realizing a controlled loss and returning your remaining collateral instead of forfeiting all of it to a liquidation.
- Watch funding. On the crowded side you pay funding continuously, which erodes equity even if price is flat and pulls your real liquidation price toward entry. Factor it into how long you hold.
- Partially close.
closePartialrealizes proportional PnL and releases proportional reserved liquidity, cutting exposure while keeping the rest of the trade open. - Mind withdrawals.
removeMarginraises effective leverage and is rejected (UnsafeMargin) if it would leave you at or below maintenance at the current mark — you can never withdraw straight into a liquidation.
