Contract Hierarchy
CCTP’s architecture is built on a modular contract design with clear separation of concerns:Core Contracts
TokenMessenger
Inheritance:Rescuable
Purpose: Entry point for users initiating cross-chain USDC transfers
Key Relationships:
- Calls
ITokenMinterto burn tokens on source chain and mint on destination - Calls
IMessageTransmitterto send cross-chain messages - Implements
IMessageHandlerto receive and process incoming messages - Maintains mapping of remote TokenMessenger contracts by domain
MessageTransmitter
Inheritance:Pausable, Rescuable, Attestable
Purpose: Handles cross-chain message sending, receiving, and attestation verification
Key Relationships:
- Invokes
IMessageHandler.handleReceiveMessage()on recipient contracts - Inherits attester management from
Attestable - Enforces pause controls for emergency situations
TokenMinter
Inheritance:TokenController, Pausable, Rescuable
Purpose: Manages token minting and burning operations with burn limits
Key Relationships:
- Only callable by authorized
localTokenMessenger - Interacts with
IMintBurnTokeninterface for actual mint/burn - Inherits token pair management from
TokenController
Role-Based Access Control
CCTP implements granular access control through specialized role contracts:Ownable2Step
Purpose: Two-step ownership transfer to prevent accidental loss of control Key Features:- Owner must propose new owner
- New owner must accept to complete transfer
- Prevents typos in address entry from permanently losing access
Pausable
Purpose: Emergency stop mechanism for security incidents Key Features:- Separate
pauserrole fromowner whenNotPausedmodifier blocks critical functions- Quick response capability without ownership transfer
TokenMessenger.depositForBurn()MessageTransmitter.sendMessage()andreceiveMessage()TokenMinter.mint()andburn()
Rescuable
Purpose: Recover accidentally sent ERC20 tokens Key Features:- Separate
rescuerrole fromowner - Can rescue any ERC20 token sent to contract
- Uses OpenZeppelin’s
SafeERC20for safe transfers
Attestable
Purpose: Manage authorized attesters and signature verification Key Features:- Maintains set of enabled attester addresses
- Configurable signature threshold (m-of-n multisig)
- Separate
attesterManagerrole - ECDSA signature recovery and validation
TokenController
Purpose: Manage token pair mappings and burn limits Key Features:- Links remote tokens to local tokens by domain
- Enforces per-message burn limits
- Separate
tokenControllerrole
Proxy Pattern for Upgradeability
All three core contracts (TokenMessenger, MessageTransmitter, TokenMinter) are deployed behindAdminUpgradableProxy contracts:
AdminUpgradableProxy
Purpose: Upgradeable proxy with admin-only upgrade functions Key Features:- Based on EIP-1967 transparent proxy pattern
- Admin calls don’t forward to implementation (prevents function selector clashes)
- Non-admin calls always forward to implementation
- Uses assembly for gas-efficient storage slot access
- Uses EIP-1967 standard storage slots to avoid collisions
- Admin slot:
keccak256("eip1967.proxy.admin") - 1 - Implementation slot:
keccak256("eip1967.proxy.implementation") - 1
Upgrade Process
- Deploy new implementation contract
- Admin calls
proxy.upgradeTo(newImplementation) - Proxy updates implementation storage slot
- All subsequent calls route to new implementation
- Existing storage and state preserved
Message Format
CCTP uses a fixed-format message structure defined inMessage.sol:
| Field | Bytes | Type | Index |
|---|---|---|---|
| version | 4 | uint32 | 0 |
| sourceDomain | 4 | uint32 | 4 |
| destinationDomain | 4 | uint32 | 8 |
| nonce | 8 | uint64 | 12 |
| sender | 32 | bytes32 | 20 |
| recipient | 32 | bytes32 | 52 |
| destinationCaller | 32 | bytes32 | 84 |
| messageBody | dynamic | bytes | 116 |
- Fixed-size fields prevent hash collisions
destinationCallerenables permissioned receiving- Dynamic
messageBodysupports custom burn message formats
Cross-Domain Communication
CCTP enables token transfers between domains through coordinated contract interactions:Security Architecture
Multiple layers ensure system security:- Access Control: Role-based permissions limit critical operations
- Attestation: Multi-signature validation prevents unauthorized mints
- Nonce Tracking: Replay attack prevention per (domain, nonce) pair
- Burn Limits: Per-message caps limit damage from compromised keys
- Pause Controls: Emergency stop for security incidents
- Upgradeability: Fix vulnerabilities without redeployment
- Domain Validation: Ensure messages route to correct chains
Next Steps
Message Flow
Follow a transfer through the complete lifecycle
Attestation
Deep dive into signature verification