Beyond CEX: A Brief Analysis of the Transformation Potential and Opportunities of DEX

Recommended Reading
2023-09-02 09:18:12
Collection
A good solution will make DEX more attractive: pricing through oracle, slower batching and post-trade settlement, centralized and automated liquidity, and cheaper block space on L2.

Original Title: 《The next steps in DEX design

Written by: Yellow Propeller

Compiled by: Yvonne, MarsBit

tldr ;

Smart contract chains are well-suited for operating exchanges: they commoditize trust, making custody, fees, prices, and settlements equally transparent for everyone, and allow anyone to become a market maker.

However, DEXs still lag behind CEXs in trading volume due to: uncompetitive prices; execution prone to abuse (MEV); and insufficient profits for LPs.

Nevertheless, good solutions do exist and will make DEXs more attractive: through oracle pricing; slower batching and post-trade settlement; centralized and automated liquidity; and cheaper block space on L2.

Introduction

Decentralized exchanges are one of the main use cases for smart contract blockchains. They are often criticized as garbage coin casinos, but this permissionless mechanism for creating markets for any asset has substantial value, whether it leads to speculation or more productive activities.

The current cryptocurrency exchange landscape consists of OTC trading, CLOBs (Central Limit Order Books), RFQs (Request for Quotes), and AMMs (Automated Market Makers).

AMMs are particularly useful in currency pair markets where there is insufficient demand from professional market makers, but CLOBs remain the preferred venue for high-demand currency pair trading (according to Defillama, DEX trading volume accounts for only about 16% of CEX, most of which is still driven by CEX-DEX arbitrage).

DEXs still account for only about 15% of cryptocurrency trading volume, but their share is growing. Source: Coingecko Q1 2023 Industry Report

In this article, we clearly define what characteristics a good exchange should have, focus on the current shortcomings of DEXs, and propose some paths to improve DEX design.

What Should a Quality Exchange Have?

As a trader, I need:

  • Trust: The custody risk before, during, and after my trades should be transparent and minimized as much as possible.
  • Best Price: I want to get the best price on that exchange every time, or close enough to the best price—so I don’t have to worry about finding a better price elsewhere.
  • Fairness: I don’t want my orders to be abused. Without sufficient reason, others should not get better prices or pay lower fees than I do.
  • Speed and Availability: Waiting for trades to complete or for the exchange to open is not fun.
  • Information: The exchange helps me make informed choices and monitor my orders. I can see the price at which my trade might settle and get good limit and slippage suggestions. I can also view unexecuted, settled, or canceled orders.

Strong liquidity and a wide range of assets: Seeing more asset pairs with liquidity gives me more confidence in getting good prices on that exchange.

Liquidity providers and market makers (MMs) care about:

Profit: Profits that can offset capital risk and opportunity cost.

For MMs, the most important thing is the best risk-adjusted return; other metrics are merely means to achieve this. High trading volume, low or poor competition, high spreads, good rebates, minimal bad liquidity, last checks, speed bumps, and lower custody risk—all contribute to improving risk-adjusted returns.

Blockchains are an excellent place to operate exchanges and provide traders and market makers with most of the elements they desire: decentralization, open-source settlement mechanisms, and public trading histories, which are a solid foundation for trust, security, transparency, and fairness.

But decentralized exchanges still face challenges:

  • Providing reliable competitive prices;
  • Offering good returns for LPs;
  • Addressing MEV that violates fair execution commitments.

Among the top 10 DEXs, 9 are AMMs. So let’s take a look at the advantages and disadvantages of AMMs.

Why Are AMMs So Popular?

You often hear: "Tradfi knows best, order books are more efficient, constant function market makers will never work."

So why do AMMs—especially constant function market makers (CFMMs)—still dominate DeFi (accounting for over 95% of all DEX trading volume)? They must be doing something right.

