Overview
CCTP V2 contracts use a CREATE2-based deployment strategy to ensure deterministic addresses across chains. The deployment process involves:- Create2Factory: Deploy factory for deterministic deployments
- Implementation Contracts: Deploy logic contracts
- Proxy Contracts: Deploy proxies pointing to implementations
- Setup Remote Resources: Configure cross-chain connections
- Key Rotation (Mainnet only): Rotate administrative keys
- AddressUtilsExternal: Deploy helper library
scripts/v2/ directory.Prerequisites
- Foundry CLI installed (forge 0.2.0)
- Git submodules initialized:
git submodule update --init --recursive - Node.js and Yarn installed:
yarn install - Sufficient funds in deployer accounts for gas
Deployment Steps
Step 1: Deploy Create2Factory
The Create2Factory enables deterministic address deployment across chains.Configure Environment
.env file:CREATE2_FACTORY_OWNER: Address that will own the Create2Factory
Simulate Deployment
SENDER should match the address derived from CREATE2_FACTORY_OWNER_KEY.Deploy Factory
scripts/v2/DeployCreate2Factory.s.sol
Step 2: Deploy V2 Implementation Contracts
Deploy the logic contracts that proxies will delegate to.Configure Environment
.env file:CREATE2_FACTORY_CONTRACT_ADDRESS: Address from Step 1TOKEN_MINTER_V2_OWNER_KEY: Private key for TokenMinter ownerTOKEN_CONTROLLER_ADDRESS: Token controller addressDOMAIN: Local domain ID (e.g., 0 for Ethereum, 1 for Avalanche)MESSAGE_BODY_VERSION: Message format version (typically 1)VERSION: Protocol version (typically 2)
Simulate Deployment
Deploy Implementations
- MessageTransmitterV2 implementation
- TokenMessengerV2 implementation
- TokenMinterV2 implementation
scripts/v2/DeployImplementationsV2.s.sol
Step 3: Deploy V2 Proxies
Deploy proxy contracts with full initialization.Configure Environment
.env:TOKEN_MESSENGER_V2_FEE_RECIPIENT_ADDRESS: Receives collected feesTOKEN_MESSENGER_V2_DENYLISTER_ADDRESS: Manages protocol denylistTOKEN_MESSENGER_V2_MIN_FEE_CONTROLLER_ADDRESS: Sets minimum feesTOKEN_MESSENGER_V2_MIN_FEE: Initial minimum fee in 1/1000 basis points
Simulate Deployment
Deploy Proxies
- MessageTransmitterV2 proxy
- TokenMessengerV2 proxy
- TokenMinterV2 proxy
scripts/v2/DeployProxiesV2.s.sol
Step 4: Setup Additional Remote Resources
Configure Environment
.env with additional remote configuration:Simulate Setup
Setup Remote Resources
- Links remote TokenMessenger
- Configures remote USDC token pair
Repeat for Each Remote Chain
scripts/v2/SetupRemoteResourcesV2.s.sol
Step 5: Key Rotation (Mainnet Only)
Configure Environment
.env file:Simulate Key Rotation
Rotate Keys
scripts/v2/RotateKeysV2.s.sol
Step 6: Deploy AddressUtilsExternal
Deploy the helper library for easy integration.Configure Environment
CREATE2_FACTORY_CONTRACT_ADDRESS is set in .env:Simulate Deployment
Deploy AddressUtilsExternal
AddressUtilsExternal to a deterministic address for easy integration.scripts/v2/DeployAddressUtilsExternal.s.sol
Predicting CREATE2 Addresses
You can predict deployment addresses before deploying:scripts/v2/PredictCreate2Deployments.s.sol
Role Configuration Summary
MessageTransmitterV2 Roles
TokenMessengerV2 Roles
TokenMinterV2 Roles
Environment Variables Checklist
Step 1: Create2Factory
Step 1: Create2Factory
Step 2: Implementation Contracts
Step 2: Implementation Contracts
Step 3: Proxy Deployment
Step 3: Proxy Deployment
Step 4: Additional Remote Resources
Step 4: Additional Remote Resources
Step 5: Key Rotation (Mainnet)
Step 5: Key Rotation (Mainnet)
Step 6: AddressUtilsExternal
Step 6: AddressUtilsExternal
Post-Deployment Verification
After deployment, verify:Contract Addresses
- Create2Factory
- MessageTransmitterV2 (implementation & proxy)
- TokenMessengerV2 (implementation & proxy)
- TokenMinterV2 (implementation & proxy)
- AddressUtilsExternal
Role Configuration
Remote Configuration
Fee Configuration
Troubleshooting
Simulation Fails
- Verify all environment variables are set correctly
- Check that SENDER has sufficient funds for gas
- Ensure RPC_URL is accessible and correct
- Verify private keys match expected addresses
CREATE2 Address Mismatch
- Ensure Create2Factory address is consistent across chains
- Verify constructor parameters match exactly
- Check that salt values are identical
Initialization Fails
- Verify all role addresses are non-zero
- Check that remote arrays have equal length
- Ensure owner address is set correctly
Remote Resources Not Linking
- Verify remote domain IDs are correct
- Check that remote TokenMessenger addresses are bytes32 format
- Ensure TokenMinter has correct token pairs configured