Skip to main content
The BurnMessage library defines the format for the message body used in CCTP token transfers. This message is embedded within the main Message’s messageBody field.

BurnMessage Structure

uint32
required
Message body version (4 bytes)
bytes32
required
Address of the burned token on the source domain (32 bytes, starting at index 4)
bytes32
required
Address that will receive minted tokens on destination domain (32 bytes, starting at index 36)
uint256
required
Amount of tokens burned (32 bytes, starting at index 68)
bytes32
required
Address that initiated the burn (32 bytes, starting at index 100)

Memory Layout (V1)

Source: ~/workspace/source/src/messages/BurnMessage.sol:23-30

BurnMessage V2 Format

Version 2 adds fee handling and hook support:
Source: ~/workspace/source/src/messages/v2/BurnMessageV2.sol:26-37

V2 Additions

uint256
Maximum fee the sender is willing to pay on the destination domain (32 bytes, starting at index 132)
uint256
Actual fee charged during execution (set to 0 during message creation, populated on destination)
uint256
Block number after which the message expires (set to 0 during message creation)
bytes
Optional dynamic data passed to hooks for custom processing on destination domain

Encoding Functions

Format Burn Message (V1)

Source: ~/workspace/source/src/messages/BurnMessage.sol:57-72
Creates a V1 burn message with exactly 132 bytes. Parameters:
  • _version: Message body version
  • _burnToken: Burned token address on source domain (as bytes32)
  • _mintRecipient: Recipient address on destination domain (as bytes32)
  • _amount: Amount burned
  • _messageSender: Address that initiated the burn (as bytes32)
Returns: Formatted 132-byte burn message

Format Burn Message for Relay (V2)

Source: ~/workspace/source/src/messages/v2/BurnMessageV2.sol:68-89
Creates a V2 burn message with fee and hook support. Parameters:
  • _version: Message body version
  • _burnToken: Burned token address (as bytes32)
  • _mintRecipient: Recipient address (as bytes32)
  • _amount: Amount burned
  • _messageSender: Initiator address (as bytes32)
  • _maxFee: Maximum fee for destination processing
  • _hookData: Optional hook data for custom logic
Returns: Formatted burn message (minimum 228 bytes + hookData length)
feeExecuted and expirationBlock are set to 0 during message creation. These fields are populated during attestation and execution.

Decoding Functions

V1 Getters

Source: ~/workspace/source/src/messages/BurnMessage.sol

V2 Getters

V2 inherits V1 getters and adds: Source: ~/workspace/source/src/messages/v2/BurnMessageV2.sol
V2 uses BurnMessage as a library dependency, calling V1 functions internally (e.g., _message._getVersion()).

Validation

V1 Validation

Source: ~/workspace/source/src/messages/BurnMessage.sol:131-134
Enforces exactly 132 bytes for V1 messages.

V2 Validation

Source: ~/workspace/source/src/messages/v2/BurnMessageV2.sol:151-157
Enforces minimum 228 bytes (allows variable-length hookData).

TypedMemView Usage

BurnMessage uses TypedMemView for efficient parsing:
  • indexUint(offset, length): Reads uint256/uint32 at byte offset
  • index(offset, length): Reads bytes32 at byte offset
  • slice(offset, length, type): Extracts subview for hookData
See TypedMemView documentation for details.

Example Usage

Encoding a V1 BurnMessage

Encoding a V2 BurnMessage with Hooks

Decoding a BurnMessage

Decoding V2 with Fee and Hook Data

Integration with Message

BurnMessage is embedded as the messageBody field in Message:

See Also