craft_cctp_message

Documentation for eth_defi.cctp.testing.craft_cctp_message function.

craft_cctp_message(source_domain, destination_domain, nonce, mint_recipient, amount, burn_token, min_finality_threshold=2000)

Craft a CCTP V2 message for testing receiveMessage() on forks.

Builds a valid CCTP V2 message header + burn message body using abi.encodePacked format matching Circle’s on-chain encoding.

Message header (148 bytes):

  • uint32 version (4 bytes)

  • uint32 sourceDomain (4 bytes)

  • uint32 destinationDomain (4 bytes)

  • bytes32 nonce (32 bytes)

  • bytes32 sender (32 bytes) — TokenMessenger on source

  • bytes32 recipient (32 bytes) — TokenMessenger on dest

  • bytes32 destinationCaller (32 bytes) — 0x00 for anyone

  • uint32 minFinalityThreshold (4 bytes)

  • uint32 finalityThresholdExecuted (4 bytes)

Burn message body (228 bytes):

  • uint32 version (4 bytes)

  • bytes32 burnToken (32 bytes)

  • bytes32 mintRecipient (32 bytes)

  • uint256 amount (32 bytes)

  • bytes32 messageSender (32 bytes)

  • bytes32 maxFee (32 bytes) — 0 for standard

  • bytes32 feeExecuted (32 bytes) — 0 (set by attester)

  • bytes32 expirationBlock (32 bytes) — 0 (set by attester)

Parameters
  • source_domain (int) – CCTP domain of the source chain (e.g. 0 for Ethereum)

  • destination_domain (int) – CCTP domain of the destination chain (e.g. 6 for Base)

  • nonce (int) – Unique nonce (must not have been used before on this chain)

  • mint_recipient (Union[eth_typing.evm.HexAddress, str]) – Address to receive minted USDC on the destination chain

  • amount (int) – Amount of USDC in raw units (6 decimals)

  • burn_token (Union[eth_typing.evm.HexAddress, str]) – USDC address on the source chain

  • min_finality_threshold (int) – Finality threshold (2000 for standard, 1000 for fast)

Returns

Packed message bytes (376 bytes total)

Return type

bytes