Drift Protocol Series: (1) Drift, DAMM and DLOB-based Decentralized Derivatives Exchange

verse2
verse2
Published in
7 min readAug 23, 2022

1.Drift Protocol
1.1 Introduction
Drift is a Decentralized Derivatives Exchange first to introduce Dynamic AMM(DMM) and Decentralized Limit Order book (DLOB). Two features allow Drift to provide leverage products up to 20x. Furthermore, Drift plans to introduce various new products such as Synthetic spot position, Delta-hedged stable coin position, and Impairment Loss (IL) hedge. Drift takes a fee-based protocol model instead of issuing the native token.

Decentralized Derivative Exchange requires low cost, high transaction speed, and high scalability. Here, Drift chose Solana.

1.2 Investors of Drift
Drift raised $3.8 Million in their seed round, in August, 2021. Major investors include Multicoin Capital (lead), Alameda Research, Jump Capital, LedgerPrime, Not3Lau Capital (Darren & Dearyl Lau), QCP Capital, Robot Venture, and ROK Capital.

2.Drift Protocol Model
2.1 Mechanism Overview

  • When the Taker executes the transaction, one pays a ‘taker fee’ for received liquidity.
  • Maker provides the liquidity to the market and incentivized by Rebate
  • When the order is completed, each user’s position expires, and Liquidation the profit and losses (PnL)

- DAMM operates as a market stabilizer
- DLOB and liquidator bot support user trade
- Funding rates and K are adjusted to support Mark — Index Price
- DAMM’s Adjustment procedure operates based on fee pool
- Insurance Fund provides relief in case of loss

2.2 Drift feedback loop
Fees and Volume bring synergy to the Drift Feedback loop, contributing to the protocol growth. When the trader secures the liquidity, it leads to paying the trader fee. Then, the fees are redistributed to the Rebates / Position holders.

In short, the protocol aims to create a perpetual cycle by choosing a fee-based model instead of following a short-term reward.

2.3 DAMM (Dynamic AMM)

All Drift transactions are executed by Dynamic AMM (DAMM), the enhanced model of Perpetual Protocol’s vAMM. Drift also uses a primary mechanism from vAMM(Virtual AMM), but it is called DAMM since it is the first ‘adjustable’ vAMM to be introduced.

vAMM follows x * y = K formula, which forms a 2-dimensional curve. It represents the market price of x in relation to y. When it comes to DAMM, is set by multiplying the gradient of the curve and peg_multiplier(C). Since Minimum slippage occurs at the middle of the curve, the Drift Protocol induces liquidity to the center of the curve by adjusting peg_multiplier. This is called a Re-Pegging process.

Here is the formula:

mark_price = (quote_asset_reserve / base_asset_reserve) * peg_mutiplier

  • ‘Peg’: Exponent of the price (Price multiplier)
  • ‘K’: Constant representing the Liquidity depth. It is calculated by multiplying base_asset_reserve * base_asset_reserve
  • ‘Fee Pool’: Collection of the taker fee
  • ‘Traunchers’: Sets the distribution ratio of ‘Fee pool’.
    - Peg Adjustment (or ‘repeg’)
    - K adjustment
    - Funding payments (Capped)
UniSwap x * y = K mechanism (desmos.com/calculator/7wbvkts2jf?lang=ko)

Drift’s Dynamic AMM contains two core mechanisms: ‘Drift Cover’ and ‘Adaptable K.’ Both mechanisms stabilize the trading environment through trader fees from the protocol.

1) Drift Cover(Repegging the curve)
There is a ‘Price Drift’ problem in current AMM, a high appetite for the liquidity where the slippage is higher and, therefore, deviating from the base asset price. In other words, there is a gap between Oracle and Mark prices. DAMM’s Drift Cover functions to provide solutions to problems such as Price Drift.

Repegging is a pricing mechanism that modifies the base-set up the price to converge toward the Oracle Price by adjusting peg_multiplier. The mechanism is similar to the one from the Quote Asset reserve (ex. USDC Reserve in the SOl / USDC pool). peg_multipler is gradually adjusted toward the center of the curve point where Oracle-Mark spread decreases and slippage gets minimized. This naturally introduces users to trade around the center area. This mechanism is implemented in the code, making it even possible to trade at low slippage when a drastic change occurs from the mark price.

