Overview
This guide helps you migrate your CCTP integration from V1 to V2 contracts. V2 introduces breaking changes in function signatures and event structures that require code updates.Migration Checklist
- Review new V2 features and determine which to use
- Update
depositForBurnfunction calls with new parameters - Replace
depositForBurnWithCallerusage - Update event listeners for new event signatures
- Add fee calculation logic
- Configure new role addresses
- Update message handler interface (if applicable)
- Deploy or connect to V2 contracts
- Test integration thoroughly
API Changes
depositForBurn Function
ThedepositForBurn function signature has changed significantly.
V1 to V2 Comparison
Parameter Mapping
Migration Example
depositForBurnWithCaller Removal
depositForBurnWithCaller is removed in V2. Use depositForBurn with the destinationCaller parameter instead.
replaceDepositForBurn
If you rely on message replacement:- Alternative 1: Send a new message with updated parameters
- Alternative 2: Implement application-level message invalidation logic
- Alternative 3: Use hook data to encode conditional logic
Event Changes
DepositForBurn Event
The event signature has changed significantly.Event Structure Comparison
Migration Impact
Key Changes:- ❌
nonceremoved (was indexed) - ✅
minFinalityThresholdadded (indexed) - ✅
maxFeeadded - ✅
hookDataadded
Event Listener Migration
MintAndWithdraw Event
feeCollected field.
Fee Management
Calculating Fees
V2 requires fee calculation before callingdepositForBurn.
Fee Recipient
Set up fee collection:Zero Fee Transfers
To avoid fees entirely, use finalized messages:Finalized messages take longer to process but don’t incur fees.
Message Handler Interface
If you implement custom message handlers, update your interface.Interface Changes
Role Configuration
V2 introduces new administrative roles.Required Role Addresses
- V1 Roles
- V2 Roles
Role Responsibilities
Contract Interface Differences
New Functions in V2
Removed Functions in V2
Smart Contract Migration Example
Complete example showing V1 to V2 migration:Frontend Integration Changes
ethers.js v6 Example
Testing Your Migration
Test Checklist
1
Test Fee Calculation
2
Test Basic Transfer
3
Test Hook Transfer
4
Test Event Parsing
Common Migration Issues
Issue: “Insufficient max fee” Error
Cause:maxFee is less than the minimum required fee.
Solution: Call getMinFeeAmount() before depositForBurn():
Issue: Missing Nonce in V2
Cause: V2 doesn’t return nonce fromdepositForBurn().
Solution: Use transaction hash or event filtering instead:
Issue: “Caller is denylisted” Error
Cause: Calling address is on the protocol denylist. Solution: Check denylist status:Issue: Wrong destinationCaller Format
Cause: Using address instead of bytes32. Solution: Convert address to bytes32:Next Steps
V2 Deployment
Deploy V2 contracts to your network
TokenMessengerV2 API
Complete V2 API reference
Integration Guide
Build on CCTP V2
Testing Guide
Test your V2 integration