The Future of DEX Trading

A UniswapX Case Study

The past months have seen a shift in the decentralized exchange (DEX) landscape toward intents-based protocols, which unify offchain and onchain liquidity so traders can get a better UX with lower prices. These protocols introduce market makers, searchers, solvers, and other actors that quote orders from DEX front ends and tap into any liquidity source, including offchain centralized exchanges (CEXs). After launching UniswapX and toggling it on by default on the front end (referred to as “front end” from now on), Uniswap—the largest DEX—has become a case study on the impact of intents protocols on automated market maker (AMM) liquidity. 

Variant’s original thesis for UniswapX’s impact was that the fat head of liquidity (large-cap tokens) would eventually be filled by offchain sources, while the long tail of liquidity (small-cap tokens) would be routed to the AMM. Indeed, that’s what’s happening in part

However, the picture is actually a bit more nuanced. Most long tail trades are being filled by AMMs because that is their only trading venue; in fact, around 60-80% of total weekly volume through the Uniswap Labs front end is being filled by the AMM (see “Note on Data” below for how this is calculated). But the AMM isn’t filling just long-tail liquidity: ~30% of ETH/USDC trades through UniswapX and the Uniswap front end are also being routed to the AMM. This isn’t volume from multi-hop swaps, but actual ETH/USDC trades. 

If prices are being set on CEXs that have deeper liquidity, why is the AMM filling so many of these orders? We have two theories: stale prices and filler economies of scale.

(A brief refresher on how UniswapX works: When a user posts a trade on the front end, they’re not automatically interacting with the UniswapX contract. Instead, fillers submit quotes within a short window [<1s], and those quotes are compared to a price immediately quoted by the AMM. If no fillers price better than the AMM, the trade auto-routes directly to the AMM and doesn’t even move through the UniswapX contract.)

Hypotheses

Explanation 1: Stale Prices

AMMs can quote stale prices that are better than market, which is generally set on CEXs. This could explain some of the flow to the AMM. 

The graph below shows the difference between the price quoted on the DEX and an estimated true market price using a CEX API (not including fees), for trades routed to the AMM from the Uniswap front end. AMM fills peak around -0.1-0.2%—notably, above the main fee tier (0.05%) for the main ETH/USDC pool. This implies that the liquidity being routed to the AMM is priced below market, on average. Looking at the distribution, it’s clear that a substantial portion of trades routed to the AMM are skewing quite negative, suggesting that a non-trivial amount of flow to the AMM from X is being priced below market. This is likely due to a de-sync between when the Uniswap interface checks the AMM price, and the market price. In other words, under this explanation, flow is going to the AMM because LPs are quoting better stale prices. 

Source: Dune

Explanation 2: Filler economics

Dissecting volume by trade size provides another possible answer for what’s going on: filler economics. Stale prices alone likely would not lead to the distribution below, because they would not create such a lopsided distribution when segmented by trade size.

Source: Dune

As seen in the chart above, a clear trend emerges: smaller trades are going to the AMM and larger ones are going to fillers, which we expect largely route to offchain sources. 

To determine what’s driving this kind of distribution, let’s consider fees for both AMM swaps, and offchain fills. Importantly, AMM fees are directly charged to the swapper, whereas offchain fill fees are charged to the filler but effectively passed through to the swapper.

AMM

With the AMM, there are two types of fees involved with any swap:

  1. Swap fees: In the case of the main ETH/USDC V3 pool, 0.05% of volume

  2. Gas: Gas for the router contract

Offchain fills

Fillers have separate costs:

  1. Swap fees on CEX: It varies, but usually half to a quarter of the swap fee on the AMM.

  2. Hedging costs: These costs hedge market maker inventory risk of holding onto the tokens quoted, given market volatility. They are not as easy to estimate, since hedging can take many forms, such as selling, short positions, etc. These have different fee structures, but we assume they increase quasi-linearly. (Occasionally fillers don’t hedge when they have sufficient inventory, but we’re including them in the model.)

  3. Gas for filler contract: Fillers need to pay a gas fee to transfer the tokens to the UniswapX contract and fill the order. This is potentially less gas-efficient than gas for the core router. Importantly, these contracts interact with other UniswapX contracts (the reactor, specifically) but are written by fillers themselves—not Uniswap.

Fees for AMM and offchain fills (assuming infinite liquidity)

Fees as a percentage of volume (the derivative of the cost function)

*These graphs are for illustrative purposes and not necessarily drawn to scale

