D8X
  • D8X TL;DR
    • D8X Overview
    • Onboarding
      • Pick your D8X Frontend
      • Get Funds on X Layer
      • Get Funds on zkEVM
  • Contribute & Earn
    • White-label D8X
    • Traders
    • Liquidity Providers
    • Refer Traders
    • Order Executors
    • Liquidators
    • Governors
    • D8X Trading Competition
      • Week 1: 16th March 2025
      • Week 2: 23rd March 2025
      • Week 3: 30th of March 2025
      • Week 4: 6th of April
      • Week 5: 13th of April
      • Week 6: 20th of April
  • Perpetual Contracts Guide
    • Overview
    • Order Types
    • Fee Structure
    • Profit/Loss & Position Marking
    • Liquidity Pools & Liquidity Provision
    • Liquidations
    • Oracles
  • Contracts
    • Berachain
    • Arbitrum
    • Polygon ZKEVM
  • D8X Token
    • What is $D8X?
    • Supply
    • Utility
  • Node SDK
    • Getting Started
    • Modules
      • Market Data
      • Parent Class PerpetualDataHandler
      • Traders
      • Liquidity Providers
      • Liquidators
      • Order Executors
      • White-Label Partners
    • Market data API
  • SECURITY
    • Audits
  • Contact
    • Brand assets
    • Contact us
Powered by GitBook
On this page
  • Trader Liquidation
  • Liquidators
  • AMM Settlement
  1. Perpetual Contracts Guide

Liquidations

Last updated 1 year ago

Trader Liquidation

A position is partially liquidated when the Margin Rate drops below the corresponding perpetual contract maintenance margin rate (specified separately for each ).

Liquidators

Anyone can be a liquidator and request the AMM to liquidate a given trader. The AMM then either rejects the request if the trader margin is above the initial margin, or proceeds. The liquidation amount is determined so that the trader is brought back to the initial margin, if possible. Hence, this can result in a partial or a full liquidation of the position.

AMM Settlement

Similar to a trader, each perpetual has a margin account. The profit and loss for each perpetual are exchanged between the margin account and the liquidity pool. The AMM margin of each perpetual in a given liquidity pool is re-balanced with AMM/trader interactions (deposit, trade, withdrawal), so that the AMM margin resets to the initial margin level. For example, if the initial margin rate is 20%, and the position value decreased so that the margin balance stands at 15%, the funds are taken from the liquidity pool to re-establish a margin of 20%.

Certain events, as defined below, call for the liquidation of one or all perpetuals in the liquidity pool, which we term perpetual settlement. In case of perpetual settlement, all traders are closed out in the given perpetual. Traders with no outstanding position keep their posted collateral and are not affected. The liquidation price corresponds to the ’mark price’ which is an exponentially weighted moving average of the perpetual mid-price. After the pool liquidation, the liquidity pool is functional with the non-liquidated perpetuals in the pool. If there are not enough funds to settle all traders, the funds are distributed proportionally, that is, each trader receives their margin balance (at the mark price) scaled by the ratio of total capital over total trader margin. Where we define total capital as the sum of: (1) margin of the perpetual being liquidated, (2) the participation fund, (3) the default fund.

Perpetuals settlements are subject to the following rules illustrated in the Figure below. Trader gains are paid by the margin account of the perpetual. If the margin is not enough, the participation fund are used to pay the trader. If the margin balance of the AMM is negative, the perpetual is settled. If the default fund runs out of funds, all perpetuals of the liquidity pool are settled If a price oracle used for the given perpetual is terminated, the perpetual is settled.

contract
Default Waterfall. Profit and losses of the AMM above/below the perpetual margin account are shared between the participation and default funds. In case the participation funds are used up, the default fund is used as a last resort. If the default fund is not sufficient to pay the traders, the perpetual enters into settlement mode where all traders are closed out at mark price and traders share the loss proportionally. Settlement can enter earlier under different conditions, as outlined in the section.