Discrimination of Toxic Flow in Uniswap V3: Part 3

14 min readFeb 27, 2023

This post is a new installment in an ongoing series by @0xfbifemboy on Uniswap liquidity pools, concentrated liquidity, and fee dynamics. It is the third of multiple posts in a subsequence which aims to focus on the characterization of toxic flow in ETH/USDC swap data and potential implementations of price discrimination or flow segmentation mechanisms.


Prior entries in this series of research posts (part 1, part 2) have attempted to dissect swap flow in Uniswap V3’s ETH/USDC liquidity pools along different metrics. However, our work so far has largely focused on the positive identification of toxic flow, i.e., swaps which are unprofitable for the liquidity pool. It is equally important for us to identify credible sources of nontoxic flow, which in contrast should be incentivized through privileged access to lower swap fees.

Rather than focus on analysis of wallets which originate swaps, as we did in earlier posts, we instead focus on the contract with which each swap transaction interacted. For example, a typical retail trader might use the Uniswap frontend and therefore interact with the Uniswap V3 router contract; in contrast, an MEV bot will have its own, optimized contract deployed, which will likely be more efficient and tailor-built to purpose compared to publicly used swap routers. The target of each transaction, therefore, is likely to be important source of information about the toxicity of the underlying swap.

We find that when a swap is executed through an interaction with the Uniswap V3 routers or with third-party DEX aggregators, it is very likely to be a source of nontoxic swap flow, as opposed to swaps generated through interaction with MEV contracts, which vary from highly toxic to highly nontoxic depending on the predominant trading strategy employed via that contract. These effects are persistent over time, i.e., the nontoxicity of DEX aggregator flow has remained consistent throughout the entire duration studied.

Router contract analysis

Previously, when we analyzed wallets with extremely large numbers of ETH/USDC swaps, we noticed that a CoW Swap order solver (0xe92f359e6f05564849afa933ce8f62b8007a1d5d) was associated with an average liquidity pool PnL of +3.93 basis points (very nontoxic flow). This is likely because the fees and complexity associated with using a third-party order matching or aggregation system would dilute any alphas available to a systematic trader, who would presumably much rather be the one matching order flow rather than subjecting their passive orders to external matching or passive execution; as such, a much greater proportion of swap flow on CoW Swap is nontoxic, originating from retail traders who simply want to buy or sell some fixed quantity of ETH without caring too much about the performance of their trade on the 5- or 10-minute timescale.

This observation motivates a more general analysis of DEX aggregators on Ethereum. A great deal of trading activity flows through a small handful of active aggregators:

It is straightforward to determine which swaps flow through aggregators. A user swapping through the Uniswap frontend directly will generate transactions that interact with the Uniswap V3 router contracts; similarly, a user swapping through the 1inch aggregator will generate transactions that interact with the 1inch routers. We can therefore group all ETH/USDC swaps according to the address of the contract with which the transaction interacted.

Doing so, we find that the 2.7 million ETH/USDC swaps in our dataset were generated by interactions with about 6,000 unique contract addresses. If we order these contracts by number of associated swaps and hand-annotate their identity, we find that aggregators do in fact consistently deliver positive PnL swaps (nontoxic flow) to the liquidity pool (top 25 shown):

We immediately see that swaps which flow through the Uniswap router or a DEX aggregator are generally quite nontoxic, while MEV-related swaps (identified either through the Etherscan annotation or manual inspection), which flow through custom contracts, vary in their degree of toxicity.

Several notes on interpretation: Of the major aggregators pictured above, only one is missing here, namely the Paraswap P4 router; not much swap volume flows through this router, but it is still associated with a positive PnL. Additionally, the Cow Swap PnL given here differs from the one quoted from our earlier post. This is because 0xe92f359e6f05564849afa933ce8f62b8007a1d5d is merely one of multiple CoW Swap order solvers (an incomplete list can be found here), whereas 0x9008d19f58aabd9ed0d60971565aa8510560ab41 is the order settlement contract though which all CoW Swap orders flow regardless of the originating solver. Finally, we have highlighted Wintermute here separately from other MEV bots for general interest, although they also likely fall into the category of MEV bots as well.

MEV bots

