Authors

Gauntlet Team

October 18, 2023

Research

Key Takeaways

Objective

The primary objective of this analysis is to evaluate the efficiency and implications of trade routing across various decentralized exchanges (DEXes), with a special focus on Uniswap's iterations. The analysis seeks to understand how well trades are routed to the DEX with the best price execution, the impact of introducing additional trading fees on traded volume, and where UniswapX stands in terms of price execution competitiveness.

Introduction

In decentralized finance, price execution and trade routing efficiency are crucial for ensuring traders obtain the best possible value for their trades. This analysis utilizes a trade simulator to dissect the routing efficiency, simulate the effect of protocol fees, and assess the competitiveness of UniswapX in the realm of price execution.

In collaboration with the Uniswap Foundation, the Gauntlet Applied Research team has developed a simulator that enables us to understand how volume and liquidity would change under different conditions. This analysis is the first showcase of the simulator’s capabilities and we look forward to the novel data and findings it will produce going forward.

As a demonstration of the simulator’s capability, we apply it to this analysis with the aim of answering the following questions:

  1. What percentage of trades are routed to the DEX with the best price execution?
  2. How does introducing additional costs, such as a fee, affect price execution rankings?
  3. How does UniswapX compare to other DEXes in terms of price execution?

Implications

The implications of this analysis are broad-reaching for traders, liquidity providers, and the DEX platforms themselves. Understanding the routing efficiency and the effect of protocol fees helps to optimize the trading ecosystem, ensuring fair competition among DEXes, and improving the overall user experience in the DeFi space. Moreover, as part of Gauntlet’s collaborative efforts with Uniswap Foundation, we aim to assess UniswapX’s standing in terms of price execution relative to other DEXes.

Methodology

Counterfactual swap simulator

The simulator replicates what would have happened if any DEX trade were rerouted to any other alternative DEX. The procedure to run the sim on a given day is as follows:

  • Iterate over every swap that happened on that day across all supported DEX protocols
  • Determine all alternative DEX pools the swap could have used by fetching a list of all pools that support the trading pair of the swap
  • Iterate over all of these alternative DEX pools
  • Perform an RPC call to the pool contract to compute the amount of output tokens that would be received when using the original amount of input tokens, at the block number of the original swap
Visual explanation of the swap simulator: this was an actual trade that took place (Etherscan).

The simulator is now running on Ethereum mainnet as a daily ETL job and is currently being extended to other networks. Additionally, its design allows can be generalized to producing deterministic outputs of any arbitrary smart contract (including Uniswap’s latest feature: hooks), making its application highly versatile.

This tool is just one part of a broader assembly of simulator tools we are developing, with the goal of applying these simulators to delve deeper into the interplay between liquidity and volume under various economic scenarios and hypothetical conditions.

Applications

Below we describe some potential use-cases for the swap simulator and how it fits broadly within our upcoming priorities.

Fee optimization

The simulator can guide us through the nuanced task of fee optimization by helping navigate the balance between protocol support and maintaining trade volume. This process of fee optimization involves understanding and modeling the relationship between increased transaction costs and demand, and subsequently determining the optimal point where these increased costs are maximally productive and minimally disruptive to existing usage and volume.

Introducing a fee demands a careful approach to ensure it benefits the protocol without triggering a damaging reduction in volume and liquidity. As the correlation between protocol fees and liquidity/volume is not straightforward, the simulator becomes a crucial tool for understanding and managing this intricate relationship.

In the coming months, the Applied Research team at Gauntlet plans to assess the feasibility of enabling fee switches. This will include examination of how different types of fees (dynamic fees, protocol fees, community fees, etc) would impact the broader Uniswap protocol, in addition to what actual fee percentage is productive for the protocol as a whole. In conjunction with our modeling efforts, we can gain a holistic picture as to how an effective fee strategy could look like on Uniswap. This simulator will be instrumental to this joint effort with Uniswap Foundation and something we are wholly excited to be a part of.

Liquidity mining

With regards to the simulator’s application to liquidity mining, the simulator could serve as a valuable tool for crafting and evaluating incentive programs across various DEXes. Essentially, it could help predict how volume might flow into Uniswap pools in response to different incentive structures, providing key insights into the likely impacts on trade volumes and price execution. This might enable the fine-tuning of incentive strategies, ensuring they attract optimal liquidity without adversely affecting trade flows or price stability. While exact predictions of liquidity and volume dynamics could be complex due to the myriad of factors at play, the simulator might offer a foundational analysis, guiding the structuring of future liquidity mining programs.