These economics reveal that filler costs as a percentage of volume decline with trade size, while the AMM costs decrease slower than offchain fills. In other words, as trades grow larger, it’s cheaper to fill orders using offchain liquidity. Potentially higher upfront fees for fillers come from less gas-efficient filler contracts, and hedging costs (though if fillers have sufficient inventory, they don’t need to hedge). Below a certain rough threshold of volume, fillers are often not profitable, and the trades are filled by the AMM. 

As seen above, fillers have higher upfront costs, primarily in the form of gas for the filler contract. By contrast, the AMM has higher variable costs because of high trading fees. This makes it easier to fill larger orders offchain. 

Moreover, the cost curves don’t include another secondary “cost” that impacts pricing: slippage, or how trade size impacts pricing. Large CEXs often have deep liquidity and can better handle the impact of large trades versus AMMs. Finally, it’s important to mention that trades for fillers also need to be sufficiently profitable: the cost curves don’t just need to be equal; costs for fillers need to be sufficiently lower than the AMM cost curve for fillers to profit.

Implications

While only two potential explanations, stale prices and filler economics help indicate where the future of DEX trading is heading. If the above explanations are correct, there are two primary bottlenecks preventing more liquidity from being routed offchain: block times and gas. Both of these can be solved by L2s, which are seeing more attention and order flow.

First, longer block times make it significantly harder for fillers to source offchain liquidity because of market volatility and batching. Fillers typically include a volatility discount to account for changes in prices from when the order is quoted to when it is finally filled. UniswapX is currently only deployed on Ethereum mainnet, which has a relatively long block time of ~12s. Shorter block times would introduce less volatility risk, making it easier for fillers to complete smaller trades.

Second, gas fees lead to the high upfront cost for fillers, which makes smaller trades less profitable; although this is similar to AMMs, fillers can potentially write more gas efficient filler contracts. Lower gas fees would make it more economically feasible for them to fill more small trades—which is clearly possible on L2s. Additionally, high gas fees make rebalancing liquidity more expensive. Cheaper and more automated retail liquidity management could improve AMM prices by better adjusting liquidity to more accurate and real-time ticks, or price ranges. It should be noted that lower gas fees also make it easier to split trades across multiple pools, making it easier to fill orders with onchain liquidity, so there is a potential counterbalancing effect.

These conclusions suggest that more order flow will potentially be filled by offchain sources, rather than AMMs, if trading moves increasingly up to L2s and RFQ systems. This is a prediction made in isolation, and there obviously are a lot of other variables at play. Importantly, AMMs will likely still control flow of longer tail tokens, since there’s limited—if any—CEX liquidity for these tokens. 

If these hypotheses are correct, it’s important to think through an implication of this vision of the future. Offchain fills are undoubtedly a centralizing force, with much more power being given to individual fillers. Although these groups can become highly fragmented/competitive, which can make it decentralized, they’re still a more centralized, offchain source of power when compared to an AMM until that occurs. However, these conclusions were drawn from a data-driven perspective analyzing current AMM designs; innovation is required for more volume to be cleared on AMMs, and continuing research around dynamic fees, auction designs, etc—especially in the Uniswap hook ecosystem—provide compelling potential solutions. 

Thanks to Austin Adams for reviewing this piece.

Note on Data:

Data is sourced from Flashbots’s dune.flashbots.result_overall_lq_alltime table, a rendition of Dune’s dex.trades table. The determination of what is X vs the AMM is by the router address of the first entry for the trade. For ETH/USDC, data is further filtered down to only include trades that are not multi-routed and have an associated front-end fee from Uniswap Labs. Some orders that are routed to X may be rerouted back to Uniswap LPs.


This post is for general information purposes only. It does not constitute investment advice or a recommendation or solicitation to buy or sell any investment and should not be used in the evaluation of the merits of making any investment decision. It should not be relied upon for accounting, legal or tax advice or investment recommendations. You should consult your own advisers as to legal, business, tax, and other related matters concerning any investment. Certain information contained in here has been obtained from third-party sources, including from portfolio companies of funds managed by Variant. While taken from sources believed to be reliable, Variant has not independently verified such information. Variant makes no representations about the enduring accuracy of the information or its appropriateness for a given situation. This post reflects the current opinions of the authors and is not made on behalf of Variant or its Clients and does not necessarily reflect the opinions of Variant, its General Partners, its affiliates, advisors or individuals associated with Variant. The opinions reflected herein are subject to change without being updated.

Loading...
highlight
Collect this post to permanently own it.
Variant logo
Subscribe to Variant and never miss a post.
#cryptocurrency#defi