Introduction
Since their launch, CoW AMMs have amassed almost $15.5 million USD in TVL and almost $20 million USD in trade volume (source: Dune). An essential part of these CoW AMMs operation and performance come from their integration from solvers. Solvers who integrate these CoW AMMs are able to route user orders through these CoW AMMs and generate surplus for the pool, leading to an additional APR for depositors in these pools.
In order to evaluate the performance of the CoW AMMs relative to their current integration status we wanted to investigate how much surplus was currently left on the table due to a lack of integrations, which could show us how much additional surplus the seCoW AMMs could have earned if more trades would have been routed through the CoW AMMs.
To create a baseline metric for these evaluations we decided to measure the ‘trade envy’ of these pools. This trade envy represents trades that could have generated a surplus if they had been routed through the CoW AMM, but did not. This lead to the AMM being envious of the pool that did settle the trade, the CoW AMM could have generated surplus for the user but was unable to. If this missed surplus is high, then this could give an indication of the impact that more integrations would have on the APR for investors in the CoW AMM pool.
Methodology
The full code for this study can be found on GitHub.
In order to calculate the potential missed surplus, we first obtained data for trades involving USDC and WETH on the CoW Protocol. Due to the way clearing prices work, we decided to select only trades that directly exchange WETH for USDC or USDC for WETH. We selected all of these trades from block 20689918 to block 20842716 on Ethereum mainnet (approximately September 6 2024 7 am UTC until September 27 2024 3 PM UTC).
For all of these trades we looked at three main data points: the clearing prices for that auction, the prices that the USDC-WETH CoW AMM would have given on that block, and the gas price for that block.
The clearing prices and gas prices were collected on Dune using the following query:
select call_tx_hash, call_block_number, gas_price, tokens, clearingPrices
from gnosis_protocol_v2_ethereum.GPv2Settlement_call_settle
join ethereum.transactions
on call_tx_hash = hash
where array_position(tokens, 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) > 0
and array_position(tokens, 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) > 0
order by call_block_time desc
Then, using an archive node we simulated what prices the USDC-WETH CoW AMM would have traded at for the amounts of USDC and WETH for a given auction on a given block. With this, we calculated what the surplus would have been if the trade had been routed through the CoW AMM:
sell_amount_cow_amm * clearing_price_sell / clearing_price_buy - buy_amount_cow_amm
So if a user was selling USDC and buying WETH, then we calculated surplus using the following formula:
surplus = cow_amm_usdc * clearing_price_usdc / clearing_price_weth - cow_amm_weth
Finally, if this surplus was positive then we check to see if this would have been profitable after computing the gas prices for executing this transaction. We do this by multiplying the gas price for that block by 100.000 WEI and subtracting that from the surplus. If the resulting value is positive then we count this resulting value as a potential missed surplus.
Results
The results show that if all solvers would have had native integrations for the USDC-WETH pool and had routed profitable trades through the USDC-WETH pool from September 6 to September 27, then that would have lead to approximately $484 in surplus for the CoW AMM. Only 19$ of this was actually captured by solvers, so that would have lead to an additional $464 for the CoW AMM.
Since the CoW AMM would have generated about $1.966 in surplus over this period this means it could have captured an extra 23% surplus over this period.
Conclusion
In conclusion, it appears that there is a significant opportunity for increasing the surplus captured by the CoW AMM.
Since the majority of surplus captured by the USDC-WETH pool currently doesn’t seem to come from direct USDC-WETH trades (only 4.1% of potential surplus from USDC-WETH trades was captured during this period and the remaining surplus was captured from other trades) I believe this indicates that the potential surplus that the USDC-WETH pool could capture is much higher.