Solana's insistence on order books: a lesson from Drift's predicament

  • Solana's preference for Central Limit Order Books (CLOB) is highlighted by the challenges faced in implementing perpetual contract AMM on-chain, as seen with Drift Protocol's struggles.
  • Drift v1's complexity stems from using vAMM (virtual AMM), which requires predefined rules to handle issues like counterparty imbalance, liquidity depth, and price deviations, leading to overly intricate parameter adjustments.
  • The protocol initially relied on three liquidity mechanisms: JIT auctions, limit order books, and AMM, but will abandon AMM entirely on August 7, shifting to centralized market makers due to unsustainable subsidies.

Key Problems with vAMM:

  1. Funding Rate Erosion: The protocol's insurance fund shorts volatility, making it vulnerable to arbitrage during extreme market swings.
  2. Price Anchoring Failure: Requires continuous subsidies to align futures prices with spot prices.
  3. Path Dependency: Higher price deviations increase maintenance costs exponentially.

Drift's Dynamic AMM (dAMM) Innovations:

  • Introduced configurable parameters (Peg, K, Fee Pool) to address price deviations and liquidity depth.
  • Peg adjusts contract prices to match spot prices, while K controls slippage and liquidity.
  • Fee Pool compensates for imbalances but faces linear income growth vs. exponential expenses during market volatility.

Conclusion:

  • vAMM's reliance on mathematical formulas fails to sustainably manage perpetual contracts, necessitating centralized market makers for counterparty matching.
  • Drift's shift underscores the need for a hybrid approach balancing decentralization and centralization in on-chain derivatives trading.
Summary

After studying Drift Protocol , I fully understand why Solana is obsessed with CLOB, or order book.

Because it is so difficult to implement perpetual contract AMM on the chain, so difficult that people give up and turn to centralized market makers.

Although the vAMM (virtual AMM) created by Perpetual Protocol solves the problem of adding leverage based on the spot AMM X * Y = K.

However, the lack of a centralized market maker means that the perpetual contract AMM must use predetermined numerical rules to solve problems such as counterparty (for example, all users are consistently long and no one is short), depth, and price deviation (the perpetual contract price deviates from the spot price).

This makes Drift v1 extremely complex in terms of adjustable parameters and their formulaic expressions.

It is so complicated that market conditions must be specified based on the deviation of contract prices, such as the Healthiest Market, the Unhealthy Marker, and so on, for a total of four situations. The long-short imbalance must be assessed, and whether user positions should be liquidated under this state must be specified, as well as the solution for adjusting the coefficient.

Are you already feeling overwhelmed by this? Compare this to the order book, and don't you think centralized systems seem quite appealing? Now you can understand a little bit of Solana's obsession with the order book.

Later, Drift launched the limit order function, but the experience is still somewhat different from the order book.

Currently, trading on Drift is supported by three liquidity mechanisms:

1) JIT auction, where market makers provide liquidity;

2) Limit order book, where market makers provide liquidity;

3) AMM. If no MM intervenes to provide liquidity, it will be provided by Drift’s AMM.

But after 0:00 UTC on August 7, Drift will abandon the AMM model and completely embrace centralized market makers.

vAMM will face the following core problems:

1) Funding rates continue to erode. The protocol's insurance fund is effectively shorting volatility—and will be slowly eroded by arbitrageurs during periods of extreme market volatility.

2) Unable to maintain price anchoring, requiring continuous subsidies to maintain consistency between futures prices and spot prices;

3) Path dependency problem: The further the price deviates, the higher the maintenance cost.

Even Perpetual Protocol, the originator of vAMM, is considering new directions. "Perp V2 will adopt a more proactive market-making strategy to avoid the funding rate leakage problem in the V1 model. The new version will integrate the functions of Uniswap V3. The team believes that the solution to decentralized perpetual contracts lies in the organic combination of CLOB and AMM models."

This shift essentially transforms the original vAMM, which relied on mathematical formulas for pricing, into a market maker that proactively quotes prices. This shifts the risk from the protocol to the market.

At present, the AMM model may only be applicable to spot trading. On-chain contract trading still needs to maintain a balance between decentralization and centralization.

Next, let's talk about vAMM, which is also the most difficult part. It will be a good helper for sleeping.

vAMM (virtual AMM)

Perpetual Protocol’s vAMM uses the same X * Y = K constant product formula as Uniswap.

For spot AMMs such as Uniswap, users trade directly based on LP, and the price ratio of LP assets reflects the spot price.

The vAMM is actually a two-tiered structure: LPs are collateralized, and the real assets are stored in a smart contract vault. The vAMM is essentially a price discovery mechanism after users open leverage.

For example,

1/ Assuming the current price of ETH is 4000 USDT, the vAMM pool initially contains 100 ETH and 400,000 USDT.

2/ Alice uses 100 U as margin and goes long on ETH with 10x leverage.

1) Alice deposits 1000 U into the smart contract as a security deposit.

2) Perpetual Protocol credits 10,000 U (100 U × 10x leverage) to vAMM, which calculates Alice’s ETH based on the constant product formula X * Y = K.

Initial state X * Y = K 100 ETH * 400,000 U = 40,000,000

After Alice deposits 1000 U, it becomes 410,000 U. X = K / Y 40,000,000 / 410,000 = 97.5609 ETH

Alice actually receives approximately 2.44 ETH.

At this time, the status in vAMM is updated to 97.5609 ETH and 410,000 U.

3/ Bob then uses 1000 U as margin and shorts ETH with 10x leverage.

