Dr. DODO is Researching

发布于 2023-09-27到 Mirror 阅读

CoW Swap, the Future Form of Intent DEX?

Dan, with all respect. The game was changed long ago by @1inch when they first did high-quality aggregation and @CoWSwap when they pioneered the solver model.

It’s good stuff, but you are not really the first or the second.

—— @Curve Finance

UniswapX made a sensational debut but is also mired in controversy. The sharpest criticism questions whether UniswapX plagiarized CoW Swap and 1inch, who was also inspired by the CoW Swap trading model as well. Curve's official Twitter account stated: "The game was changed long ago by @1inch when they first did high-quality aggregation and @CoWSwap when they pioneered the solver model. It’s good stuff, but you are not really the first or the second."

CoW Swap pointedly showcased its pioneering status in Intent Based Trading. So, what exactly is CoW Swap? How is it different from UniswapX? Both follow the aggregator's solver model path, so why are market voices accusing UniswapX of "plagiarizing" CoW Swap rather than 1inch fusion?

We will delve into everything from the background of its inception, to understanding its mechanics, data performance, and the 9 product differences with UniswapX and 1inch fusion. We will explore what exactly CoW Swap is and how it functions, while addressing the "plagiarism" controversy.

The “Thief” of DeFi Users: MEV Attack

DeFi users have long been victims of MEV (Maximal Extractable Value) attacks such as front-running, back-running, and sandwich attacks. CoW Swap offers MEV protection, aiming to minimize users' MEV losses. Before we delve in, let's briefly understand what MEV attacks are.

Imagine this scenario: you finally find an ideal trading opportunity on Uniswap, and after the pending transaction ends, you discover that the tokens received in your wallet are significantly less than quoted on the UI. Someone raised the price before your purchase using up to your max slippage and sold off afterward. The “Thief” makes a profit from the price difference at the expense of you getting a bad price. Yes, you've been hit by an MEV attack.

MEV attacks occur due to the "asynchronous" submission of transactions to the blockchain and due to the way in which AMMs are designed to process trades. When a user submits a transaction on Ethereum, it doesn't immediately get added to the next block. Instead, it first enters a "mempool", a collection of all pending transactions. Then, validators extract transactions from the mempool to add them to the next block. As the mempool is public, searchers have the opportunity to pay validators to order transactions in specific ways, such that their trades are processed in a particular manner by the AMM, hence, extracting value from users in the process.

Source:CoW Swap Docs

Guide Through the Dark Forest: MEV Protection by CoW Swap

Better than the best price. —— CoW Swap

The name CoW Swap may suggest a relation to "cows," but here CoW stands for "Coincidence of Wants," referring to a unique method of trade matching. Specifically, CoW is an economic phenomenon where "two people holding what each other needs can directly trade without the need for currency as a medium."

In the CoW Swap protocol, users don't need to send a transaction to make a trade but send an off-chain signed order(or Swap Intent) with an expiration date, specifying their minimum outputs. The users don't care where it is executed nor need to care how it is executed. These signed orders are then handed off-chain to Solvers who compete for order surplus maximization  before expiry date. The winning solver gets the right to execute the batch of trades which unlike Dutch Auctions, it contains multiple orders in the batch . This means the required gas for executing the orders is borne by the solver; the user doesn't have to pay gas if the trade fails to meet the promised price.

CoW Swap's MEV protection can be summarized into three points:

1. Batch Auctions A "Coincidence of Wants" occurs when two (or more) traders exchange cryptocurrency without relying on on-chain liquidity. CoW events allow for orders to be bundled together in a single batch, resulting in efficiency gains. Specifically, this saves on-chain costs such as LP fees and gas fees, while the off-chain P2P method also avoids slippage and potential on-chain MEV attacks.

Felix, CoW Swap's technical lead, has noted: Due to the "Cambrian explosion" of a vast variety of tokens in the DeFi space, market liquidity is highly fragmented. To create liquidity between the wide variety of token pairs, market makers need to "step in and provide liquidity". By identifying a "Coincidence of Wants" in every block, it becomes possible to re-aggregate this fragmented liquidity landscape without the need of market makers.

