Perpetual DEX Part 2: AMM-Based Perpetual DEXs
AMM-Based Perpetual DEXs
1. AMM-Perpetual DEX: Background
AMM is a price discovery mechanism that has developed uniquely in the crypto industry. It is a system in which the value of two or more assets is automatically determined by mixing them in a certain ratio when a trade occurs. While AMMs for spot like Uniswap are operated with actual tokens, in an AMM for futures, it is a virtual AMM (vAMM) that is used, based on the assumption that a futures contract has been traded in the AMM for the nominal amount, rather than the actual exchange of spot assets.
One advantage of AMM is that it is a system that automatically determines prices according to the equation x*y=K, so anyone, including retail users, can easily participate as a market maker, even if they are not professional traders. In addition, the cost of adding a new futures trading asset pair is the lowest among other models, which is advantageous for market expansion. For example, the orderbook model requires the availability of professional market makers to onboard new trading assets to the platform, and the Oracle model has the restriction of only being able to introduce new assets when there is sufficient volume and market depth of the underlying asset.
AMM is also a candidate for the endgame of decentralized derivative exchanges. This is because in the current situation where it is not possible to implement a fully decentralized orderbook due to the limitations of blockchain scalability, AMM is the only on-chain model that can discover prices on its own based on trades generated on the platform. Currently, the orderbook model uses an off-chain orderbook, and the Oracle model depends on external price data (e.g. Binance) rather than discovering prices on its own.
Therefore, AMM has the potential to lead the futures market as a transparent, on-chain Oracle that is created from transactions recorded transparently among decentralized network participants.
In the on-chain spot market, Uniswap, which uses AMM as its trading engine and has the highest trading volume, is already the most representative on-chain Oracle in use. And, as in the current TradiFi and CEX markets, the crypto market is already forming a trend in which futures prices lead spot prices due to high capital efficiency.
However, the on-chain futures market itself is not yet bootstrapped, and there is a pressing need to follow market prices rather than AMM discovering prices on its own due to the overall low liquidity and volume.
1.1. Task 1: Mark Price & Index Price
Therefore, currently, AMM perp DEXs display two prices: Index Price and Mark Price. Mark Price is the price actually traded on the platform by AMM, while Index Price is separately displayed by bringing in data from an Oracle that leads the current market price to display the price of the underlying asset. When there is a price difference between Mark and Index, funding costs are set so that Mark Price follows Index Price, which is intended to induce traders and arbitrageurs.
Currently, the market leaders that determine the market price with the highest volumes are futures markets on CEXs, and that price leads to the formation of the CEX spot price, which becomes the Oracle and flows into the on-chain.
CEX Futures -> CEX Spot -> Oracle -> AMM Perp DEX Index Price <> Mark Price
The current AMM perp has a very low volume, so the Mark Price must actively follow the Index. This is not free. One of the costs incurred is the funding payment, which must be paid to the arbitrageurs to follow the price.
In the case of an AMM-based futures trading engine, AMM itself directly takes on all trader and arbitrageurs positions as a counterparty. Essentially, AMM act as a House and take on the dealer position. This is technically where it differs significantly from the order book. The order book is a broker model where traders generally take on opposite positions with each other, with the exchange only taking on its own market making aside from that.
Therefore, since AMM directly takes on the counterparty for trader and arbitrageurs, the funding cost/profit due to open interest imbalances belongs to the protocol. And in the case of AMM, which must follow the current Index price, the funding is determined by mechanisms like incentives given to arbitrageurs, and is always a cost.
There are also cases where the protocol itself intervenes to adjust the x*y=K curve, but all of these costs fall under items that must be spent from the protocol’s treasury, fee fund, or insurance fund.
Of course, this can be thought of as a cost associated with initial bootstrapping. When the on-chain futures market come in the limelight and accommodates a large number of users, the volume increases and AMM leads the market price organically, resulting in the AMM’s Mark Price becoming the index itself. This can be seen as the most ideal outcome.
1.2. Task 2: K value
Another issue is the K value of virtual AMM. In the case of spot AMM like Uniswap, since actual spot pools are held and trades take place, there is no problem with the exact K value of spot depth being set. This is because traders and arbitrageurs automatically find the appropriate price according to the actual K value.
However, in the case of futures AMM, since actual assets do not move and only a nominal amount of virtual trades are assumed, only the balance is settled at the close of the contract. Therefore, virtual AMM is used and setting the virtual depth (virtual K) is the protocol’s responsibility.
If the K value is set too large, the depth will be excessively deep and the price will not move as much as it should, causing arbitrageurs to leave and someone (especially the protocol) will have to pay a large absolute value of the funding cost. On the other hand, if the K value is set too small, slippage will be high and users will leave. However, if the K value is set by benchmarking against other exchanges, it will not be able to be a market leader that determines the market price.
Therefore, a method of operating virtual AMM by adding real liquidity is being used. Although some capital efficiency must be sacrificed, the house risk that the exchange must bear is shared by receiving external real liquidity and also it can easily derives real K value. Of course, this additional cost is compensated for by the liquidity provider, so ultimately the economy of scale in terms of volume remains necessary.
Of course, whether AMM perp DEX can be adopted by the general public is still unknown. In particular, institutional investors may still prefer order books, and retail may prefer an oracle model that allows for trading at the oracle price as is.
But among the models, the AMM is widely used and are experiencing concentrated development in the DeFi industry as a whole and various use cases based on AMM are continuously being presented. Therefore, AMM perp DEXs can maximize the advantage of composability, which implies infinite growth potential as DeFi protocols.
In this article, we will focus on the Perpetual Protocol and Drift Protocol, which are representative AMM perp DEXs, and explain the trials and tribulations AMM has experienced so far and future challenges. These are trying to make AMM perp DEXs winners of the on-chain derivative exchange through different mechanisms, with the goal of leading market prices as an “endgame.”
2. AMM-Perpetual DEX: Business Model
The revenue of a perpetual DEX generally comes from trading fees. In the case of an AMM, the list of costs that must be incurred from this revenue is as follows:
(1) Expenditure for Mark-Index convergence
Currently, the mark price in AMM is supposed to follow the index price, so there is a cost incurred to converge the price.
For AMMs that use virtual liquidity for futures contracts, they take on the role of a dealer (house) that takes the opposite position for all traders and arbitrageurs, rather than a broker. Therefore, the AMM must bear the funding cost of the difference between the open interests of long and short positions. Currently, funding is always a cost that must be paid to arbitrageurs as the incentive.
There are also mechanisms that directly intervene in the market for each protocol to converge the Mark-Index, and this is also a cost.
The cost to revenue ratio for this issue follows an economy of scale that decreases as the number of market participants and trading volume increases, and ultimately converges to 0 when it becomes a market leader.
(2) Compensation for liquidity providers
While it is ideal to operate a fully virtual AMM, in reality, it is moving towards borrowing the power of external real liquidity supply due to issues with the cost of the virtual K value and following index price. Therefore, a portion or more of the trading fee revenue generated by the AMM must be given as an incentive to liquidity providers, and a cost similar to the COGS is incurred.
This cost varies depending on the value of liquidity on the on-chain market and the capital efficiency of the platform leveraging.
(3) Compensation for traders
Depending on the protocol, it may choose to reward users who use the exchange. This is not a requirement and is a cost for user bootstrapping or community rewards.
3. AMM-Perpetual DEX: Projects
3.1. Perpetual Protocol
Perpetual Protocol is a pioneer that launched a perp DEX with virtual AMM in December 2020.
3.1.1 Perpetual Protocol V1
The prototype, V1 used a fully virtual AMM with no actual liquidity and a fixed K value. It also clearly presents the challenges that a virtual AMM needs to solve, as mentioned at length in the introduction.
After its launch, Perpetual V1 encountered the problem as the price of ETH rose from $800 to $4,000 due to the disparity between the market depth (K) and volume. This led to a situation where the long and short balance ratio reached 95:5.
Orderbook based exchanges, which match long and short positions among traders, rely on a broker model, while AMM relies on a dealer model that takes the opposite position of all traders’ positions. Therefore, the counterparty to all open interests is the AMM, and the protocol had to bear all of the funding cost that had to be paid to the long position corresponding to 90 out of 95:5. However, if the funding cost is not given or set low, it leads to a dilemma where the long position leaves and the price of ETH returns to $800.
Perpetual V1, which judged this model to be unsustainable, embarked on a major model revision, and the current V2 was born in 2021.
3.1.2. Perpetual Protocol V2
V2 aims to provide more stable price discovery and lower protocol costs for the perp trading by sourcing actual liquidity for its AMM and basing the K value on this actual liquidity. It also aims to fully utilize the concentrated liquidity of Uniswap V3 without completely compromising the capital efficiency of the futures market by using the actual liquidity received. This is a good example of the benefits of composability.
In the past, the responsibility for AMM positions as the counterparty to traders and arbitrageurs was solely on the protocol (V1). Now, V2 works with external liquidity providers to perform the role of counterparty to traders and arbitrageurs.
Liquidity providers can participate in the virtual AMM curve of the protocol in the form of Concentrated Liquidity AMM by using leverage to adjust the range of liquidity provided on their held spot assets.
Initially, the foundation provided liquidity directly for bootstrapping LP positions, but as external liquidity has significantly flowed in, it is now possible to see a ratio of external liquidity that is close to 100%.
Therefore, a spot trading environment with leverage between traders and arbitrageurs and liquidity providers has been established, and Perpetual V2 can be seen as moving closer to a brokerage model.
It seems that the burden on the protocol for funding incentives that must be paid for Mark-Index divergence has been greatly reduced. However, all of this is thanks to external liquidity providers participating in AMM positions, and it seems that liquidity incentives that the protocol must pay to bring them in are not insignificant.
The incentive for LP positions is settled on a weekly basis and the large downward spikes in the graph above indicate a loss for the protocol. This indicates that liquidity is being secured without the economy of scale with protocol usage and trading fees.
From the perspective of liquidity providers, it would be advantageous to go directly to Uniswap V3, where there is currently higher volume, and offer the same position for higher fee rewards, so it seems that Perpetual must secure liquidity even at a loss. In addition, understanding of concentrated liquidity on Uniswap V3 has not yet been widely disseminated, and it is not easy to clearly understand or digest this position, so the entry barrier for liquidity provision is high.
However, the fact that concentrated liquidity was first introduced to a derivatives exchange is sufficient competitiveness in itself. The securement of market share in on-chain derivatives trading and the expansion of this market itself are the main goals, and Perpetual Protocol is expected to play a leading role in this industry.
3.2. Drift Protocol
Drift Protocol is one of the other AMM perp DEX that has been on a rough journey since it launched the mainnet on the Solana chain at the end of 2021, marking the beginning of the bear market.
3.2.1. Drift Protocol V1
Drift V1 was introduced with the Dynamic Virtual AMM (DAMM) solution to address the issues of the long/short ratio and funding cost, as well as the K value, which were the direct causes of the failure of Perpetual Protocol V1.
Drift V1 presents technical superiority through three functions:
(1) Re-Pegging
This function is for adjusting x and y in the equation x*y=K. It is a mechanism for rebuilding the AMM curve itself so that the current price is located at the center (50:50) of the curve. It aims to prevent slippage from increasing for the same trade as the curve moves away from the center of the AMM graph. In addition, as the curve is rebuilt with the Index price, it reduces the dependence on maintaining positions for arbitrageurs and minimizes the expenses of long-short imbalance and funding costs.
(2) Adjustable K
This function is for adjusting K in the equation x*y=K. It directly adjusts the virtual market depth. If K is reduced, the market depth decreases, and the impact on price increases, which is advantageous for arbitrageurs to induce Mark-Index convergence. On the other hand, if K is increased, the market depth increases, providing traders with a lower slippage and a better trading experience. Therefore, it aims to optimize the setting through an algorithm for the ideal market depth that minimizes slippage for traders while allowing arbitrageurs to adequately follow the Index price.
(3) Drift Decentralized Limit Orderbook
Drift does not implement a traditional order book where limit orders are listed in real-time (high computational power required) and matching occurs between traders. The decentralized order book implemented by Drift is similar to the way lending protocols like AAVE use network participants called Liquidators to execute the liquidation of collateral assets that meet certain conditions.
Drift introduces ‘Keepers’, permissionless network participants who execute limit orders on DAMM, to decentralize the operations for submitted limit orders on the on-chain. The Keeper network, which operates based on financial incentives, is a decentralized network that implements a unique order book model for the blockchain by executing valid orders on AMM, supporting limit trading.
Drift V1 attempted to overcome the precedent set by Perpetual V1 by utilizing the high TPS and fast block generation speed of Solana chain to optimize the x*y=K graph in real time through re-pegging and K value adjustment.
It launched its mainnet at the start of the 21-year bear market, but actively utilized the advantage of AMM, which can quickly add requested trading assets, and also introduced the requested limit order function to AMM, actively communicating and developing, and growing quickly without neglecting any aspect.
However, merely adjusting xy=K flexibly was not enough to solve the fundamental problem of virtual AMM, and the long-short imbalance and funding costs were still high. Additionally, re-pegging and adjusting K values are not free. Before achieving economies of scale, costs exceeded fee revenues, and the Drift insurance fund was used.
Therefore, the dream of maximizing capital efficiency through virtual liquidity-based futures trading, which DAMM aimed to achieve through the optimization mechanism of the virtual xy=K curve, still seemed far away.
Unfortunately, in May of 22, V1 collapsed unexpectedly due to a simple accounting problem with the USDC collateral rather than a problem with the core DAMM model.
While the $LUNA long position remains an unrealized loss, the $LUNA short position realized a large profit and withdrew USDC, causing accounting problems related to the depletion of the insurance fund. Unlike the traditional orderbook model, AMM is a dealer that directly takes the opposite position for all trader positions. However, it was unable to control the withdrawal from one-sided profit realization.
After that, Drift developed a more sophisticated model for another half year to solve the accounting problems and the final challenge of virtual AMM, the virtual K value and long-short imbalance problem, and launched the Drift Protocol V2 in November 22.
3.2.2 Drift Protocol V2
In addition to DAMM in V1, which equipped the re-pegging and K adjustment mechanism for optimized virtual AMM and introduced a decentralized orderbook, V2 has become even more complex.
Firstly, let’s look at all the mechanisms introduced by Drift V2 for the realization of virtual AMM.
- AMM Re-pegging (DAMM) — Succeed V1
- AMM K Adjustment (DAMM) — Succeed V1
- AMM Bid-Ask Spread (DAMM) — V2
- Just-In-Time Auction (External Liquidity) — V2
- LP Staking (External Liquidity) — V2
- Decentralized Orderbook(External Liquidity + DAMM) — Succeed V1 + JIT Auction
- Borrow & Lend (Capital Efficiency) — V2
Except for the Borrow & Lend market, all mechanisms are necessary for stable operation of an AMM-based perpetual DEX using external liquidity and DAMM. And the reason why so many mechanisms are needed is that Drift V2, unlike Perpetual V2, does not give up capital efficiency from virtual liquidity & virtual K value.
Like V1, which also intended to optimize virtual AMM, you can see the characteristics of the Drift Protocol, which approaches in a technocentric manner to complete a more optimized model in V2.
Below is a description of each mechanisms newly introduced in V2, which is too long to list, so let’s summarize first.
Drift V2 focuses on minimizing slippage by providing traders with abundant liquidity through the use of JIT auctions and LP staking from external liquidity. The Mark-Index divergence is solved through the spread. The long-short imbalance of the AMM is eliminated through the AMM’s direct participation in the JIT.
(1) AMM Bid-Ask Spread
This is part of the DAMM update. Drift V2 has introduced the Bid-Ask spread to allow for trades to be executed closer to the Oracle Price (Index Price). The parameters that determine this spread are diverse, including the implied volatility, the degree of long-short imbalance, the recent buying/selling pressure, and the Oracle price & reliability. As a result, it is expected that the spread will contribute to the minimization of the funding cost that the AMM must pay for the elimination of long-short imbalance and price convergence.
It is trying to introduce an optimized spread through an additional process that minimizes Mark-Index divergence, as it has been trying to optimize x*y=K curve and produce DAMM.
In other words, during times when the current trading volume is insufficient and the price of Oracle must be followed, the strategy is to adopt a hybrid model that not only uses an AMM, but also gives weight to the Oracle price. Of course, as the market leader in the future, if the AMM price leads the market price, the AMM:Oracle weight will automatically converge to 100:0, so it is not a complete abandonment of the perp DEX endgame.
(2) Just in Time (JIT) Auction
Before orders submitted to DAMM, a Dutch auction takes place for 5 seconds. An external market maker based on permissionless access intervenes to settle the submitted orders. The starting price of the Dutch auction begins at the DAMM Bid price (most advantageous to the taker), and as time passes, it converges to the DAMM market order price. Since the DAMM Bid price is the most disadvantageous for the maker, it is advantageous to settle later, but there is also a risk that another maker will take it first, so the Hunch game between makers is designed to be advantageous to the taker.
This provides the maker with a new window to take positions and provides the taker with the opportunity to receive settlements at prices more advantageous than AMM. In addition, the JIT auction is a venue where additional actual liquidity from external sources is introduced, which helps to maintain the stability of the protocol and AMM and provides opportunities for everyone to benefit.
The DAMM, which corresponds to the House, also participates in the JIT. Drift continues to rely on virtual liquidity for capital efficiency, which requires active long-short parity, and it maintains the balance through direct participants in the auctions.
(3) LP Staking
The DAMM V2 receives real liquidity from external sources. The position of the liquidity provider is equal to DAMM which is the counterparty for the traders. The position follows same delta and funding of DAMM, and is used for the settlement of new trader positions from the point after staking. Since the position of DAMM is also shared, the resulting transaction fees are also shared. It is easy to think of it as a house in a casino, sharing profits and losses.
This liquidity is responsible for real liquidity in the optimized K value that consists of virtual and real market depths.
(4) Borrow & Lend Market
A money market that allows you to deposit assets and lend them out, like AAVE, has appeared on Drift. The deposited assets can receive supply APY proportional to the usage (the amount borrowed by someone) and can be used as collateral for the cross margin of the perp trade.
However, taking the lesson from the Mango Market exploit incident that occurred in October 2022, the unrealized gain of the perp position cannot be used as collateral for a loan in Drift. Currently, only $USDC and $SOL are supported, but due to the nature of the leverage market being related, it is necessary to be very cautious about collateral risk when long tail assets are on board in the future.
With all of the above various technologies, Drift presents the slogan Liquidity Trifecta and appeals to traders that it will provide rich liquidity.
Traders’ orders are executed through (1) external liquidity from JIT, (2) liquidity waiting in the decentralized order book of Drift, and (3) optimized virtual liquidity from DAMM as a backdrop.
While the explanation was lengthy, Drift V2 has not yet fully launched and all features are not yet available.
It remains to be seen whether this optimization will provide the best trading experience for traders as a virtual AMM-based protocol and whether it can attract organic traffic through sufficient appeal to traders.
In addition, it is important to focus on data on the cost of maintaining optimization until a sufficient economic scale is reached (the trade-off between the cost of virtual liquidity and the reward of real liquidity, as well as maker incentives for JIT), and whether this cost can be sufficiently absorbed.
3.3. Others
3.3.1. Rage Trade
Rage Trade is a newly developed AMM perp DEX that maximizes the composability and promotes its “80–20 Vault” and “Recycled Liquidity” as features.
Like Perpetual Protocol V2, Rage Trade uses real liquidity to drive the AMM, but seems to have recognized that actively managing concentrated liquidity is too costly. Therefore it is exploring ways to incorporate more composability with Curve Finance, GMX, and Sushiswap, to allow for more passive LP position management.
Basically, Rage Trade calls up liquidity with LP tokens created in other protocols such as the Tri-Crypto LP token of Curve Finance and the GLP token of GMX. The term Recycled Liquidity is used to mean that these liquidity should not be used in one place only, but also used in Rage Trade. And 80% of the deposited LP tokens are used to create passive yield, while the remaining 20% is used as the counterparties for perp traders with concentrated liquidity in a UniSwap V3 style. This is the feature of 80–20 vault. If this LP position can achieve both passive nature and higher returns, Rage Trade can expect a tremendous inflow of liquidity.
As a new AMM that has emerged based on new technology, it is currently low in liquidity TVL and volume. Therefore, it is unknown whether it can handle sufficient scale and at the same time, whether sufficient incentives are in place to ensure liquidity.
However, given the introduction of a mechanism that can provide relatively stable and higher capital efficiency in the on-chain liquidity market by fully utilizing composability, Rage Trade suggests a new opportunity for sustainable profits.
3.3.2. SynFutures
In October 2021, SynFutures launched uniquely a traditional dated futures contract and is currently in the process of closed alpha for SynFutures V2, which includes perpetual futures. SynFutures receives supply of spot (Real) liquidity from LPs, but through the Synthetic AMM (sAMM) mechanism, spot liquidity is only received from one side of the AMM trading pair’s assets. That is, only a single asset is supplied as spot, and the opposite side’s asset is filled with virtual liquidity.
Both the multi-chain deployments such as Polygon, BSC, and Arbitrum and the permissionless trading assets on-boarding systems are good, but the challenge of ensuring sufficient liquidity is the same.
The roadmap for SynFutures V2 also includes the introduction of sAMM with concentrated liquidity, and as it enters the intensive competition phase among perpetual DEXs, more competitiveness beyond the user experience of single asset LP participation is necessary.
4. Lastly
There have been many trials and errors and developments from the early model that believed it was enough to simply use UniSwap’s AMM as a virtual curve to settle a futures contract.
AMM is the most advantageous price discovery model for establishing a permissionless market and securing a decentralization in an on-chain environment. Therefore, the future of AMM-based perp DEXs is expected to either (1) completely secure the market share in the industry based on compatibility or (2) even if it failed to occupy the markets of major assets due to other perp models, at least secure the market share of long-tail asset markets.
Although it is still necessary to acquire capital from centralized exchanges to achieve economies of scale, it is necessary to make every effort to prepare the AMM infrastructure until the usefulness of decentralized futures contracts is adopted by the market.