New Features
Fee Support
V2 introduces a comprehensive fee mechanism for cross-chain transfers.Fee Parameters
maxFee (New indepositForBurn)
Specifies the maximum fee willing to pay on the destination domain:
src/v2/TokenMessengerV2.sol:166
Fee Recipient
Configurable address to receive collected fees:feeRecipient when processing unfinalized messages.
Reference: src/v2/BaseTokenMessenger.sol:222
Minimum Fee Control
Protocol can enforce minimum fee requirements:src/v2/BaseTokenMessenger.sol:232-244
Fee Calculation
MIN_FEE_MULTIPLIER = 10_000_000 for 1/1000 basis point precision.
Reference: src/v2/TokenMessengerV2.sol:299-319
Hook Execution
V2 introduces thehookData parameter for custom logic execution on the destination domain.
depositForBurnWithHook
src/v2/TokenMessengerV2.sol:210
Hook Data Requirements
- Must be non-empty (length > 0)
- Included in burn message body
- Interpreted by destination domain recipient or relayer
- Application-specific format
Hook Use Cases
- Automated Swap
- Conditional Transfer
- Multi-Recipient
Finality Thresholds
V2 introduces configurable finality requirements for flexible security/speed tradeoffs.Finality Constants
src/v2/FinalityThresholds.sol
Message Handlers
V2 introduces two message handler functions:src/v2/TokenMessengerV2.sol:245-292
Finality Validation
src/v2/TokenMessengerV2.sol:286-289
Denylist Functionality
V2 adds protocol-level denylist capabilities.Denylistable Role
NewDenylistable contract provides denylist functionality:
src/roles/v2/Denylistable.sol
Denylist Management
Protected Functions
ThenotDenylistedCallers modifier protects:
depositForBurn()depositForBurnWithHook()
src/v2/TokenMessengerV2.sol:174
API Changes
depositForBurn Signature
bytes32(0) for destinationCaller to allow any caller.
depositForBurnWithCaller
Event Signature Changes
DepositForBurn Event
nonceremoved from V2 event (no longer indexed)maxFeeaddedminFinalityThresholdadded (indexed)hookDataadded- Index changes: V1 indexes
nonce, V2 indexesminFinalityThreshold
src/v2/TokenMessengerV2.sol:62-73
MintAndWithdraw Event
src/v2/BaseTokenMessenger.sol:84-89
Message Handler Interface
src/interfaces/v2/IMessageHandlerV2.sol
Contract Architecture Changes
Base Contracts
V2 introduces base contracts for shared functionality:src/v2/BaseTokenMessenger.sol
Initializable Pattern
V2 uses OpenZeppelin’s initializer pattern instead of direct constructor initialization:src/v2/TokenMessengerV2.sol:84-142
CREATE2 Deployment
V2 uses CREATE2 for deterministic addresses:src/v2/Create2Factory.sol
TokenMinter Changes
Dual-Recipient Mint
V2 TokenMinter supports minting to two recipients (for fee collection):src/v2/TokenMinterV2.sol:54
Message Format Changes
V2 uses a new burn message format:- V1 BurnMessage
- V2 BurnMessage
src/messages/v2/BurnMessageV2.sol
State Variables
New State Variables
src/v2/BaseTokenMessenger.sol:104-114
Next Steps
Migration Guide
Learn how to migrate from V1 to V2
Deployment
Deploy V2 contracts to your network
TokenMessengerV2 API
Complete API reference
Integration Guide
Integrate V2 into your application