Over the past few months Gauntlet has led efforts to incentivize liquidity on Ethereum and Arbitrum for a curated selection of liquidity pools on Uniswap. With this new simulator we aim to provide better recommendations by better understanding the interplay between liquidity, volume and price execution.

Hooks

The simulator can be instrumental in studying and optimizing the impact of specific hooks on trades. By simulating trades with different hook configurations, we can explore their efficiency, cost implications, and potential advantages across different scenarios. For instance, consider dynamic fee adjustments based on real-time market volatility. With the simulator, one could model how hooks that adjust fees in response to sudden market shifts influence liquidity provider returns and user trading costs.

Hooks are still a relative new addition, and their optimal use is still to be determined. By simulating various configurations, this tool can uncover valuable insights into hook efficiency and motivate further innovations.

Data

The data used in this analysis is novel data produced by the counterfactual swap simulator and sources its on-chain data from blockchain-etl, which uses parsed log events. It contains original transaction details such as hash and token quantities, as well as contract addresses to the original and simulated destinations starting from 2023-07-01 and ending 2023-10-01 Additionally labeling information such as token symbology and DEX names are included.

The list of fields are described below. The total rows is approximately 60M, and the breakdown of distinct transaction hashes per DEX are as follows:

In the spirit of collaborative research, we are making the simulator data, which underpins this analysis, accessible to the public for open-sourced research endeavors. The data can be accessed through this link.

Using this data, the community can answer questions such as:

  • How does the efficiency of trades differ between DEXes, trading pairs, and types of users?
  • To what degree is price execution affected by MEV (or placement within a block generally)?
  • Which pairs is a DEX the most efficient at? How does this differ over time or trade size?

Previously, answering such questions was not possible without the use of proxy metrics. Our hope is this data enables more direct insights around price execution and hypothetical routing scenarios.

Caveats

  • The simulator uses trade records from the following DEXes: Uniswap V2, Uniswap V3, UniswapX, Curve, SushiSwap and Balancer.
  • The simulator models trades by assuming they are the only transaction in a simulated block. There is some discrepancy in output token quantities between the simulation output and what would actually occur due to the effect of MEV, just-in-time liquidity, unrelated trades in the same block, and other factors.
  • The simulator does not attempt to model gas fees and these must be applied separately to obtain accurate results.

Simulator output and externalities

The nature of how outputs are generated from the simulator represents ground truth data about what the output of the swap would be had the transaction been placed at the head of the block and executed in isolation. Any discrepancy between what the simulator returns and the actual output represents the impact of extraneous factors such as MEV and just-in-time liquidity. In this section, we briefly examine what subsets of actual trades deviate from the deterministic results of the simulator.

Extraneous Impact Across Token Pairs

In our analysis, we utilized a boxplot to visualize the percentage discrepancies between the simulator's predictions and the actual on-chain transactions. Our simulator offers a benchmark, simulating the expected transaction outcomes in an environment untouched by externalities. The observed discrepancies can be attributed to various external factors such as the influence of Miner MEV and just-in-time liquidity adjustments.Examining specific token pairs and organizing them in terms of volume, we find that high-volume token pairs such as WETH/USDT demonstrate less susceptibility to external market dynamics and thus show strong consistency between the simulator’s output and the real-life outcome of the swap, where any difference is typically below 0.002%. Conversely, low-volume tokens show considerable deviation from the simulator’s reports, in line with their less predictable nature.This observation is pivotal for our analysis. It enables us to target a specific subset of tokens that are largely unaffected by these market dynamics, specifically combinations of USDC, USDT, WETH, DAI, and WBTC. By doing so, we can streamline our focus towards pure price execution, reducing the noise introduced by these confounding factors.

High-liquidity pairs (left) demonstrate significantly less variance due to external factors than lower-liquidity pairs (right).
Extraneous Impact Across Order Sizes

As we delve deeper into the data, another pattern emerges related to order sizes, reflecting the uneven influence of MEV and just-in-time liquidity. Indeed, the size of an order appears to be a significant factor in determining its susceptibility to these market dynamics. Smaller orders, specifically those below $50k, are frequently affected by MEV and just-in-time liquidity. This targeting manifests in discrepancies of 2-5% when juxtaposed with the simulator's projections. In stark contrast, medium-sized orders—those ranging between $50k and $1m—exhibit a more consistent and predictable behavior. For these order sizes, the influence on price execution is remarkably subdued, resulting in deviations of well less than 1% from the simulator's expectations. This pattern insinuates that smaller trades face heightened exposure to real-time market dynamics, whereas mid-sized trades offer a more stabilized transaction environment.

