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)
BurnMessage V2 Format
Version 2 adds fee handling and hook support: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_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)
Format Burn Message for Relay (V2)
Source: ~/workspace/source/src/messages/v2/BurnMessageV2.sol:68-89_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
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.solV2 Getters
V2 inherits V1 getters and adds: Source: ~/workspace/source/src/messages/v2/BurnMessageV2.solV2 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-134V2 Validation
Source: ~/workspace/source/src/messages/v2/BurnMessageV2.sol:151-157TypedMemView 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
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 themessageBody field in Message:
See Also
- Message Format - Main message structure
- AddressUtils - Address conversion utilities
- TokenMessenger - Contract that creates burn messages
- TokenMinter - Contract that processes burn messages and mints tokens