2) Adaptable K (K: coefficient multiplication, base_asset_reserve, * quote_asset_reserve)
Adjusting K is similar to making deposits and withdrawals from the regular AMM, and it is an adjusting mechanism for the assets inside the pool (base, quote Asset Reserve, simultaneously). DAMM is built on the Virtual AMM. As the name suggests, it is processed virtually instead of directly adjusting the value inside the pool. In other words, Damm manages the price sensitivity by setting K value through vAMM, which controls total liquidity. K is gradually modified when error bias exists and guides to reach the equilibrium.

Slippage decreases as K increases, and Mark-Exit Spread also decreases. For example, users pay half the amount of slippage if one doubles the sqrt(K). Here, one might want to maximize the set K value to minimize the slippage. Yet, a high K value drives out the arbitrageur, which increases the required liquidity for Oracle Price convergence. An insufficient amount of arbitrageurs creates the mismatch between long and short, leading to overpricing of the Funding Rate. This requires K to be set at equilibrium. As the trading environment grows in the long run, Drift Protocol aims to lower slippage by increasing K (reserve variable) monotonically from an appropriate value.

DAMM’s mechanism provides a stable trade ecosystem and expands volume. Adjusting optimal peg_multiplier and Adaptable K by utilizing earned fees is the backbone of the DAMM’s sustainable run cycle.

2.4 DLOB (Decentralized Limit Order Book)
DLOB(Decentralized Limit Order Book) is a limit order system using DAMM, and provides off-chain incentives to the “Keeper bot.” DLOB is designed with deep consideration for decentralization and computation efficiency. Similar to a liquidator bot, anyone can serve as a ‘Keeper.’ The computation efficiency is implemented using overfilling logic, an off-chain transaction, and switches to on-chain transactions when triggered. To summarize, Drift’s Limit Order system is a hybrid system merging the Off-chain Keeper and On-chain payment system.

  • 1) Trader submits on-chain limit order, and the program validates the submitted limit order
  • 2) Keeper bot organizes the limit order from the Drift Trader to an internal data structure
  • 3) After sorting limit orders by period and trade volume, the native order book is established
  • 4) When the set price is triggered in the DAMM, the keeper bot executes the order, and the user claims the reward

DAMM keeper executes the order and receives a set commission each from the limit order. The reward incentive structure, which prioritizes high volume and limit, fully operates for smooth operation.

The following describes the USDC reward for the current Keeper bot

fkeeper = Min (0.01 * max (1, torder )1/4, 0.1 * fuser )
t_ order = time spent after the order
f_usdr = taker fee, paid by the user

2.5 Insurance Fund
An insurance Fund exists to prevent unseen losses from the leverage activity. The insurance fund contains two pools: The collective pool and Each market pool. In situations where the counterparty exceeds the payment limit, it functions as a backstop to secure the stability of the protocol.

Insurance Fund repays the user’s loss from the leverage loss, and the fund comes from the portion of the liquidated amount and the share of protocol profit.

Drift protocol became one of the Solana-based Decentralized Derivative Exchange, reaching high trading volume, thanks to DAMM and DLOB. Yet, there are outstanding challenges, such as the Luna incident, which brought extreme price volatility. Here, Drift is preparing for the V2 release.

This article continues in Drift Protocol Series (2) Drift’s Model Mechanism and New Leap V2

This article is <Drift Protocol Series: (1) Drift, DAMM and DLOB-based Decentralized Derivatives Exchange> provided by verse2. Please see the list below if you want to read the entire series. We recommend you read the articles sequentially.

1. Drift Protocol Series: (1) Drift, DAMM and DLOB-based Decentralized Derivatives Exchange
2. Drift Protocol Series:(2) Drift’s Model Mechanism and New Leap V2

verse2 is a builder from the beginning. We contributed to various DeFi protocols and diverse ecosystems as an infrastructure builder (e.g., Layer 1, wallet, IDE, node validator, etc). More than 60% of the team is Product based. Making verse2 a specialist in developing Onchain Structured Products.

verse2 [Homepage | Twitter | Medium]

--

--

verse2
verse2
Editor for

Build, incubate, invest — Making all possible in the crypto. / verse2.io