Drift Protocol v2

โŒ˜K
๐Ÿ‘พWelcome to Drift Protocol
๐ŸงฎDrift DEX
๐Ÿ‘‹Getting Started
๐Ÿ“ˆPerpetual Futures
๐Ÿ“ŠSpot Margin Trading
๐ŸฆBorrow & Lend
๐Ÿ›๏ธStaking
๐Ÿ”ฌTechnical Explanations
๐Ÿ“Accounting and Settlement
โž—Borrow Interest Rate
๐Ÿ“œDelisting Process
โ›ฒDrift AMM
๐ŸƒJust-In-Time (JIT) Auctions
๐Ÿ“šKeepers & Decentralised Orderbook
โ˜ ๏ธLiquidators
๐Ÿ’งLiquidity Providers (LPs)
๐Ÿ“‹Protocol Guard Rails
๐Ÿ“Risks
๐Ÿ–ฅ๏ธDeveloper Resources
๐Ÿ“”Overview
โŒจ๏ธSDK Documentation
โŒจ๏ธTutorial: Bots
โš ๏ธTroubleshooting
๐Ÿ› ๏ธKeeper Bots
๐Ÿ› ๏ธTrading Bots
โŒจ๏ธHistorical Data (v1)
โŒจ๏ธAPI
๐Ÿ›ก๏ธSecurity
๐Ÿ›ก๏ธAudits
๐Ÿ›ก๏ธBug Bounty
โš–๏ธLegal and Regulations
๐Ÿ“Terms of Use
๐Ÿ“Disclaimer
๐Ÿ“Privacy Policy
๐Ÿ“Competition Terms and Conditions
๐Ÿ“šGlossary
Docs powered byย archbeeย 
8min

Accounting and Settlement

Within Drift Protocol, all token deposits are held in a global collateral vault. This is required for seamless cross-margin and borrow-lend. The only exception to this is the insurance fund vault residing outside.

Ensuring proper accounting across users requires a robust settlement mechanism. The protocol uses intermediate Pool Balances to facilitate transfers and ensure that claimed gains are required to come from settled offsetting losses.

High Level Architecture
High Level Architecture

Perpetual Market

An individual perpetual market has two pools:

A. P&L Pool: to accumulate funds from user's with losses for settlement to user's with profits B. Fee Pool: to accumulate a fraction of exchange fees for the Quote Spot Market's Revenue Pool

The P&L Pool receives the highest priority on claimed funds, in order to give user's the best possible experience. The default fraction of exchange fees for the Fee Pool is total_exchange_fee / 2 and this fraction is determined by: SHARE_OF_FEES_ALLOCATED_TO_CLEARING_HOUSE .

The Fee Pool will only get partially filled up by up to 1% of intermediate P&L settled from a user's losses and aggressively drawn down for the benefit of the P&L Pool otherwise.

Spot Market

An individual spot market has two pools:

A. Revenue Pool: to accumulate revenue across the protocol, denominated in this token B. Fee Pool: to pay fillers and settle portions to revenue pool

The Revenue Pool, can collect fees from:

  • Borrow interest
  • Liquidations
  • Perpetual Markets

and can pay out to

  • Insurance Fund Stakers
  • Perpetual Markets

(see details of these rules in Revenue Pool)

The Fee Pool collects exchange fees from swaps and uses them to pay out the Keeper Network (Keepers & Decentralised Orderbook). ๏ปฟ

Future Work

Currently, a Perpetuals Market can only pull from the Spot Market Revenue Pool and Insurance Fund for its quote currency.

  • In the future, it may be possible for a distressed associative perp market (BTC-PERP) to be able to pull funds from the associated spot market (BTC) revenue/insurance pool and immediately swap for USDC to top off its fee/P&L pool.
Updated 12 Dec 2022
Did this page help you?
Yes
No
UP NEXT
P&L Pool
Docs powered byย archbeeย 
TABLE OF CONTENTS
Perpetual Market
Spot Market
Future Work