1) Bob deposits 1,000 U into the same contract. Perpetual Protocol credits -10,000 vDAI to the vAMM, which calculates the size of Bob’s short position based on the constant product formula X * Y = K.

Bob shorted 2.4391 ETH, and the status in the vAMM returned to 100 ETH and 400,000 U.

The pricing mechanism also adopts a funding rate mechanism, similar to the funding payments of CEX perpetual contracts.

The specific formula uses the FTX exchange:

There is actually a point here that is very, very, very important for understanding the difference between vAMM and traditional CEX contracts.

On a CEX, every long position has a corresponding short position, meaning there's a real counterparty, so users holding positions pay funding fees. The exchange is merely a trading venue and doesn't bear any of the position risk. In a vAMM, the situation is completely different.

As you can see, vAMM uses X * Y = K to set prices, and assets are pledged as margin to the contract. So, in essence, trading is based on the price curve, not the actual counterparty.

Therefore, once faced with an imbalance between long and short positions, the protocol needs to find a way to attract real counterparties, and the way to attract them is subsidies.

This makes the stability of subsidy sources and funding pools extremely important, as they are crucial to the survival of the project.

Especially in a one-sided market or when prices fluctuate violently, the fund pool is equivalent to shorting volatility. The characteristic of shorting volatility is that it can generate small profits in normal times but large losses during periods of volatility.

Drift innovated on Perpetual Protocol's vAMM and launched dAMM (dynamic AMM). Its difference is that its parameters can be configured to address issues such as price deviations from the underlying asset, asymmetric long and short positions, and depth. However, some issues remain unresolved.

Drift AMM

Drift uses a dynamic AMM, based on Perpetual Protocol’s innovative virtual AMM (vAMM) improvements, but with the following configurable parameters:

  • Peg: Price multiplier. This controls the deviation between the contract price and the spot price, almost through hard control, to keep the contract price anchored to the spot price.

  • K: Controls liquidity depth. A larger K value indicates better liquidity and less slippage. The same applies vice versa. When the contract price deviates significantly from the spot price, lowering the K value can help induce price fluctuations and bring the contract price closer to the spot price.

  • Fee Pool: Income is mainly used to adjust Peg and K.

In the four cases of deviation between the oracle price (contract price) and the mark price (spot price), we have the following table:

1/ Peg (anchor multiplier)

When the vAMM contract price deviates from the market spot price, it is used to quickly adjust the price so that the underlying price is close to the real market price.

formula:

Price = ( Y / X ) * Peg

Price = (Underlying Asset / Denomination Asset) * Peg Multiplier

Adjustment plan

After each transaction, the oracle-marked price deviation is checked. If the deviation exceeds the LIQ_LIMIT value (currently 10%), there are two options:

1) If the fee pool reserves are sufficient, the PEG is adjusted directly to re-anchor the price;

2) If the fee pool is insufficient, two costs will be compared:

Rate subsidies, the cost of attracting arbitrage, and the cost of direct re-anchoring.

Normally, one would consider lowering the K value first to reduce the liquidity depth and make it easier to push prices.

After the adjustment, the positions of the losing party will be actually calculated as losses, while the positions of the profitable party will be supplemented by the fee pool.

2/ k (liquidity depth)

Controlling slippage is easy to understand, as X * Y = K. A larger K value means more assets X and Y. Naturally, a larger K value means smaller slippage.

Of course, because Drift is a vAMM based on the Perpetual Protocol, where X * Y = K serves as pricing after leverage and is not a real LP asset, the K value can be adjusted.

In summary,

The k value controls the price sensitivity to trading volume;

The absolute level of Peg-adjusted prices

3/ Fee Pool

It is not only a source of income, but also a market adjustment tool. Purpose: After adjusting the Peg value and K value, it is necessary to compensate for the profits of profitable traders and to offset the imbalance of funding rates.

The main source of income for the fee pool is

1) Taker fee, basic rate 0.05-0.1%;

2) Liquidation fees: 50% goes to the fee pool;

3) Funding rate income.

At this point, we can see that this model is highly dependent on the health of the fee pool. This will cause Drift to lose its advantage in terms of transaction fees, for one thing.

Another more fundamental problem is that income growth is linear, trading volume * transaction fees = income, but expenses may become exponential as the market moves unilaterally, price deviation squared * position size * time = expenses.

So from a longer-term perspective, expenditures cannot fully cover income.

This is also the reason why Drift abandoned vAMM and embraced centralized market making.

In summary

In the vAMM model, users trading perpetual contracts must deposit a margin to cover potential liquidations. The X * Y = K formula effectively becomes the pricing curve.

Based on this formula, Drift modified its pricing method, adding a PEG anchor multiplier and making the K value adjustable to keep the contract price anchored to the spot price. During this adjustment process, any profit on user positions is replenished from the fee pool.

Therefore, this makes the fee pool extremely important, but in the long run, under extreme market conditions, expenses will grow exponentially, while income can only grow linearly, resulting in the protocol net subsidizing unbalanced positions.

Simply controlling the on-chain AMM through mathematical formulas does not work at the moment. Centralized market makers are still needed to match and balance the counterparties. This is the essence of perpetual contracts.

Share to:

Author: 戈多Godot

This article represents the views of PANews columnist and does not represent PANews' position or legal liability.

The article and opinions do not constitute investment advice

Image source: 戈多Godot. Please contact the author for removal if there is infringement.

Follow PANews official accounts, navigate bull and bear markets together
App内阅读