Externalities such as MEV impact a larger percentage of smaller transactions.

While constraining our dataset based on order sizes with minimal discrepancy, our approach intentionally avoids such limitations to facilitate a thorough examination of price execution efficiency during simulated routes, necessitating the retention of this data. Importantly, despite this approach, discrepancies between the simulator and actual trades’ order sizes for a select high-volume subset of tokens prove to be negligible:

For our selected subset of tokens, the variance between the simulator and actual trades is considerably lower than the full dataset.

This observation gives us confidence to proceed with limiting our dataset to those involving high-volume tokens, but inclusive of all order sizes. Stepping back, it is important to clarify that focusing our analysis on a specific subset of tokens, while keeping the door open to all order sizes, is not an arbitrary choice. This is part of a thoughtful strategy designed to pave the way for a clear and consistent exploration of price execution in the analyses to follow. By directing our attention toward this more stable segment, we are ensuring that our deeper dives into price execution are both meaningful and grounded in dependable data. As we navigate toward the subsequent facets of our investigation, our findings will remain rooted in reliably tested insights on price execution, providing a sound foundation for the analysis ahead.#

Results

Overview

In the previous section, we described limiting our analysis to a subset of tokens where the effect of externalities is minimal so as to ensure we are measuring price execution efficiency while reducing confounding factors. Again, those tokens are USDC, USDT, WETH, DAI, and WBTC, and pools can consist of any combinatorial pairs of these tokens. The analysis demonstrated a high level of routing efficiency when accounting by volume: approximately 81.16% of the total volume we analyzed was traded on the DEX with the best price execution. Conversely, when accounting by transactions, only 35.19% had taken place on the most optimal DEX. This difference represents both the skewed impact of order sizes and potentially different sensitivities to price execution by retail participants, in addition to the effects of gas fees where they’d make up a larger percentage of the order than at higher sizes. Overall, with the exception of a couple of DEXes (SushiSwap, Uniswap V2), price execution is quite efficient. For the subset of high-liquidity pairs, Curve DEX demonstrated the highest price execution efficiency, followed by Uniswap V3. Differences in price execution between the best DEX destination and the runner-up vary by exchange and order size but typically are less than 1%.With regards to simulating protocol fees on Uniswap V3, the result was as expected: as additional fees are levied on liquidity providers and with the assumption that they will pass those costs onto traders in the form of decreased price execution, transactions and volume where Uniswap V3 offers the best rate also decreases, albeit at different rates. Transactions decrease steeply indicating that smaller orders have originally a very marginal improvement on Uniswap V3 in comparison to contending DEXes - the introduction of any fee can swiftly change the ranking order. Volume, on the other hand, is significantly more resilient, with an estimated loss of approximately 8.7% of total volume at the highest fee in our tested range. With this comprehensive overview in hand, we will delve into a more granular examination of these findings.

What percentage of trades are routed to the DEX with the best price execution?

The analysis examined trades starting from 2023-07-01. For each transaction, exchanges were ranked based on the quantity of output tokens returned, and the percentage of trades that were routed optimally was calculated.Additionally, because the simulator does not natively take into account gas fees paid by the trader, this necessitated adjusting swap outputs to accommodate for this additional cost. This was not applied to UniswapX as gas fees are paid by the filler and not the trader.

Insights into overall routing efficiency

Across all tokens (not limited to our subset), a substantial majority of trades were navigated optimally, with 86.5% of transactions and 77.2% of the total volume being directed to the exchanges that yielded the most favorable price execution.Turning our focus on our specified subset of tokens, a mere 31.8% of transactions were efficiently routed. Conversely, a robust 81.7% of the volume was effectively routed, highlighting a trend where smaller order sizes tend to experience less optimal price execution.

Most DEXes offer highly competitive price execution, only just marginally beating out competitors.

