Skip to main content

New Features

Fee Support

V2 introduces a comprehensive fee mechanism for cross-chain transfers.

Fee Parameters

maxFee (New in depositForBurn) Specifies the maximum fee willing to pay on the destination domain:
Reference: src/v2/TokenMessengerV2.sol:166

Fee Recipient

Configurable address to receive collected fees:
Fees are automatically minted to the feeRecipient when processing unfinalized messages. Reference: src/v2/BaseTokenMessenger.sol:222

Minimum Fee Control

Protocol can enforce minimum fee requirements:
The minimum fee is validated on the source domain:
Reference: src/v2/BaseTokenMessenger.sol:232-244

Fee Calculation

Where MIN_FEE_MULTIPLIER = 10_000_000 for 1/1000 basis point precision. Reference: src/v2/TokenMessengerV2.sol:299-319

Hook Execution

V2 introduces the hookData parameter for custom logic execution on the destination domain.

depositForBurnWithHook

Reference: 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

Finality Thresholds

V2 introduces configurable finality requirements for flexible security/speed tradeoffs.

Finality Constants

Reference: src/v2/FinalityThresholds.sol

Message Handlers

V2 introduces two message handler functions:
Reference: src/v2/TokenMessengerV2.sol:245-292

Finality Validation

TokenMessenger rejects messages attested below the minimum threshold (500). Reference: src/v2/TokenMessengerV2.sol:286-289

Denylist Functionality

V2 adds protocol-level denylist capabilities.

Denylistable Role

New Denylistable contract provides denylist functionality:
Reference: src/roles/v2/Denylistable.sol

Denylist Management

Protected Functions

The notDenylistedCallers modifier protects:
  • depositForBurn()
  • depositForBurnWithHook()
Denylisted addresses cannot initiate cross-chain burns. Reference: src/v2/TokenMessengerV2.sol:174

API Changes

depositForBurn Signature

Breaking Change: V2 requires additional parameters. Use bytes32(0) for destinationCaller to allow any caller.

depositForBurnWithCaller

depositForBurnWithCaller() is removed in V2. Use depositForBurn() with destinationCaller parameter instead.

Event Signature Changes

DepositForBurn Event

Key Differences:
  • nonce removed from V2 event (no longer indexed)
  • maxFee added
  • minFinalityThreshold added (indexed)
  • hookData added
  • Index changes: V1 indexes nonce, V2 indexes minFinalityThreshold
Reference: src/v2/TokenMessengerV2.sol:62-73

MintAndWithdraw Event

Reference: src/v2/BaseTokenMessenger.sol:84-89

Message Handler Interface

Reference: src/interfaces/v2/IMessageHandlerV2.sol

Contract Architecture Changes

Base Contracts

V2 introduces base contracts for shared functionality:
Reference: src/v2/BaseTokenMessenger.sol

Initializable Pattern

V2 uses OpenZeppelin’s initializer pattern instead of direct constructor initialization:
Reference: src/v2/TokenMessengerV2.sol:84-142

CREATE2 Deployment

V2 uses CREATE2 for deterministic addresses:
Reference: src/v2/Create2Factory.sol

TokenMinter Changes

Dual-Recipient Mint

V2 TokenMinter supports minting to two recipients (for fee collection):
Reference: src/v2/TokenMinterV2.sol:54

Message Format Changes

V2 uses a new burn message format:
Reference: src/messages/v2/BurnMessageV2.sol

State Variables

New State Variables

Reference: 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