Here are the most important reasons AMMs have maintained their lead so far:

  • Low liquidity requirements: AMMs (Univ2 style) always provide prices, even with low liquidity.
  • Passive liquidity: Your liquidity is managed by the AMM. Therefore, LPs find it easy, and anyone, not just market makers, can earn fees.
  • Simplicity: AMMs require less computation and storage than order exchanges, so they consume less gas.
  • No gatekeepers: Market maker and exchange listing fees can be prohibitively high, while centralized exchanges can delist tokens at any time. AMMs allow any project to easily list and provide or incentivize liquidity themselves.

DEX trading volume only saw a significant rebound by the end of 2020 (two years after Uniswap's launch). Source: Dune

When the first decentralized exchange launched, there was almost no liquidity, few market makers, very little trading, and high gas costs. Operating a CLOB under these conditions was impossible, so AMMs were very suitable. They are quite straightforward, making them easier to build, simulate, and audit.

But now, DeFi looks different. Order volumes are rebounding, the range of assets quoted by professional market makers is broad, L2 gas is cheaper, and everyone knows the weaknesses of CFMMs (i.e., today’s majority of AMMs).

AMMs are still the best choice for certain markets (like long-tail currencies). But they lag behind centralized exchanges in key areas.

Problems with AMMs

High Gas Fees

On-chain trading is still expensive. AMM pool fees (0.01 - 0.3%) are comparable to CEX spreads, but gas fees on small trades (< $1000) can easily cost you 1-10% of your funds, even on L2.

Outdated Prices

AMMs often do not give you the best price. The prices of AMMs only move with trades. So you need to rely on arbitrage traders to ensure that AMM prices stay in sync with current market prices. However, aside from holding risks, arbitrage traders are also limited by pool fees and gas. Therefore, AMM pools with lower liquidity can easily deviate from the best quotes on other exchanges by 1-5%.

Losses and Rebalancing (LVR)

In subsequent analyses, Uniswap LPs have been shown to be unprofitable due to LVR from toxic order flow.

AMMs are passive, so if the price of an asset is determined on another platform (like Binance), the price on the AMM will always lag behind. If the price rises (on Binance),

then the AMM will sell tokens to arbitrageurs at a very low price. If the price falls, the AMM will buy tokens from arbitrageurs at too high a price.

Over time, AMMs, especially their LPs, will continue to accumulate losses. This is the cost LPs pay to arbitrageurs to push prices back to market prices.

In contrast, on a limit order book, active market makers will immediately adjust their quotes when prices change and then rebalance their portfolios at market prices.

A tweet from Ankit explains LVR well.

LVR is permanent: Unlike impermanent loss or holding loss, LVR losses do not recover when prices return to previous levels.

LVR increases with volatility: The larger the price increase, the greater the LP's loss. In fact, losses are quadratically related to volatility.

LVR depends on the location of the discovery price: It is important how much worse the price you sell to arbitrageurs is compared to the current weighted average market price.

Because you, as an LP, earn fees on every trade, if your liquidity pool has a sufficiently large weight in the market, this works in your favor. As long as LVR < fees, these trades will actually make you profit rather than loss. Pools with smaller market weights will experience higher LVR, and they will tend to pay the profits of larger pool LPs.

Extractable Value (MEV)

Traders and LPs are easily affected by AMM value extraction:

  • Traders: Searchers can front-run, sandwich, or hinder your trades and affect your execution price.
  • Passive LPs: More sophisticated and proactive LPs can provide timely liquidity to capture most of your trading fees.

Fragmented Liquidity

On CFMMs, the same token is often paired with multiple different tokens (e.g., USDC-WBTC, DAI-WBTC, ETH-WBTC), and even the same pair of tokens can have multiple fee tiers. This fragments liquidity (in this case, WBTC) across multiple pools, resulting in lower fees for LPs, shallower depth for traders, and worse prices. Much of the liquidity is not used for trading (e.g., in Univ2 design), and even on range order AMMs, prices often stray far from the concentrated liquidity range.

In centralized exchanges, there is usually only one quote asset (e.g., USD), and market makers actively keep most liquidity around the current market price. This leads to fewer liquidity pools, deeper order books, better returns for market makers, and deeper and less price-impacting trades for traders.

Further Issues

The aforementioned drawbacks also lead to more disadvantages for CFMMs:

  • Prices and inclusion uncertainty: Trades often fail or have intentional or accidental front-running.
  • Fixed spreads: Automated trading markets charge a fixed spread on orders. This makes them vulnerable in highly volatile markets and less competitive in less volatile markets.
  • Difficulty attracting liquidity: Losses and rebalancing, along with fragmented liquidity, make LPing on AMMs less profitable and attract liquidity more difficult. Therefore, protocols often need to subsidize LPs through liquidity mining incentives to attract sufficient liquidity.
  • Fragmented liquidity: On DEXs, a token often has multiple trading pairs, and even the same trading pair can have multiple fee tiers. Much of the liquidity is not used for trading (e.g., in Univ2 design), and even on range order AMMs, prices often stray from the concentrated liquidity range. This leads to lower fees for LPs, shallower trading depth for traders, and worse prices.

But this does not mean AMMs are doomed to fail. Research and blockchain technology have made significant progress and enabled new building blocks that can address these flaws.

Building Better On-Chain Trading Modules

Several methods are currently attempting to solve issues like poor pricing, MEV, losses and rebalancing, and liquidity fragmentation in DEXs. Let’s summarize the most important methods and propose some new ones.

Addressing High Gas Fees

Cheaper Block Space

L2 transaction costs are one to two orders of magnitude cheaper than L1. Therefore, transaction costs are no longer a bottleneck. This means that more computation-intensive protocol designs (like order books) are starting to become possible. However, to compete with CEXs on small trades, gas costs may need to be reduced by another order of magnitude.

Cows

An example of a demand-matching (CoW) trade among three traders. Everyone makes the exchange they want, providing liquidity for each other—without routing through a DEX or paying DEX fees.

Demand Consistency (CoWs) is essentially a P2P asset exchange between traders of complementary pairs trading simultaneously. Traders do not need to pay AMM trading fees and incur less gas (just transfers). However, to make them work, you need excellent oracles for current best bids and asks.

Off-Chain Computation, On-Chain Verification

If you put the computation-intensive parts off-chain, only using the chain for custody, settlement, and verification, then more complex functionalities become possible. For example, tracking and matching limit orders off-chain while holding funds and settling trades on-chain.

Improving Price Timeliness

RFQ

With RFQ, you can buy directly from market makers. Since market makers can trade in all venues (off-chain and on other chains), you can access prices and liquidity from those venues through them, even if you are only on one chain. RFQ orders are also more efficient (just a transfer and signature verification, rather than routing through pools).

Instant Liquidity

To compensate for the risks of toxic order flow, market makers' quotes on exchanges are not as tight and deep; in fact, ordinary users pay market makers to subsidize toxic order flow.

However, if you reverse this and allow market makers to set prices after users submit trades, then market makers can quote better prices because they bear less risk. This provides ordinary users with better prices and makes life harder for arbitrageurs.

Lower DEX Fees

One reason for high fees is to protect LPs from LVR. However, if a DEX can protect itself from LVR (see below), then it can also set lower fees. Lower fees bring pools closer to arbitrage with other pools.

One way to keep prices up-to-date and prevent unprofitable arbitrage is to use Oracles to set prices.

Fixing LVR

Oracle-Based Pricing

As long as AMMs passively set prices, they may be vulnerable to toxic order flow. One way to avoid this situation is to actively update the prices on AMMs before arbitrage traders enter.

Oracles need to be fast and accurate enough to avoid leaving arbitrage opportunities. When the cost of trading < the price difference between market prices, arbitrage is unprofitable. Therefore, to avoid toxic order flow, the accuracy of oracle prices needs to be less than the trading fees of AMMs.

AMMs can even set prices after users sign trades. This further protects LPs from providing outdated prices—thereby avoiding arbitrage risks.

Incentivized Delays

If AMMs can distinguish between informed (potentially very profitable) and uninformed (averagely profitable) order flows and only retain uninformed order flows, many issues will be resolved.

Dynamic fees and trade delays can help AMMs distinguish toxic orders from retail orders.

Trading signals decay quickly, so long-term negative delays from oracles will make it harder for informed traders to capture them unprepared on AMMs.

Slow settlement speeds, cheap prices: If you can wait 5 minutes to settle your trade, then the trade is cheap (e.g., 0.1% fee). Trades will settle at the oracle price within 5 minutes. Uninformed traders won’t mind this option because they save on fees, and the cost of waiting 5 minutes is low.

Fast settlement is costly: Settling at the current oracle price is expensive (e.g., 0.4%). Higher fees reduce the signal advantage of informed traders to the point that AMMs become unprofitable. Moreover, this still provides a fast settlement option for users willing to pay for it.

Delays allow exchanges to separate toxic and non-toxic order flows, or exchanges can completely prohibit fast settlements. To effectively block toxic order flows, fast settlement fees must take into account the market volatility of the currency pair.

Active Liquidity Management

Concentrated liquidity positions (Uni v3) allow LPs to direct their liquidity to specific price ranges. This enables LPs or third parties to maintain liquidity around the current market price and significantly improve LP capital efficiency.

Active liquidity management can even protect LPs from partial LVR.

With reliable oracles, AMMs can even set liquidity around the current oracle price themselves, thus eliminating the need for active LP management.

Dynamic Slippage and Volatility Oracles

Since AMM losses depend on the size of the signal advantage of arbitrageurs, toxic order flows are more likely to occur in more volatile currency pairs. In traditional order books, when the market is more volatile, market makers increase their spreads. AMMs can do the same and dynamically adjust their fees based on current market volatility.

Uniswap v3 already has a rough version that provides different fee tiers for the same pair of cryptocurrencies and allows LPs to choose the fee tier that suits the price volatility of that currency pair.

Market makers also adjust slippage to rebalance their positions to meet their targets—AMMs can take similar measures for their LPs.

Anti-MEV

Privacy Submissions

Bypassing public mempools with private RPCs is an effective way to protect trades from front-running and sandwich attacks.

Batch Auctions

Batch auctions are an excellent way to ensure fair pricing: you batch orders over a period, and all trades for the same pair are executed at the same price. This reduces the likelihood of your trades being front-run or sandwiched. Batch auctions also introduce a delay to block toxic order flows. Like negative delay oracles, batch auctions have poorer composability.

They also greatly improve trade pricing, available liquidity, and paths. This essentially eliminates the opportunity for backflows.

Dynamic Slippage Tolerance

Setting slippage is not easy. If the price of the trading pair fluctuates, too small a slippage can cause your trade to fail, while too large a slippage can make you vulnerable to sandwich attacks. Therefore, to avoid trade failures, exchanges often set a higher default slippage tolerance.

However, with volatility and depth predictions, DEX UIs can do better and predict the correct slippage for each trade. This helps users avoid being sandwiched or having their trades fail.

Making All LPs Instant LPs

Another way to mitigate instant (JIT) liquidity attacks is to change the model as mentioned above with LPs' "last checks." If you determine prices after users sign trades, you can allow everyone to submit quotes instantly and create a fair competitive environment.

Structurally, batch auctions are also instant liquidity exchanges—because after users submit their trades, solvers find liquidity and prices.

Conclusion

While blockchains are excellent infrastructure for exchanges, DEXs still cannot handle most trading volumes. However, there are reasons why trading volumes and market makers have not fully shifted to blockchains: prices are uncompetitive, user experience is very poor for traders, yields are too low, and execution is unsafe. Fortunately, solutions already exist for all these issues that can shift most trading volumes on-chain.

ChainCatcher reminds readers to view blockchain rationally, enhance risk awareness, and be cautious of various virtual token issuances and speculations. All content on this site is solely market information or related party opinions, and does not constitute any form of investment advice. If you find sensitive information in the content, please click "Report", and we will handle it promptly.
banner
ChainCatcher Building the Web3 world with innovators