Evolution of Perpetual Trading: Drift Protocol

As the DeFi ecosystem continue to mature, the derivatives market is one standout category that has seen tremendous growth in recent times. As of the writing, the current TVL for DeFi derivatives market is $3.33b. The most popular financial product in the derivatives space is undoubtedly the perpetual swap contracts (perps) which was popularized by 2016 by BitMex. This is likely because of the few reasons outlined below

· Perps pricing is close to spot which make it easier and intuitive for traders to manage positions

· Traders are able to use leverage and trade on margin

· There is no need to own the underlying asset — any profits and losses will be settled in USDC

· Unlike futures contracts, perps have no expiry date

Most decentralized exchanges either utilize a Central Limit Order Book (CLOB) system where market makers provide liquidity at various price levels and takers will trade in these order books to establish positions or an Automated Market Maker (AMM) system where liquidity is pooled together and relies on a mathematical formula (x*y=k) to price assets.

Problem with AMMs for Perps

The main problem for traditional spot AMMs is that it is incompatible with the use of leverage as well as shorting. There are ways around it, for instance getting liquidity providers to provide more tokens in the pool so that traders can borrow assets at the leverage they want. However, the shortcomings of this approach are that liquidity providers suffer from high impermanent loss and poor capital inefficiency.


In order to address the above issues, Perpetual Protocol was the first to introduce the use of virtual AMMs (vAMMs). Perpetual Protocol’s vAMM uses the same x*y=k constant product formula as Uniswap. As the “virtual” part of vAMM implies, there is no real asset pool (k) stored inside the vAMM itself. Instead, the real asset is stored in a smart contract vault that manages all of the collateral backing the vAMM. Since the liquidity is virtual, k is adjustable. This malleable aspect is crucial as a low value result in high slippage and a high value makes it difficult for the perp to be priced closely with spot. In contrast to traditional AMMs, Perpetual Protocol uses a vAMM as a price discovery, but not for spot trading.

Another benefit is that due to path independence, there is no need for liquidity providers and trades can be settled directly via collateralized assets such as USDC. Finally the vAMM model ensures capital efficiency and prevention of impermanent loss since there is no need for liquidity providers in the first place.

Read more about the role of arbitrageurs in vAMMs here.

Problems with vAMMs

As compared to the CLOB model where the number of longs and shorts must be equal, there is no such requirement on the vAMM model which resulted in a persistent problem of long-short imbalance. While funding rates are usually paid to each other by longs and shorts, the insurance fund usually has to pay the difference in the vAMM model. This problem was evident in Perpetual Protocol V1.

“In our case for Perpetual Protocol v1, the equilibrium state of the system turned out to be one where traders could easily earn funding just by holding longs in a bull market. Since launch, our v1 took in over 38m USDC in fees, 100% of which goes to the insurance fund. But the insurance fund balance is just a bit over 9m and that includes the initial seed (100k) and an emergency injection (1m+). The rest of the funds were mostly paid out as funding payments, and a small portion was paid out to cover bad debt during market crashes.” — Perpetual Protocol Team

Read more about the problems with the vAMM model here.

Drift Protocol’s DAMM

Drift protocol is an on-chain decentralized futures exchange based on Dynamic AMM built on Solana. Drift’s dynamic virtual AMM (DAMM) aims to resolve issues mentioned above but at the same time retain desirable issues regarding the vAMM model. The DAMM has two key features: (1) curve-repegging; and (2) k-adaptability. Both mechanisms use protocol fees collected from trading to ensure the funding rate is kept at a minimal. Since then, funding rates have been kept stable and low, often comparable to centralized exchanges.

Curve Repegging

Think of repegging as altering the quote asset’s reserves. Drift Cover (a repegging mechanism) solves the long-term price drift problem. A repeg event reduces the oracle-mark spread and rewards market participants with additional liquidity at a more accurate mark price. Additionally, trading stays closer to the center of the curve where liquidity is focused. Drift achieves this by programmatically adjusting the peg multiplier towards the oracle price.

Initially, the admin will run repegs to benefit healthy market conditions. This includes ensuring a low average oracle-mark spread and a diverse open interest. The catch for repegging is that the market doesn’t want to deplete the fee’s collected on price changes that may soon revert. Preliminary analyses indicate >10% mark-peg divergence and persistently large funding rates are a good inflection point to consider a repeg event.