2. Off-Chain Solving Since third parties handle the transaction orders on behalf of users, obscuring visibility into the mempool, all risks associated with MEV are shouldered by these third parties. If a more favorable execution path is identified, the order will be completed at a better price; otherwise, it will be executed at the limit price stipulated in the signed order. All risks and complexities associated with managing the transaction are managed by professional solvers.

Users only need to express their "Swap Intent" without worrying about the execution process. This mechanism protects less sophisticated users who may not know how to "promote" their transaction's priority in the public mempool, shielding them from the pitfalls of the "Dark Forest."

3. Uniform Clearing Prices If two individuals are trading the same asset within the same batch, the protocol mandates that the trades within a batch have the same uniform clearing price. Both transactions will clear at an "identical price," eliminating the concept of first-come-first-served, and hence eliminating the MEV around them. Even if a single block contains multiple transactions for the same token pair, each transaction may receive different prices depending on the order of transactions within the pool, which is the root cause of MEV. However, the CoW Swap protocol mandates a uniform clearing price, rendering reordering meaningless. According to Felix, this approach effectively eliminates "various forms of MEV."

CoW Swap's mechanism is quite innovative. Long before the concept of Intent was introduced, it largely conformed to the requirements for DEX under the concept of Intent. However, CoW Swap is not famous. More people think of 1inch when it comes to aggregators. Why is that? We have summarized the drawbacks of CoW Swap:

  1. Inappropriate for Inactive Tokens Theoretically, the mechanism could offer users better prices, but it also has the potential to result in losses for users. For tokens with high trading activity, there is a high probability that orders can find a "Coincidence of Wants" within the batch to optimize prices. However, it's inappropriate for inactive tokens because liquidity tends to be shallow in the AMMs, and price swings can occur very rapidly, meaning that a slower process like CoW Swap can be disadvantageous.

  2. Limited Token Support CoW Swap, for the moment, does not support the exchange of all tokens, but only those that comply with the ERC-20 standard. Moreover, although some tokens implement the typical ERC-20 interface, the actual amount received by the recipient when invoking transfer and transfer-from methods may be less than the specified sending amount. This could create issues in CoW Swap's settlement logic. For instance, $Unibot is not supported for trading on CoW Swap. Although, according to the team, token support will be expanded soon.

Unveiling the Essence Through Data: A Glimpse into CoW Swap's Market Performance

While ideals are plentiful, reality is always a different matter. Data can provide an incisive look into CoW Swap's market performance. Considering its unique advantages, we'll explore the platform's market behavior from various angles, including its anti-MEV performance, trade volume, and market share.

1. Anti-MEV Performance

When compared to the sandwich attacks happening on Uniswap and Curve, the number of trades routed through CoW Swap that are subject to these types of attacks is significantly lower. In a comparison with 1inch and Matcha, CoW Swap had the fewest instances of sandwich attacks and the lowest ratio of such trades in 2022.

A research report from the on-chain MEV analysis team @EigenPhi.

2. Trade Volume and Market Share

In a horizontal comparison across the aggregator sector, CoW Swap ranks fourth in trade volume and fifth in average trade size. In all these categories, 1inch tops the list.

Source:https://dune.com/murathan/uniswap-protocol-and-aggregators

In terms of market share among aggregators, 1inch, with its large user base, dominates the field, holding approximately 70% of the market. CoW Swap follows at around 10%, trailed by 0xAPI, Match, and Paraswap. CoW Swap's market share shows a growing trend.

CoW Swap's monthly trade volume performance is quite volatile. As of September 1, the total trade volume had reached $27.4 billion.

Source:https://dune.com/cowprotocol/cowswap

3. DAO Preferences

A third of all DAO transaction volume happens on CoW Swap. This is likely because DAOs often require large, MEV-resistant trades, and platforms that can meet the specific order requirements of DAOs—such as limit orders and TWAP (Time-Weighted Average Price). There are also specialized use-cases like Milkman, which was used by AAVE DAO on July 10 to monitor the slippage for a swap involving 326.88 wETH and $1,397,184 of $BAL for B-80BAL-20WETH. The proportion of DAO transaction volume on CoW Swap is still growing. In August, CoW Swap even accounted for over half (54%) of it.

Source:https://dune.com/queries/2338370/3828396

