What is ComposableCoW?
ComposableCoW is a powerful framework for creating conditional orders on CoW Protocol. It provides a unified interface for stateless, composable conditional orders that execute automatically when predefined conditions are met. Conditional orders are smart contract-based trading strategies that monitor on-chain conditions and generate discrete orders for CoW Protocol when those conditions are satisfied. ComposableCoW is designed to work seamlessly with Safe multisigs and theExtensibleFallbackHandler, providing secure and flexible automated trading capabilities.
ComposableCoW is the evolution of the
conditional-smart-orders project, offering improved composability and extensibility.Why Use ComposableCoW?
Automated Trading Strategies
Execute complex trading strategies without manual intervention. Set your conditions once and let the protocol handle the rest.Composable Order Types
ComposableCoW supports multiple order types out of the box:- TWAP (Time-Weighted Average Price): Split large orders into smaller parts executed over time
- Good After Time: Orders that become valid after a specific timestamp
- Stop Loss: Automatically sell when price falls below a threshold using oracle data
- Trade Above Threshold: Execute trades when token balance exceeds a minimum
- Perpetual Stable Swap: Continuously maintain stable token positions
Safe Integration
Built specifically for Safe multisigs with strong security guarantees. Your funds remain under the full control of your Safe while enabling automated trading.Gas Efficient
Orders are stateless and validated off-chain by watchtowers. Only successful trades result in on-chain transactions, minimizing gas costs.Extensible Architecture
Create custom conditional order types by implementing theIConditionalOrder interface. The framework is designed for maximum flexibility.
Key Features
Two Authorization Modes
ComposableCoW supports two ways to authorize conditional orders:Single Orders
Create individual conditional orders by calling
ComposableCoW.create(). Ideal for simple use cases with a few orders.Merkle Trees
Authorize multiple orders efficiently using a Merkle root. Perfect for managing large numbers of conditional orders with minimal on-chain storage.
Swap Guards
Implement additional validation logic with swap guards. These optional contracts provide extra security by verifying orders before execution:On-Chain Context Storage
Store dynamic values on-chain using the “cabinet” storage system. This allows conditional orders to reference time-dependent data like order creation timestamps:Watchtower Integration
When creating orders withdispatch = true, events are emitted that watchtowers monitor. Watchtowers continuously check if conditional orders can generate valid discrete orders and submit them to the CoW Protocol API automatically.
How It Works
Setup Safe
Configure your Safe with
ExtensibleFallbackHandler and set ComposableCoW as the domain verifier for CoW Protocol orders.Create Conditional Order
Define your order parameters including the handler (order type), a unique salt, and static input data specific to your strategy.
Authorize the Order
Use either
create() for single orders or setRoot() for Merkle tree-based authorization.Watchtowers Monitor
Watchtowers continuously check if your conditional order can generate a valid discrete order.
Deployed Contracts
ComposableCoW is deployed across multiple networks:| Contract | Address |
|---|---|
| ExtensibleFallbackHandler | 0x2f55e8b20D0B9FEFA187AA7d00B6Cbe563605bF5 |
| ComposableCoW | 0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74 |
| TWAP | 0x6cF1e9cA41f7611dEf408122793c358a3d11E5a5 |
| GoodAfterTime | 0xdaf33924925e03c9cc3a10d434016d6cfad0add5 |
| StopLoss | 0x412c36e5011cd2517016d243a2dfb37f73a242e7 |
| PerpetualStableSwap | 0x519BA24e959E33b3B6220CA98bd353d8c2D89920 |
| TradeAboveThreshold | 0x812308712a6d1367f437e1c1e4af85c854e1e9f6 |
These addresses are consistent across Ethereum Mainnet, Gnosis Chain, Sepolia, Arbitrum One, Base, BSC, Avalanche, Optimism, Polygon, and Lens.
Security
ComposableCoW has been audited by:- Ackee Blockchain: CoW Protocol - ComposableCoW and ExtensibleFallbackHandler
- Gnosis Internal Audit (May/July 2023): ComposableCoW initial review
- Gnosis Internal Audit (August 2024): ComposableCoW diff review
audits/ directory.
Next Steps
Quickstart
Follow our step-by-step guide to create your first conditional order
Architecture
Dive deep into the system design and component interactions