cookies πŸͺ
cookies πŸͺ

@jinglingcookies

23 Tweets 3 reads Dec 02, 2023
CoW Swap: Low Fees, MEV-Resistant Trades - Made possible with intents, batch auctions and CoWs
With cumulative trading volume crossing $30 billion, what is it about @CoWSwap that's so enticing?
Let's dive deep into CoW Swap's architecture, and the unique benefits it brings!
🧡
In this thread, we will go through:
1️⃣ What are Intents?
2️⃣ What is CoW Swap?
3️⃣ CoW Swap Architecture (Batch Auction, Solvers, CoWs, Ring Trade)
4️⃣ CoW Swap Features (CoW Hooks, TWAP Orders)
5️⃣ CoW Swap Benefits (Low Fees, MEV-Mitigation)
1/ What are Intents?
Intents refer to desired goals of users e.g. swap $ETH to $USDC
These intents are executed by sophisitcated 3rd parties (solvers), abstracting away the complex execution process from users
Learn more about intents in this tweet by @blockworksres
2/ What is CoW Swap?
An intent-based protocol, allowing users to enter their intents (tx output desired), and outsource execution to solvers
To achieve the above, let's dive into CoW Swap's architecture
β€’ Solvers
β€’ Coincidence of Wants (CoW)
β€’ Batch Auction
β€’ Ring Trade
3/ Solvers
Solvers utilize unique order fulfilment algorithms to provide optimal execution routes for maximizing user returns
The most optimal order fulfilment solution will be pushed on-chain, and the respective solver is rewarded in the form of $COW and execution surplus
4/ Batch Auction
Users submit their order off-chain on CoW Swap, which are aggregated into a batch and circulated to the solver network
Through batching, solvers identify overlapping orders (CoW) that can be filled without requiring external market makers or liquidity pools
5/ Coincidence of Wants (CoW)
But what are CoWs?
It is an economic phenomenon where 2 parties each hold an item the other wants, allowing them to carry out a direct exchange
This can be depicted with the following:
6/ Ring Trade
Batches typically involve more than 2 orders, where there might not be an exact CoW that allows for direct exchange
Instead of having to wait for an exact match between 2 orders to come along, ring trades allow for liquidity to be shared amongst various parties
7/ CoW Swap Features
With the innovative architecure, CoW Swap is able to offer unique features including:
(a) CoW hooks
(b) TWAP orders
Let's dive deep and understand the benefits of these features
8/ CoW Hooks
CoW hooks are custom code attached to an order that can be executed before and after a trade
They are extremely helpful in simplifying execution processes, as users can string together a series of complex actions and execute all actions in a single transaction
9/ CoW Hooks' Architecture
Pre-hooks
β€’ Intents executed prior to a swap on CoW Swap
β€’ Executed prior to tokens being sent from the user's address to CoW Swap
Post-hooks
β€’ Actions that are executed after swap
β€’ Swapped tokens have been transferred to the user's address
10/ CoW Hooks' Use Cases
CoW hooks have a variety of use cases
(a) NFT Sniping
β€’ Pre-hook: Sell NFT
β€’ Swap amount received to desired token
(b) Airdrop Claiming
β€’ Pre-hook: Claim airdrop
β€’ Swap: Airdrop token -> Desired token
(c) Automated LP Position
β€’ Shown in diagram
11/ TWAP Orders
Time-weighted average price (TWAP) is commonly used for large trade executions to reduce price impact, allowing users to swap at fairer rates
It works by taking a large order and splitting it into smaller orders, executed over regular intervals
12/ TWAP Orders' Mechanism
A TWAP order is made on CoW Swap by specifying the following:
(a) Asset of choice: Asset to swap out of and to swap into
(b) Total order size: Total swap amount
(c) No. of parts: No. of times the order is split into
(d) Duration: Execution period
13/ Benefits of TWAP Orders
(a) Reduced Price Impact
(b) Reduced Slippage
(c) Increased Flexibility
You can learn more about these in the full article!
shoal.gg
14/ CoW Swap Benefits
Moving on from the features, there are 2 important benefits brought about by CoW Swap's innovative architecture
(a) MEV-Resistance
(b) Low Fees
15/ What is Maximal Extractable Value (MEV)?
Profit earned by validators through arbitrage in the form of inclusion, exclusion and re-ordering of tx sequence during block building
It is often seen as a negative externality as it leads to unfavourable prices for users
16/ MEV-Resistance with CoW Swap
MEV-resistance is possible on CoW Swap because:
(a) By using CoWs, user txs are not sent to the public mempool, which is heavily monitored by arbitrage bots. Instead, user txs are matched off-chain and not subjected to tx order manipulation
17/ Continued
(b) Uniform clearing price (UCP) from batch auction
Sequential order execution on DEXs results in MEV when builders reorder the txs
With batch auctions, CoW Swap offers a mean settlement price and no value can be extracted from re-ordering
18/ Low Fees on CoW Swap
Achieved through:
(a) Off-Chain Signing
β€’ No need for gas when submitting orders
β€’ Impossible to have failed transactions and lost gas
(b) Coincidence of Wants Transactions
β€’ Direct matching of transactions do not incur a fee
19/ Conclusion
The CoW Swap team has constantly been shipping innovative products and has been successful in capturing a higher market share
With more attention on intent-based systems, it will be interesting to see how CoW Swap will retain users
shoal.gg
To learn more about the innovative market developments, do consider joining my Telegram group where I share daily reads: t.me
And if you enjoyed this thread, do check out my post on 1inch Fusion, another intent-based DEX:

Loading suggestions...