Deployment Methods
There are two primary deployment approaches:- Script-based deployment: Fast and flexible for testing or new contract types
- Deterministic CREATE2 deployment: Ensures identical addresses across all networks (production method)
Prerequisites
Environment Setup
Copy the example environment file and configure variables:.env
The
SETTLEMENT address varies by network. For Ethereum Mainnet, use 0x9008D19f58AAbD9eD0D60971565AA8510560ab41.Install Dependencies
Ensure Foundry is installed:Script-Based Deployment
Deploy Full Production Stack
Deploy all contracts in a single transaction:ExtensibleFallbackHandlerComposableCoW- Order types:
TWAP,GoodAfterTime,PerpetualStableSwap,TradeAboveThreshold,StopLoss - Utilities:
CurrentBlockTimestampFactory
Deploy Individual Contracts
Deploy ComposableCoW Only
Deploy Order Types Only
For order types deployment, ensure
COMPOSABLE_COW is set in your .env file.Script Details
Deterministic CREATE2 Deployment
For production deployments with consistent addresses across networks:Process
- Find an existing deployment transaction on another network (e.g., ExtensibleFallbackHandler on Mainnet)
- Navigate to the transaction and click “Click to show more”
- Copy the “Input Data” in Original format
- Copy the “to” address
- Use a transaction tool (e.g., swiss-knife) to submit the transaction
- The contract will be deployed to the same deterministic address
This method ensures all contracts are deployed at the same addresses across networks, as shown in the networks page.
Why Deterministic Deployment?
Benefits of CREATE2 deployment:- Consistent addresses across all networks
- Simplified integration and documentation
- Predictable contract locations
- Enhanced user trust through verifiable deployment patterns
Contract Verification
Automatic Verification
Verify all contracts automatically after deployment:Manual Verification
If automatic verification fails, use Standard JSON Input:- Locate the verification file in
broadcast/StandardJsonInput/ - Follow instructions in broadcast/StandardJsonInput/README.md
Verification Requirements
Local Deployment
Deploy to Anvil
For local integration testing with Watch Tower:1. Start Anvil
The
--code-size-limit flag is required when deploying the full stack due to the Balancer Vault contract size.2. Deploy Stack
- CoW Protocol stack (Settlement, Vault, Authentication)
- Safe contract infrastructure
- ComposableCoW and order types
- A test Safe contract
The Safe address will be printed in the deployment output. Save this for testing.
3. Submit Test Order
Create a single test order:Post-Deployment
Verify Deployment
Check deployed contract code:Update Network Registry
Add deployment addresses tonetworks.json:
Broadcast Directory
Deployment artifacts are stored in thebroadcast/ directory:
Network-Specific Considerations
Gnosis Chain
Gnosis Chain has a different gas model. Adjust gas parameters if needed:Layer 2 Networks
For L2s (Arbitrum, Optimism, Base), ensure you’re using the correct RPC endpoint and have sufficient ETH for gas:Troubleshooting
Transaction Underpriced
Increase gas price:Nonce Too Low
Reset your nonce:Contract Size Exceeded
Enable optimizer infoundry.toml:
Next Steps
- View deployed network addresses
- Learn about testing procedures
- Explore order types