Skip to content
Lattice

CCTPBridgeAdapterLib Constants

Git Source

CCTP_BRIDGE_ADAPTER_STORAGE_SLOT

keccak256(abi.encode(uint256(keccak256("lattice.storage.CCTPBridgeAdapter")) - 1)) & ~bytes32(uint256(0xff)).

bytes32 constant CCTP_BRIDGE_ADAPTER_STORAGE_SLOT = 0x94bcfd23a6ef7deebf3dfac9da6ba8c390ae8a620c8a163523fd263b20958b00;

ERC165_MAP_ICCTPBRIDGEADAPTER_SLOT

0xf5187bdc is type(ICCTPBridgeAdapter).interfaceId. keccak256(abi.encode(bytes4(0xf5187bdc), 0x9ca7f3e2e2bfb15fdf072b85dde92837cddacee6cf2f6b38cd06c9457c1c4200)).

bytes32 constant ERC165_MAP_ICCTPBRIDGEADAPTER_SLOT =
    0x04cddf593d633f3c8537926f8f726adaafc298a0f78a2bfd4848abb0191103e1;

HOOK_MAGIC

The leading 4 bytes that mark a hookData blob as a Lattice CCTP hook envelope (HOOK_MAGIC ‖ target(20) ‖ payload). bytes4(keccak256("lattice.cctp.hookdata.v1")).

bytes4 constant HOOK_MAGIC = 0xf43059e4;

_MSG_VERSION

uint256 constant _MSG_VERSION = 0;

_MSG_SOURCE_DOMAIN

uint256 constant _MSG_SOURCE_DOMAIN = 4;

_MSG_NONCE

uint256 constant _MSG_NONCE = 12;

_MSG_SENDER

uint256 constant _MSG_SENDER = 44;

_MSG_RECIPIENT

uint256 constant _MSG_RECIPIENT = 76;

_MSG_BODY

uint256 constant _MSG_BODY = 148;

_BODY_MINT_RECIPIENT

uint256 constant _BODY_MINT_RECIPIENT = 36;

_BODY_AMOUNT

uint256 constant _BODY_AMOUNT = 68;

_BODY_SENDER

uint256 constant _BODY_SENDER = 100;

_BODY_FEE_EXECUTED

uint256 constant _BODY_FEE_EXECUTED = 164;

_BODY_HOOK_DATA

uint256 constant _BODY_HOOK_DATA = 228;

_MSG_MIN_HOOK_LENGTH

A message shorter than header+body-up-to-hookData (_MSG_BODY + _BODY_HOOK_DATA = 376) cannot be a BurnMessageV2 carrying a hook.

uint256 constant _MSG_MIN_HOOK_LENGTH = 376;

_CCTP_VERSION_V2

CCTP v2 header AND BurnMessageV2 body version discriminants (both are 1).

uint32 constant _CCTP_VERSION_V2 = 1;

_HOOK_ENVELOPE_MIN

A valid Lattice hook envelope is at least HOOK_MAGIC (4) ‖ target (20) = 24 bytes.

uint256 constant _HOOK_ENVELOPE_MIN = 24;