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
  • Liquidity Pool Structure
  • Liquidity Provision
  1. Perpetual Contracts Guide

Liquidity Pools & Liquidity Provision

Last updated 1 year ago

Liquidity Pool Structure

Each liquidity pool consists of one or several perpetuals that share the same collateral currency. Collateral currency is the currency in which the margin is held and payments are made (e.g., a BTCUSD and ETHBTC perpetual can both be collateralized in BTC and share a liquidity pool). The capital structure of a liquidity pool is illustrated in the figure below.

Each perpetual has a margin account like a regular trader, which we term "AMM margin". The AMM margin is the first capital tranche used in the system. For a regular trader, the initial margin determines the amount they have to deposit to initiate a trade. For the AMM, the initial margin acts as a "target margin". The target margin is obtained by exchanging funds between AMM margin and the liquidity pool. This process of balancing towards the initial margin is called rebalancing. Rebalancing occurs with every action that a participant can perform (such as trade, withdrawal, deposit).

Each liquidity pool consists of a a participation fund, out of which each perpetual is allocated a certain amount of funds, and a default fund, which is used to cover the losses of defaulting traders, as well as sharing in the PnL of the AMM, and there is a broker fund that contains the funds obtained from brokers purchasing the broker access. If the AMM margin is below the initial margin (a loss), capital is taken from the broker fund, and if used up, from the participation and default funds and added to the AMM margin of the perpetual that incurs the loss. Hence the broker fund serves as first tranche for AMM losses. If the AMM margin is above the initial margin (a profit), capital is sent to the participation fund and default fund.

A certain proportion of liquidity provision fund is allocated to each perpetual, termed "alloc" in the diagram above. This proportion is relevant for the risk-based pricing that the pricing engine applies to set the AMM price.

Liquidity Provision

Anyone can deposit into the participation fund in the collateral currency of its liquidity pool. Depositors are termed PnL participants, because they participate in profit and loss of the perpetuals and earn trading fees. PnL participants can add and withdraw funds.

When profit/loss is re-balanced between the AMM margin account and its connected liquidity pool, the profit/loss is shared between the participation and default funds proportionally to the respective sizes. E.g., 0.01 ETH of the inverse perpetual ETHUSD are sent to the liquidity pool, then the default fund receives/pays a share equal to max[a/(a + p), c], where a is the size of the default fund, and p the PnL participation fund size. The participation fund receives/pays min[p/(a + p), 1-c]. The cap c is a liquidity pool parameter typically set between 1% and 25%.

Capital Structure