Settlement
CoW Protocol’s settlement mechanism executes batch auctions at uniform clearing prices, contrasting with traditional sequential AMM processing where each trade affects the next price.Uniform Pricing Model
Unlike AMMs where each trade impacts the next price, CoW Protocol uses a price vector where all trades in a batch settle at predetermined rates, ensuring equitable execution across participants. This eliminates MEV opportunities within batches, as all participants receive the same price for the same token pair.Core Settlement Function
Thesettle() function batches multiple orders and executes them atomically with identical clearing prices:
Three-Phase Execution
Settlement involves three interaction phases:- Pre-interactions - Setup tasks (e.g., permit approvals, token wrapping)
- Intra-interactions - DEX trades for liquidity sourcing (e.g., Uniswap, Balancer swaps)
- Post-interactions - Cleanup operations (e.g., token unwrapping, fee distribution)
Price Verification
Orders validate through the equation:Partial Fills
Orders can be markedpartiallyFillable, enabling gradual execution across multiple settlements for large positions. The filledAmount mapping tracks how much of each order has been filled, preventing overfilling.
Balancer Integration
Aswap() function provides optimized direct trading against Balancer V2 pools: