Circle CCTP v2 on Optimism
Deployments
Action: bridge
Parameters
Name | Type | Description |
---|---|---|
targets | string[] (required) | Destination Chains prefixes | Chains descriptions |
recipient | string (required) | Recipient address on the destination chain(s) |
The source and destination blockchains cannot be the same. If the same
blockchain is provided in the targets
parameter, an error will be thrown.
USDC · approve
Approve TokenMessenger
to spend USDC
tokens on behalf of the avatar.
-
Contract:
USDC
-
Function:
approve(address,uint256)
Parameter Constraint spender
equal to TokenMessenger
amount
-
TokenMessenger · depositForBurn
Bridge USDC
tokens to the recipient
address on the destination blockchain.
-
Contract:
TokenMessenger
-
Function:
depositForBurn(uint256,uint32,bytes32,address,bytes32,uint256,uint32)
Parameter Constraint amount
- destinationDomain
equal to DOMAIN
(see reference table below)mintRecipient
equal to recipient
(left-padded with zeros to 32 bytes)burnToken
equal to USDC
destinationCaller
- maxFee
- minFinalityThreshold
-
Blockchain-to-Domain Mapping:
Blockchain | Domain |
---|---|
Ethereum | 0 |
Optimism | 2 |
Arbitrum | 3 |
Base | 6 |
Action: receive
Parameters
Name | Type | Description |
---|---|---|
targets | string[] (required) | Source Chains prefixes | Chains descriptions |
sender | string (required) | Sender address on the source chain(s) |
recipient | string (required) | Recipient address on the destination chain(s) |
The source and destination blockchains cannot be the same. If the same
blockchain is provided in the targets
parameter, an error will be thrown.
TokenMessenger · receiveMessage
Claim USDC
tokens for the recipient
address on the destination blockchain.
- Contract:
TokenMessenger
- Function:
receiveMessage(bytes,bytes)
Parameter | Constraint |
---|---|
message | See breakdown below |
attestation | - |
Breakdown of message
Parameter Scoping
The message
parameter contains structured data that is scoped to enforce specific values. The table below details how each part is extracted and validated.
Field | Bytes (from/to) | Scoped | Description |
---|---|---|---|
Version | 0-3 | No | Message format version |
Source Domain | 4-7 | Yes | Expected source blockchain domain |
Destination Domain | 8-11 | Yes | Expected destination blockchain domain |
Nonce | 12-43 | No | Unique transaction identifier |
Source Token Messenger Address | 44-75 | Yes | Token Messenger on the source blockchain (12-byte zero-padding + 20-byte address) |
Destination Token Messenger Address | 76-107 | Yes | Token Messenger on the destination blockchain (12-byte zero-padding + 20-byte address) |
Destination Caller | 108-139 | No | Authorized caller on the destination domain |
Minimum Finality Threshold | 140-143 | No | The minimum finality at which a burn message will be attested to |
Finality Threshold Executed | 144-147 | No | The finality threshold at which the message was attested to |
Selector | 148-151 | No | Function selector |
Bridged Token Address (USDC) | 152-183 | Yes | USDC token address on the source blockchain (12-byte zero-padding + 20-byte address) |
Recipient Address | 184-215 | Yes | Actual recipient address (12-byte zero-padding + 20-byte address) |
Amount | 216-247 | No | Bridged amount |
Sender Address | 248-279 | Yes | Actual sender address (12-byte zero-padding + 20-byte address) |