Diving deeper into each exchange we see that Curve emerges as one of the top exchanges in terms of price execution where approximately 85% of volume on Curve is swapped at the best possible rate at the time. Following very closely are Uniswap V3 and UniswapX, the latter of which has a much shorter tenure than V3. Despite these rankings, most exchanges come very close to each other in terms of price execution, even if they are not the best. Differences between the best and next-best exchange are around 0.01% or less, with variation depending on the tokens involved and the quantity. In fact, order size is where interesting patterns emerge: generally, most DEX exchanges offer relatively uncompetitive rates at lower order sizes. For example, approximately 25% of volume on Uniswap V3 for orders between $0 and $500 are executed efficiently: meaning the remainder of traders could have received a better price for their swap on an alternative DEX. Conversely, for transactions exceeding $500k, 80% of the volume in this bucket was perfectly executed in that no other destination could offer a better rate than Uniswap V3.

Dashed lines indicate low data (less than 20 unique transactions for that exchange in that volume bracket.

All of these findings are intuitive in that retail traders are assumed to be unswayed by improvements to their rate if they’re only trading small quantities. However, for more seasoned traders and orders placed by institutions, every improvement to price execution matters considerably and that difference could materialize to thousands of dollars in additional tokens.

How does introducing additional fees affect traded volume and trades?

This section of the analysis aims to understand how swap fees on Uniswap V3 can impact trading activity, with the assumption that volume will move to destinations where price execution is optimal. In this implementation, we apply an additional trading fee as a percentage of the pool’s current LP fee. These findings should then generalize to the case where an additional protocol fee is applied to LPs and they pass on these additional costs to traders in the form of worse price execution and decreased output token quantities. This is not simulating the case of redirecting a proportion of existing trading fees to the protocol but instead new, additional fees being passed onto the trader. There is a scenario where LP fees could be re-directed to the protocol and where we’d expect liquidity to decrease accordingly (and subsequently price execution), however with the simplifying assumption that fees can effectively be passed onto the traders, then this analysis provides an early estimate of how a protocol fee would affect volume. Although not part of this analysis deliverable, we are working on performing a more sophisticated analysis that predicts changes in liquidity and from that changes in volume using this simulator.Now, delving into the findings: various fee increments were tested, and the output token quantity was adjusted accordingly to simulate the fee impact.

As introduced fees increase, Uniswap V3’s price execution decreases.

Expectedly, as the fee percentage increased, the volume and the number of transactions that would be optimally routed to Uniswap V3 decreased. However, even on the extreme end where LP fees are increased by 10%, this results in a surprisingly small 8.7% decrease in optimal volume routed. This suggests that for larger, high-volume transactions there is a sizable price execution benefit versus the runner-up and that the presence of a fee is not likely to tip the scales for these order sizes. Regarding declines in transactions; these percentage values are denominated by the total already-efficient transactions. As we’ve observed, small-size transactions are relatively inefficient overall (and make up a majority of transactions) and the decrease is likely overstated as a result.

As order size increases, the difference between the best and second-best increases.

It is worth noting that transactions decrease at a steeper rate than volume due to the nature of smaller transactions and greater concentration of competition around price execution, meaning that the best destination was only marginally better than the runner-up.

How does UniswapX compare to other DEXes in terms of price execution?

Transactions originating from UniswapX since 2023-07-01 were analyzed in terms of price execution efficiency compared to other exchanges.

Price Execution Efficiency

Approximately 55.6% of transactions and 82.3% of volume on UniswapX were found to have the best price execution. This suggests a disparity between the number of transactions and the volume of transactions that obtain optimal price execution on UniswapX, possibly indicating that UniswapX may offer better price execution for larger trades.

While still relatively new, UniswapX is showing impressively low slippage - albeit mostly for larger orders.

This is indeed a trend we see when examining slippage at different order sizes: UniswapX tends to perform better as the order size increases. This isn’t entirely surprising given the opportunistic nature of private fillers, and wanting to serve larger orders with a competitive execution price to those of LPs. Nevertheless, one of the touted selling points of UniswapX is gas-free swaps. Small orders may still be viable for the trader after considering gas savings despite worse price execution or higher slippage at lower volumes.Additionally, in the cases where UniswapX was the most efficient destination versus alternatives, the improvement in price execution relative to the runner-up was typically higher against its counterparts: in nearly half of the transactions where UniswapX topped the list, it delivered at least a 0.1% higher token yield compared to what alternative platforms would have provided.

Whenever UniswapX is optimal, it is a sizable improvement over the runner-up.

However, this is an incomplete view: according to Uniswap Labs, 80% of transactions in UniswapX's auction system end up being handled by liquidity providers because they offer better prices than private fillers. This suggests that there might be other factors at play, which aren’t captured in our on-chain data analysis. For example, private fillers might be picky about which orders they fill and how they decide to do so. As more transaction data accrues to UniswapX, we’ll be able to get a more accurate estimate of its performance.  

Conclusion

Our analysis, primarily hinging on the newly-developed simulator tool, illuminates key aspects of trade routing and price execution across various DEXes, notably Uniswap V3 and UniswapX. The simulator, central to our study, not only validated various hypothetical scenarios around trade and volume but also emerged as a vital asset for future DeFi explorations.The analysis sheds light on the crucial aspect of trade routing efficiency across different DEXes, indicating that most DEXes execute trades with strong rates relative to competition, with a potential area of improvement for smaller order sizes. Also performing relatively well was UniswapX, with its unique auction system sourcing liquidity from private fillers. Those submitted trades where private fillers did opt to accept showed considerable improvement over alternative DEX destinations for the same trade. Nevertheless, there’s wide scope for further research on private filler behavior and motivations as the majority of transactions submitted to UniswapX ended up settled by LPs. The balance between introducing additional trading fees and routing efficiency was another key takeaway, where most retail and small orders were affected significantly and better price execution options emerged after considering a fee, volume overall declined only slightly suggesting a strong value proposition in that the benefit in price execution on V3 is greater than the fee ranges tested. Again, this analysis was made possible by the development of this simulator in collaboration with Uniswap Foundation. As we move forward, this tool and the additional suite of simulation tools will continue to facilitate deeper insights into liquidity and volume in DeFi, helping to shape strategic initiatives and incentive programs with robust, data-driven foundations.

Recommended areas of future research

Impact of externalities

Exploring inefficient transactions to identify underlying issues or responsible parties, especially focusing on the impact of block placement, MEV, and just-in-time liquidity on price execution, warrants further research.

More DEXes

Broadening the analysis to include other DEX platforms will provide a more comprehensive view of the trading landscape, revealing varied strategies and patterns essential for future developments in decentralized trading.

Liquidity modeling

Lastly, employing our simulation tools to understand and optimize liquidity and volume incentives necessitates investigating the rebalancing strategies of liquidity providers across different fee tiers, which could inform and refine future incentive structures and fee mechanisms.

Limitations

Assuming rationality and passing on of costs

With regards to fee simulation, there is the assumption that liquidity providers will pass on any additional protocol fees levied against them onto traders and that they act rationally in routing trades to the most efficient destination. While the assumption of rational routing is fair for large, institutional traders where the costs of inefficiency can be significant, it may not apply to a retail user base. Additionally, the assumption that liquidity providers will pass on any costs to traders (in the form of rebalancing or through another mechanism) requires further analysis to test such elasticity to fees.

Inability to simulate UniswapX

UniswapX, being a dutch auction system where private fillers can opt to fill orders is outside the capabilities of the simulator. We are limited to examining historical trades on UniswapX and assessing counterfactuals where if the trade was routed to another DEX, but not vice-versa.

High-liquidity subset

The analysis concentrates on high-liquidity token pairs, typically associated with lower LP fees. Thus, simulated additional fees might understate impacts compared to higher-fee pools, limiting the generalizability of the findings across varied DEX environments.

Complex routing and splitting operations

The simulator currently assumes a simple, single-hop routing path for swaps, with two tokens only and to a single destination. It does not account for complexities such as splitting orders across multiple destinations or using intermediary pools (multiple hops). This particularly relevant for large orders that necessitate splitting or additional routing logic.

Research

View the full presentation

Read the full paper

Want Gauntlet in

your inbox?

Sign up to get notified about our latest research.

Thank you. You'll hear from us soon.

Contact our team

Tell us about your protocol’s needs

1/4 Name

First, tell us your name

2/4 Contact Info

Tell us know to reach you.

Contact method

Address must be correctly formatted

3/4 Protocol Info

Tell us about your protocol.

Protocol type

4/4 Details

Just one more thing...

Success!

Thank you! You'll hear from us soon.

Monthly Email Updates

Stay connected to Gauntlet research and analysis

Receive a roundup of our latest research, analysis,
and product updates each month

Thank you for subscribing to our email list! Check your inbox for the latest form Gauntlet’s team.
Oops! Something went wrong while submitting the form.