4. Balancer Incentives

On March 24, Balancer released proposal BIP-295 to offer CoW Swap's solvers a fee discount of approximately ~50-75%. This proposal pushed by Balancer was to allow their LP providers to not suffer from LVR (Loss Versus Rebalancing) which is form of MEV that LP providers suffer when trading against arbitrageurs. Because CoW Swap trades are non toxic, Balancer LPs are willing to offer a discount to not lose the fees of those trades against arbitrageurs. CoW Swap's trade volume routed via Balancer ranks third, just behind Uniswap and Curve.

Source:https://dune.com/sixdegree/dex-aggregators-comparision

“Plagiarism” Controversy

”CoW Swap is the first DEX Aggregator offering some protection against MEV“

—— CoWSwap About

CoW Swap’s precursor, Gnosis Protocol V1, was launched in 2020 and was the first DEX to offer batch auctions with ring trades. Both UniswapX and 1inch Fusion adopted a similar architecture to CoW Swap, but decided to use Dutch Auctions instead of Batch Auctions: Signed Orders → Outsourcing Trade Creation to Third Parties → (Incentivizing Third Parties to Return MEV to Users). When UniswapX was launched, there were loud voices accusing it of plagiarizing CoW Swap. Similarly, 1inch was cheekily called a “modified version of CoW Swap”. Let's delve into the differences between these three, which can be summarized into nine aspects.

1. Third-Party Naming

  • CoW Swap:solver

  • UniswapX:filler

  • 1inch fusion:resolver

💡 All serve the same role: They find solutions for user-signed orders and package them into a single transaction to be included in a block.

2. Execution Process

  • CoW Swap: All solvers submit their solutions to a Driver for ranking. Once the bidding period is over, i.e., all solutions have been submitted and ranked, the top-ranked one is notified to execute. But one subtle difference, is that by using Batch Auctions, CoW Swap can settle multiple orders in a single transaction and create more efficiencies amongst those trades than Dutch Auctions can.

  • UniswapX: The filler who wins the bid has the right to execute within a certain timeframe, followed by a Dutch auction.

  • 1inch Fusion: Over time, the number of resolvers increases while the price decays.

💡 1inch Fusion initially has only one resolver, and this resolver “waits for the price to decay before executing,” which has been criticized. This increases the waiting time for users.

Note: At present, the proposal has been passed to increase the number of resolvers to 10

3. Batch Formation

“Leupold contends that CoW Swap’s design still offers better pricing because it batches trades rather than processes them individually like UniswapX. Batching many different trade requests together provides better MEV resistance, he said.”

—— CoW Swap CTO

  • CoW Swap: Packages all unexecuted on-chain orders into one batch for a Dutch auction, and orders can be combined for matching.

  • UniswapX: Processes the orders individually.

💡 Due to the complexity of orders, it’s uncertain whether CoW Swap can find the optimal solution for all unexecuted orders packaged into one batch within a single block time. In fact, an optimal solution may not even exist.

4. Order Parameterization

  • UniswapX: Users have more freedom (which could lead to more complexity) to define parameters, including the decay functions for auctions, initial Dutch order prices, etc.

  • CoW Swap and 1inch Fusion: Users only need to provide the tokens for exchange and the slippage. CoW Swap also allows for setting the duration of the order.

5. Different Sources of Liquidity

  • CoW Swap: Can tap into all onchain liquidity, find users liquidity within the batch (known as CoW or ring trades) and also solvers can tap into external liquidity sources.

  • UniswapX: Allows any liquidity source that the filler can access, including private liquidity.

  • 1inch Fusion: Typically large market makers.

💡 CoW Swap primarily seeks counterparties available at the same moment, whereas 1inch market makers acting as resolvers may opt for direct execution. UniswapX could also potentially allow professional market makers to intervene, addressing the issue in 1inch where the "resolver waits for the price to decay before executing," and potentially taking market share from 1inch.

6. Degree of Decentralization

  • CoW Swap: Either by creating a pool to be whitelisted ($500K USDC & 1.5M COW tokens) or meeting DAO criteria to be whitelisted by CoW DAO, which is a light KYC process.

  • UniswapX: In Uniswap’s beta period, the set of Quoters will be vetted by Uniswap Labs following UniswapX’s launch, with plans to make the quoting system more permissionless to access.

  • 1inch Fusion: Top ten addresses are chosen as Resolvers based on the amount and the weighted years of $1INCH tokens staked. Requires registration, going through a KYC process, and maintaining sufficient balance for order fees.

