Contract responsibilities
- TokenMessengerV2: Entrypoint for cross-chain USDC transfer. Routes messages to burn USDC on a source chain, and mint USDC on a destination chain.
- MessageTransmitterV2: Generic message passing. Sends all messages on the source chain, and receives all messages on the destination chain.
- TokenMinterV2: Responsible for minting and burning USDC. Contains chain-specific settings used by burners and minters.
- MessageV2: Provides helper functions for cross-chain transfers, such as
bytes32ToAddressandaddressToBytes32, which are commonly used when bridging between EVM and non-EVM chains. These conversions are simple: prepend 12 zero bytes to an EVM address, or strip them to convert back.
Note: If you’re writing your own integration, it’s more gas-efficient to
include this logic directly in your contract
rather than calling an external one.
Mainnet contract addresses
TokenMessengerV2: Mainnet
MessageTransmitterV2: Mainnet
TokenMinterV2: Mainnet
MessageV2: Mainnet
Testnet contract addresses
TokenMessengerV2: Testnet
MessageTransmitterV2: Testnet
TokenMinterV2: Testnet
MessageV2: Testnet
CCTP V2 Interface
This section provides the Smart Contract Interface exposed by CCTP V2, outlining the available functions, and their parameters. The interface below serves as a reference for permissionless messaging functions exposed by the TokenMessengerV2 and MessageTransmitterV2 functions.Changes from CCTP V1
New functions
TokenMessengerV2#depositForBurnWithHook(extendsdepositForBurnby adding hook data)TokenMessengerV2#handleReceiveUnfinalizedMessage(replaceshandleReceiveMessage)TokenMessengerV2#handleReceiveFinalizedMessage(replaceshandleReceiveMessage)
Modified functions
TokenMessengerV2#depositForBurnMessageTransmitterV2#sendMessageMessageTransmitterV2#receiveMessage
Removed functions
TokenMessengerV2#handleReceiveMessageTokenMessengerV2#replaceDepositForBurnTokenMessengerV2#depositForBurnWithCallerMessageTransmitterV2#replaceMessageMessageTransmitterV2#sendMessageWithCaller
TokenMessengerV2
depositForBurn
Deposits and burns tokens from sender to be minted on destination domain, and emits a cross-chain message by calling MessageTransmitter’ssendMessage
function. Minted tokens will be transferred to mintRecipient.
Parameters
depositForBurnWithHook
Deposits and burns tokens from sender to be minted on destination domain, and emits a cross-chain message with additional hook data appended. In addition to the standarddepositForBurn parameters, depositForBurnWithHook accepts a
dynamic-length hookData parameter, allowing the caller to include additional
metadata to the attested message, which can be used to trigger custom logic on
the destination chain.
Parameters
getMinFeeAmount
Calculates and returns the minimum fee required for a given amount in a Standard Transfer. If theminFee (per unit of burnToken) is non-zero, the specified
maxFee must be at least the returned minimum fee. Otherwise, the burn will
revert onchain.
Parameters
handleReceiveFinalizedMessage
Handles incoming message received by the local MessageTransmitter, and takes the appropriate action. For a burn message, mints the associated token to the requested recipient on the local domain. Validates the function sender is the local MessageTransmitter, and the remote sender is a registered remote TokenMessenger forremoteDomain.
Parameters
handleReceiveUnfinalizedMessage
Handles incoming message received by the local MessageTransmitter, and takes the appropriate action. For a burn message, mints the associated token to the requested recipient on the local domain. Validates the function sender is the local MessageTransmitter, and the remote sender is a registered remote TokenMessenger forremoteDomain.
Similar to handleReceiveFinalizedMessage, but is called for messages which are
not finalized (finalityThresholdExecuted < 2000).
Unlike handleReceiveFinalizedMessage, handleReceiveUnfinalizedMessage has
the following messageBody parameters:
expirationBlock. IfexpirationBlock≤blockNumberon the destination domain, the message will revert and must be re-signed without the expiration block.feeExecuted. If nonzero, thefeeExecutedis minted to thefeeRecipient.
MessageTransmitterV2
receiveMessage
Receive message on destination chain by passing message and attestation. EmitsMessageReceived event. Messages with a given nonce can only be broadcast
successfully once for a pair of domains. The message body of a valid message is
passed to the specified recipient for further processing.
Parameters
sendMessage
Sends a message to the recipient on the destination domain. Emits aMessageSent event which will be attested by Circle’s attestation service.
Parameters
CCTP V2 Workflow vs. CCTP V1
This table highlights the key workflow improvements of CCTP V2 over CCTP V1 in terms of enhanced cross-chain messaging, fewer manual steps, and greater control over message acceptance:WHAT’S NEXT