Adaptable K

Thinking adjusting k as scaling both the base and quote asset reserves in tandem. Their goal is to monotonically increase k (reserve invariant) over time as the platform and OI grows. K is bound by the fees collected. A high appetite for arbitraging volume per oracle price movement encourages us to support a higher k. In return, this provides lower slippage for Traders.

At this stage, the Drift core team manages the liquidity of the vAMM formulaically. Adding too much liquidity to the pool poses a problem for arbitrageurs as they won’t have enough capital to keep the vAMM price in line with the underlying index price via funding payments. Drift believes the game theory of trading DAMMs comes from backward induction on the terminal price. The goal of repegging / adjusting k is to keep the terminal price, mark price, and oracle price close to each other — regardless of the length of time the market has been initialized for. Ultimately, when spot and oracle price is close to each other, funding rates will be kept low.

Drift Protocol’s DLOB

The other issue that the vAMM model faced is the inability to offer limit orders as opposed to CLOB model. Drift wanted to design a limit order system that was crypto-native, scalable and married the best of the DAMM’s guaranteed liquidity and adaptable slippage with the flexibility of limit orders.

The answer was their Decentralized Limit Orderbook (DLOB)

Prioritizing decentralization and computational efficiency, the DLOB is a hybrid system that allows limit orders to be placed against the DAMM. Limit orders are facilitated by Keepers on the network. Keepers are off-chain bots that function in a similar manner as liquidators. You can think of DLOB limit orders as taker orders that are queued to be filled against the DAMM once certain conditions are met. Keepers play the role of compensated agents that facilitate this process.

Potential Issues

While DAMM is designed as a step-up from vAMM to make sure that mark-oracle price divergence is never too wide, periods of high volatility may still prove to be challenging. For instance, the LUNA crash in May 2022 led to overwhelming imbalance of short positions in the market and arbitrageurs might not be able to come in quickly enough to narrow the pricing difference between DAMM and the underlying LUNA price. In such a black swan event of an asset going close to zero, the strategies of adaptable k and curve repegging might not be sufficient to stabilize prices.

Another stumbling block could be outages on Solana network. Trading derivatives is a time sensitive endeavor that requires blazingly fast execution which could normally be met by Solana. However, in the few occasions that the network suffers a hiccup, this could severely affect trading activity and morale. That being said, this is not a problem exclusive to Drift Protocol as there are other decentralized exchanges on-chain as well.

Drift Protocol V2

With Drift Protocol V2, there are a number of important changes to improve the stability and reliability of Drift. To increase collaterals for positions, there will be options to provide passive liquidity. Formulaic parameters, dynamic fees and dynamic leverage based on market health will help to reduce the long-short imbalance. An advanced product curve with bids and asks, instead of the constant product curve (xy=k), will be used to dampen vAMM impact.

To increase liquidity, V2 pioneered a new system called Just-in-time (JIT) liquidity which essentially provides an opportunity for makers to step in and fill taker orders before the order is filled against the DAMM.

To further alleviate the long-short imbalance, V2 will adjust the peg of the curve based on the oracle price (the live price) and adjust base market spreads based on volatility, inventory skew, recent buy/sell pressure and oracle price/confidence. As a result, agents (such as arbitrageurs or passive liquidity providers) would be incentivized to continue balancing out the net position to collect funding. This should keep funding rates tightly in line with the actual positioning of the market

In case of malfunction, isolated circuit breakers in the form of pausing withdrawals or closing and settling individual markets or circuit breakers using price bands during extreme volatility will ensure that the entire protocol doesn’t need to be shut down and only the offending markets will be halted. During an Insurance Fund deficit, socialized losses may be implemented where the losses are either spread equally to all users in system or market, or equally to the winners in market, or spreading the loss to winners by automatically deleveraging them through the Auto-Deleveraging mechanism (ADL)

Read here for full updates on Drift V2.

Concluding Thoughts

On the whole, Drift Protocol’s implementation of DAMM and their DLOB have made perpetual trading a streamlined process for users who are looking to trade on decentralized platforms. We believe that future proposed improvements proposed in Drift Protocol V2 will further improve the user experience and attract the next million traders in DeFi.

Written By Mustafa Yilham & Jermaine Wong



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store