Note: CoW Swap is currently moving to a model in which each solver will have their own settlement contract and hence won't require a bond to become a solver

7. Different Sources for Quotes

  • CoW Swap: API Based Quotes, as well as allowing solvers to quote (RFQ)

  • UniswapX: Allows fillers to quote (RFQ), i.e., to initialize the starting price for the Dutch auction.

  • 1inch Fusion: API-based quotes.

8. UniswapX Uses RFQ and is Considering a Reputation System

  • CoW Swap: Provides weekly rewards to all the Solvers that have successfully settled a batch during that time frame with the highest rate of successful trades as an incentive for solvers to participate.

  • UniswapX: Allows orders to specify a filler to execute the order within a certain time frame (followed by a Dutch auction), incentivizing fillers to quote in the RFQ system. To limit abuse of this exclusivity, a corresponding reputation or penalty system may be introduced.

9. UniswapX Introduced Cross-Chain Aggregation Feature (Yet to be Implemented)

  • UniswapX: Can be extended to support cross-chain transactions. Swaps and cross-chain actions are merged into a single action, allowing assets held on the original chain to be exchanged for assets on the target chain without the exchanger directly interacting with a bridge.

  • CoW Swap, 1inch Fusion: Still under discussion.

In Conclusion

Overall, CoW Swap is a project that deserves attention. The outsourcing of orders to third-party Solvers has interesting parallels with the "philosophy" of L2 scaling: executing off-chain, while ultimately settling and verifying on-chain. CoW Swap ingeniously enables transactions to be part of a vast barter economy, solving the problem of fragmented liquidity. When peer-to-peer transactions are insufficient, it utilizes on-chain liquidity.

Intents implementation requires anyone to act as a Solver, thus driving efficiency through competition. The architecture of CoW Swap naturally aligns with this. All the risks and complexities associated with managing transactions are handled by professional solvers. Protected by CoW Swap's mechanism, users don't have to worry about "walking in the dark forest," which is in line with the philosophy of DODO V3. In DODO V3, liquidity providers' funds are managed by professional market-making teams without having to think about strategies personally.

Under the narrative of Intent, CoW Swap’s market share is also on the rise. Up until today, the market share didn’t sky rocket because without a strong brand as Uniswap, or with direct wallet integration, it was hard to fight the marketing battle. However, if we take wallets as an example, in the past they were more likely to integrate Uniswap because the DeFi standard was to craft a raw trade transaction and anything outside of that would “confuse” users. But now that the DeFi market is embracing Intents, and that big players such as Uniswap or 1inch have released products working with intents, more people are open to integrating CoW Swap as the users are more aware of the benefits of this type of trading.

CoW Swap has made commendable progress in addressing the MEV issue, while it also faces barriers to mass adoption such as not supporting all tokens. CoW Swap is the pioneer of the solver model, and UniswapX and 1inch fusion appear more as innovations built upon it. 1inch releases resolvers sequentially to interface with professional market makers; Uniswap's RFQ system allows users to specify a filler first, rather than proposing solutions concurrently. We look forward to CoW Swap's framework driving more innovations in the field of decentralized exchange aggregators and are excited for its significant and stellar growth ahead.

Reference

https://ld-capital.medium.com/the-future-of-mev-is-the-future-of-the-crypto-has-the-importance-of-the-mev-track-been-76bb36caf9f4

https://app.aave.com/governance/proposal/?proposalId=267

https://eigenphi.substack.com/p/sandwich-mevs-impact-on-cow-swap

https://snapshot.org/#/balancer.eth/proposal/0xd991e9f3c6edd148bd37c600d7ada3d28db1758e3cfd703c02d290f502906f05

https://blog.cow.fi/what-are-cows-on-cow-swap-e72baaa4678a

https://blockworks.co/news/cow-swap-mev-problem

https://swap.cow.fi/#/about

https://twitter.com/RaccoonHKG/status/1607030613495939074