At a glance, it appears that our intuitions were correct: aggregator swap flow is, on the whole, quite nontoxic, suggesting that it should be given a privileged, low-fee status. Can we say anything more interesting about the characteristics of this flow? Returning to our prior analyses, recall that we first observed a negative relationship between notional swap size and swap PnL. If we restrict to the top 25 target contract addresses in the table above, we see that this relationship is largely recapitulated:

In particular, we can make several observations:

  • DEX aggregators handle relatively small swaps, with the average swap size ranging from 10k to 100k USD.
  • Among MEV bots, those with average swaps < 100k generate positive pool PnL (nontoxic flow), whereas those with average swaps > 100k generate negative pool PnL (toxic flow).

Why do we observe such a relationship among MEV bots? We previously found that the wallet 0x1fd34033240c95aabf73e186a94b9576c6dab81b, a MEV bot focusing on cyclic arbitrage, generated positive PnL for the liquidity pool. Indeed, if we look at the MEV bots in the table above with positive PnL, we generally find that their transactions consist of atomic cyclic arbitrage. For example, the wallet 0xa1006d0051a35b0000f961a8000000009ea8d2db, with an average PnL of +6.36 basis points,

Similarly, the wallet 0x0eae044f00b0af300500f090ea00027097d03000, with an average PnL of +7.31 basis points, focuses on cyclic arbitrage between different Uniswap pools:

We will not exhaustively survey every address given above, but the reader may verify that the general pattern holds. This supplies a natural explanation for the patterns we previously observed. In general, if prices of various altcoin pools are dislocated, an arbitrage opportunity presents itself; however, the size of these opportunities is almost certainly limited by the size of the altcoin pool, which is quite likely to be much smaller than the size of the ETH/USDC pool. In contrast, CEX/DEX arbitrage has no such limit beyond the size of the entire ETH/USDC pool itself. Additionally, cyclic arbitrage opportunities are triggered by altcoin-related mispricings, making the arbitrage bot a “taker” of existing ETH/USDC prices. It is therefore consistent with expectations that cyclic arbitrage bots result in swaps with positive pool PnLs as well as lower notional swap sizes compared to other MEV bots, which presumably focus on statistical arbitrage of Uniswap pools against other venues.

Of course, it is not really appropriate to classify a particular MEV bot as a “stat arb bot” or a “cyclic arb bot” in full generality. MEV bots may engage in multiple different trading strategies at the same time, and the distribution of their swaps across the atomic-to-statistical axis may itself vary tremendously over time; therefore, a more detailed analysis would properly focus on classifying swaps at the transaction level, rather than summarizing across multiple swaps based on the target contract. Nevertheless, even despite such limitations, we feel the data are consistent with the narrative we have set forth.

Overall, our findings suggest that it may be beneficial to incentivize cyclic arbitrageurs’ usage of deep liquidity on major trading pairs. This is particularly applicable to the case of a new DEX, which would be able to profitably entice searchers to use, say, ETH/USDC liquidity at a discounted fee rate while sending toxic flow to long-tail altcoin pairs on other venues. However, even if all trading is contained within the same exchange, it nevertheless makes sense to charge a lower fee rate for the nontoxic components of an atomic arbitrage while charging a higher fee rate for the toxic components.

DEX aggregators

What about the characteristics of DEX aggregators? Does the swap flow routed through each aggregator have unique distinguishing characteristics, or are they all fairly similar? First, again, we should note that the majority of all swap flow is captured by a small fraction of router contracts:

Together, swaps routed through the Uniswap V3 routers make up a full 45% of the swaps in our dataset. The next most popular router contract is, amusingly, [0x881d40237659c251811cec9c364ef91dc08d300c](https://etherscan.io/address/0x881d40237659c251811cec9c364ef91dc08d300c, which is the contract for the MetaMask in-wallet swap. (Note that MetaMask charges a 0.875% swap fee!)

Intuitively, we might want to roughly separate swap routers or aggregators into two broad subcategories. The first subcategory might consist of users of the Uniswap interface, MetaMask swap, etc.: essentially, relatively unsophisticated retail traders who are not overly familiar with AMMs or concerned with details of swap execution. The second subcategory might, in contrast, consist of relatively more sophisticated on-chain users, who take the effort to go to an aggregator such as 1inch or Matcha as an easy way to optimize their trade execution.

Can we detect differences in the behaviors of these two subcategories? If we look at the distribution of swap sizes, we find that the first subcategory of router contracts routes relatively small swaps, with the number of swaps declining monotonically as the notional swap size increases:

Curiously, though, we find a much different distribution for the second subcategory, representing on-chain aggregators that more sophisticated users might visit:

(For visual clarity, we have selected a subset of the major DEX aggregators rather than including every single contract in the table above.)

For these aggregators, there is a distinct peak in terms of notional swap size up until which the number of swaps in each ‘bucket’ increases quite consistently. This may be due to a ‘wealth effect’ where users with sufficient knowledge to visit a DEX aggregator are also, on average, generally wealthier. Arguably, it could also represent the simple fact that MetaMask and Coinbase Wallet charge extremely high swap fees (0.875% and 1% respectively), leading users to choose a more efficient aggregator for larger swaps; however, this hypothesis is somewhat implausible, as the Uniswap V3 router does not charge any supplemental fee and yet shows the same trend of swap count declining with notional size, and once a user is aware of the existence of DEX aggregators, there is little reason to not use them for all trades regardless of size.

It is therefore all the more surprising that we observe no great differentiation between the average PnL of the swaps routed through each of the two subcategories, even after segmenting by the notional size of each swap:

Remarkably, it appears at a first glance that the swap flow through all of these contracts is generally quite nontoxic, with a sharp rise in PnL at the highest percentiles of notional swap size. Although preliminary, this bodes well for the practicality of segmenting swap flow from aggregators and the Uniswap routers and classifying it as nontoxic. (Looking a little more closely, we do see that at most notional swap sizes, swaps originating from the Uniswap V3 router are marginally more nontoxic than swaps routed through other contracts. That being said, the differences are relatively small, being on the order of 1–2 basis points at most.)

Additionally, due to the very nature of using an external DEX aggregator, it seems quite unlikely that an informed trader who is trading on a 5- or 10-minute timescale would be able to “masquerade” as nontoxic flow by routing their swaps through these aggregators; they would likely have to give up an untenable portion of their deal of their edge to do so. That being said, perhaps this is less true for simple routers like the Uniswap V3 router, and there may be sophisticated ways to productively route toxic flow through DEX aggregators that we have not anticipated. Certainly, at the very least, aggregators like the MetaMask swap router or the Coinbase Wallet router (which relies upon 0x, but just takes a 1% cut on top) are very credibly nontoxic, as no high-frequency trader would be willing to pay their exorbitant swap fees; any person who is, in contrast, is almost certainly a retail trader with zero edge.

Consistency over time

Although we know that on aggregate, certain sources of swap flow seem to be distinctly toxic or nontoxic, we have yet to examine how swap toxicity varies over time. For example, one could imagine the aggregate PnL of swaps coming through aggregators to be much higher in times of market euphoria, when most swaps are coming from uninformed retail traders, whereas one might imagine that in a market downturn, with much lower overall volumes and diminished euphoria, pool PnL is somewhat depressed in comparison. As such, our results may be strongly biased depending on the time period over which we sample.

Fortunately, it does not appear that this is the case. It is clear that swap flow from the Uniswap routers and DEX aggregators is consistently nontoxic over the span of an entire year, a pattern which is likely to continue on indefinitely into the future:

As something of a brief but fascinating aside, it is interesting to consider whether or not we might observe the same phenomenon for MEV bots. Over time, the MEV landscape has become more competitive, and strategies which were once successful decay past the point of profitability; it is not implausible to imagine that this might show up in our data. Choosing an arbitrary example, the cyclic arbitrageur 0xa1006d0051a35b0000f961a8000000009ea8d2db, we see that they have consistently been sending swaps to the Uniswap ETH/USDC pool throughout the entire duration studied, albeit with fairly high variability in the weekly swap count:

However, that does not mean that their alphas have not decayed; if we look at the average notional swap size of their ETH/USDC swaps, we see a consistent downward trend starting from the very beginning of the data:

This suggests that the size of the arbitrage opportunities they are capturing has been on a persistent downward trend. Perhaps they are captured by other searchers before this particular MEV bot can full the arbitrage, or perhaps protocol-level mitigation of MEV generation has become more efficient over time, such that fewer gross inefficiencies are exposed to the market on a regular basis. Ultimately, however, even though the size of their swaps has declined, the PnL generated by 0xa1006d0051a35b0000f961a8000000009ea8d2db remains consistently positive for ETH/USDC liquidity providers over time:

We may also examine a more familiar example: the well-known, dominant MEV bot 0xa57bd00134b2850b2a1c55860c9e9ea100fdd6cf. If one examines their swap count, a surprising trend reveals itself: 0xa57 essentially stops transacting in the Uniswap ETH/USDC liquidity pool past a certain date:

It is unclear why this is the case. Perhaps the group operating 0xa57 moved the strategies which interacted frequently with ETH/USDC to a different contract? Or perhaps they were outcompeted by other groups at statistical arbitrage of ETH prices? At the very least, at the time of this article's composition, 0xa57 continues to be highly active:

Throughout the entirety of their active period (in this liquidity pool), 0xa57 consistently generated negative PnL for liquidity providers:

(The extremely noisy data on the right hand side of the graph comes from a very small number of swaps and should be ignored; it is presented here simply to keep the time axes consistent across different graphs in the article.)

Such consistent negative PnL suggests that 0xa57's transactions in the ETH/USDC pools were focused on arbitraging ETH prices against leading venues. Is this an accurate hypothesis? Although it is of course challenging to reverse-engineer the full details of 0xa57's strategies, we can get a flavor of their activities by randomly sampling some old transactions. For example, the transaction https://etherscan.io/tx/0xdbfb12ca52b0e704d06ca571b0f178be5b57b5235bc617a1ea68423db2e3e85b purchases 191 ETH in block 13882162; looking at the very top of this block, we find three consecutive transactions made to the 0xa57 contract, all purchases of ETH with USDC:

Other transactions are more difficult to interpret. For example, 0xd39888301d75caff8155247e7ebee06c7fcafea877e9b5fd28df6b38883c3d85, which sells ETH for USDC, is located in the middle of block 14051414:

Although it is placed quite close to other transactions made to the 0xa57 contract, it does not appear to be a sandwich; in fact, the transaction two positions down, 0x2c593490a45fa749856262df8622a6867c06e43b8fca3e774d1a9fa08270fa8d, is also a sale of ETH for USDC, and the transaction in between is a seemingly unrelated swap of USDT for SUSHI on SushiSwap. It is somewhat unclear why these transactions are placed where they are and what the intended purpose is, but in any case they do not seem to be "fully on-chain" strategies like cyclic arbitrage.

Given the entrance of well-capitalized institutional players into crypto HFT over the last year, many of whom likely directly ported over existing alphas and infrastructure to cross-CEX arbitrage on major coins, it is not difficult to imagine that, in this specific domain, 0xa57's edge was slowly diluted to the point where they eventually chose to focus on other, longer-tail strategies. At the same time, however, we can see that their markout PnL is consistently negative up until the point that they stop transacting frequently in the ETH/USDC pool, which would be more consistent with the operators of 0xa57 simply switching some strategies to a different contract.


In previous work, we were able to make considerable progress characterizing the behavior of toxic and nontoxic wallets. We found that toxic wallets transact often and at large size, and we were able to show that toxic wallets appeared to segregate into two broad categories with alphas resolving at slightly different timescales.

Here, we changed our perspective considerably and instead began to analyze ETH/USDC swaps based on what contract the swap transaction interacts with. We found that:

  • Uniswap V3 routers and DEX aggregators like 1inch and Matcha consistently deliver nontoxic swap flow over the entire time period studied
  • MEV bots seem to generally deliver nontoxic flow if they focus on atomic arbitrage between different DEX pools; otherwise, they deliver toxic flow

We were also able to produce some preliminary but intriguing observations about the behavior of MEV bots over time, roughly consistent with models of greater HFT competition and alpha decay over the span of the last year.

Because it is intrinsically difficult for informed traders to utilize third-party aggregators for their swap flow, DEX aggregator flow may continue to be a credible signal of nontoxicity not easily gameable by arbitrageurs. However, the contract that a swap transaction interacts with should be considered as only one of multiple pieces of information, all of whom should be taken together to determine the probabilistic toxicity of an incoming swap.

Much work remains ahead of us. In addition to unresolved questions raised in our prior work, we have only begun to understand the structure of DEX aggregator flow. However slowly, though, we are inching toward an incrementally more complete understanding of swap toxicity on Uniswap V3.