API Version: v1.5.1 Not using latest version (v1.6.3)

CCIP v1.5.1 Internal Library API Reference

Internal

A library for CCIP internal definitions common to multiple contracts. Provides core data structures and utilities for cross-chain message processing.

Git Source

Errors

InvalidEVMAddress

error InvalidEVMAddress(bytes encodedAddress);

Parameters

NameTypeDescription
encodedAddressbytesThe invalid encoded address

Enums

MessageExecutionState

Enum listing the possible message execution states within the offRamp contract.

enum MessageExecutionState {
  UNTOUCHED,
  IN_PROGRESS,
  SUCCESS,
  FAILURE
}

OCRPluginType

CCIP OCR plugin type, used to separate execution & commit transmissions and configs.

enum OCRPluginType {
  Commit,
  Execution
}

Structs

PriceUpdates

A collection of token price and gas price updates.

struct PriceUpdates {
  TokenPriceUpdate[] tokenPriceUpdates;
  GasPriceUpdate[] gasPriceUpdates;
}

Properties

NameTypeDescription
tokenPriceUpdatesTokenPriceUpdate[]Array of token price updates
gasPriceUpdatesGasPriceUpdate[]Array of gas price updates

TokenPriceUpdate

Token price in USD.

struct TokenPriceUpdate {
  address sourceToken;
  uint224 usdPerToken;
}

Properties

NameTypeDescription
sourceTokenaddressSource token address
usdPerTokenuint2241e18 USD per 1e18 of the smallest token denomination

GasPriceUpdate

Gas price for a given chain in USD, its value may contain tightly packed fields.

struct GasPriceUpdate {
  uint64 destChainSelector;
  uint224 usdPerUnitGas;
}

Properties

NameTypeDescription
destChainSelectoruint64Destination chain selector
usdPerUnitGasuint2241e18 USD per smallest unit (e.g. wei) of destination chain gas

TimestampedPackedUint224

A timestamped uint224 value that can contain several tightly packed fields.

struct TimestampedPackedUint224 {
  uint224 value;
  uint32 timestamp;
}

Properties

NameTypeDescription
valueuint224Value in uint224, can contain packed fields
timestampuint32Timestamp of the most recent price update

PoolUpdate

Structure for token pool updates.

struct PoolUpdate {
  address token;
  address pool;
}

Properties

NameTypeDescription
tokenaddressThe IERC20 token address
pooladdressThe token pool address

SourceTokenData

Structure containing token-specific data from the source chain.

struct SourceTokenData {
  bytes sourcePoolAddress;
  bytes destTokenAddress;
  bytes extraData;
  uint32 destGasAmount;
}

Properties

NameTypeDescription
sourcePoolAddressbytesSource pool address, abi encoded (trusted)
destTokenAddressbytesDestination token address, abi encoded for EVM chains (untrusted)
extraDatabytesOptional pool data transferred to destination chain
destGasAmountuint32Gas available for releaseOrMint and balanceOf calls on the offRamp

ExecutionReportSingleChain

Report submitted by the execution DON at the execution phase (including chain selector data).

struct ExecutionReportSingleChain {
  uint64 sourceChainSelector;
  Any2EVMRampMessage[] messages;
  bytes[][] offchainTokenData;
  bytes32[] proofs;
  uint256 proofFlagBits;
}

Properties

NameTypeDescription
sourceChainSelectoruint64Source chain selector for which report is submitted
messagesAny2EVMRampMessage[]Array of messages to execute
offchainTokenDatabytes[][]Bytes array for each message, per transferred token
proofsbytes32[]Merkle proofs
proofFlagBitsuint256Bitmap of proof flags

ExecutionReport

Report submitted by the execution DON at the execution phase.

struct ExecutionReport {
  EVM2EVMMessage[] messages;
  bytes[][] offchainTokenData;
  bytes32[] proofs;
  uint256 proofFlagBits;
}

Properties

NameTypeDescription
messagesEVM2EVMMessage[]Array of messages to execute
offchainTokenDatabytes[][]Bytes array for each message, per transferred token
proofsbytes32[]Merkle proofs
proofFlagBitsuint256Bitmap of proof flags

EVM2EVMMessage

The cross chain message that gets committed to EVM chains.

struct EVM2EVMMessage {
  uint64 sourceChainSelector;
  address sender;
  address receiver;
  uint64 sequenceNumber;
  uint256 gasLimit;
  bool strict;
  uint64 nonce;
  address feeToken;
  uint256 feeTokenAmount;
  bytes data;
  Client.EVMTokenAmount[] tokenAmounts;
  bytes[] sourceTokenData;
  bytes32 messageId;
}

Properties

NameTypeDescription
sourceChainSelectoruint64Chain selector of the source chain (not chainId)
senderaddressSender address on the source chain
receiveraddressReceiver address on the destination chain
sequenceNumberuint64Sequence number, not unique across lanes
gasLimituint256User supplied maximum gas for destination chain execution
strictboolDEPRECATED
nonceuint64Nonce for this lane and sender, not unique across lanes
feeTokenaddressFee token address
feeTokenAmountuint256Fee token amount
databytesArbitrary data payload supplied by the message sender
tokenAmountsClient.EVMTokenAmount[]Array of tokens and amounts to transfer
sourceTokenDatabytes[]Array of token data, one per token
messageIdbytes32Hash of the message data

RampMessageHeader

Family-agnostic header for OnRamp & OffRamp messages.

struct RampMessageHeader {
  bytes32 messageId;
  uint64 sourceChainSelector;
  uint64 destChainSelector;
  uint64 sequenceNumber;
  uint64 nonce;
}

Properties

NameTypeDescription
messageIdbytes32Unique identifier generated with source chain's encoding scheme
sourceChainSelectoruint64CCIP chain selector of the source chain (not chainId)
destChainSelectoruint64CCIP chain selector of the destination chain (not chainId)
sequenceNumberuint64Sequence number, not unique across lanes
nonceuint64Nonce for this lane and sender, not unique across senders/lanes

EVM2AnyTokenTransfer

Structure representing token transfers from EVM chains to any destination chain.

struct EVM2AnyTokenTransfer {
  address sourcePoolAddress;
  bytes destTokenAddress;
  bytes extraData;
  uint256 amount;
  bytes destExecData;
}

Properties

NameTypeDescription
sourcePoolAddressaddressSource pool EVM address (trusted)
destTokenAddressbytesEVM address of the destination token (untrusted)
extraDatabytesOptional pool data transferred to destination chain
amountuint256Amount of tokens to transfer
destExecDatabytesDestination chain execution data (e.g., gas amount for EVM chains)

Any2EVMTokenTransfer

Structure representing token transfers from any source chain to EVM chains.

struct Any2EVMTokenTransfer {
  bytes sourcePoolAddress;
  address destTokenAddress;
  uint32 destGasAmount;
  bytes extraData;
  uint256 amount;
}

Properties

NameTypeDescription
sourcePoolAddressbytesSource pool EVM address encoded to bytes (trusted)
destTokenAddressaddressAddress of destination token
destGasAmountuint32Gas available for releaseOrMint and transfer calls on the offRamp
extraDatabytesOptional pool data transferred to destination chain
amountuint256Amount of tokens to transfer

Any2EVMRampMessage

Family-agnostic message routed to an OffRamp.

struct Any2EVMRampMessage {
  RampMessageHeader header;
  bytes sender;
  bytes data;
  address receiver;
  uint256 gasLimit;
  Any2EVMTokenTransfer[] tokenAmounts;
}

Properties

NameTypeDescription
headerRampMessageHeaderMessage header with identifiers and routing information
senderbytesSender address on the source chain
databytesArbitrary data payload supplied by the message sender
receiveraddressReceiver address on the destination chain
gasLimituint256User supplied maximum gas for destination chain execution
tokenAmountsAny2EVMTokenTransfer[]Array of tokens and amounts to transfer

EVM2AnyRampMessage

Family-agnostic message emitted from the OnRamp.

struct EVM2AnyRampMessage {
  RampMessageHeader header;
  address sender;
  bytes data;
  bytes receiver;
  bytes extraArgs;
  address feeToken;
  uint256 feeTokenAmount;
  uint256 feeValueJuels;
  EVM2AnyTokenTransfer[] tokenAmounts;
}

Properties

NameTypeDescription
headerRampMessageHeaderMessage header with identifiers and routing information
senderaddressSender address on the source chain
databytesArbitrary data payload supplied by the message sender
receiverbytesReceiver address on the destination chain
extraArgsbytesDestination-chain specific args (e.g., gasLimit for EVM)
feeTokenaddressToken used to pay fees
feeTokenAmountuint256Amount of fee token paid
feeValueJuelsuint256Fee amount denominated in Juels
tokenAmountsEVM2AnyTokenTransfer[]Array of tokens and amounts to transfer

MerkleRoot

Struct to hold a merkle root and an interval for a source chain.

struct MerkleRoot {
  uint64 sourceChainSelector;
  bytes onRampAddress;
  uint64 minSeqNr;
  uint64 maxSeqNr;
  bytes32 merkleRoot;
}

Properties

NameTypeDescription
sourceChainSelectoruint64Remote source chain selector that the Merkle Root is scoped to
onRampAddressbytesGeneric onramp address (for EVM, use abi.encode)
minSeqNruint64Minimum sequence number, inclusive
maxSeqNruint64Maximum sequence number, inclusive
merkleRootbytes32Merkle root covering the interval & source chain messages

State Variables

GAS_FOR_CALL_EXACT_CHECK

uint16 internal constant GAS_FOR_CALL_EXACT_CHECK = 5_000;

MAX_RET_BYTES

uint16 internal constant MAX_RET_BYTES = 4 + 4 * 32;

MAX_BALANCE_OF_RET_BYTES

uint256 internal constant MAX_BALANCE_OF_RET_BYTES = 32;

GAS_PRICE_BITS

uint8 public constant GAS_PRICE_BITS = 112;

MESSAGE_FIXED_BYTES

uint256 public constant MESSAGE_FIXED_BYTES = 32 * 17;

MESSAGE_FIXED_BYTES_PER_TOKEN

uint256 public constant MESSAGE_FIXED_BYTES_PER_TOKEN = 32 * ((1 + 3 * 3) + 2);

ANY_2_EVM_MESSAGE_FIXED_BYTES

uint256 public constant ANY_2_EVM_MESSAGE_FIXED_BYTES = 32 * 14;

ANY_2_EVM_MESSAGE_FIXED_BYTES_PER_TOKEN

uint256 public constant ANY_2_EVM_MESSAGE_FIXED_BYTES_PER_TOKEN = 32 * ((2 * 3) + 3);

EVM_2_EVM_MESSAGE_HASH

bytes32 internal constant EVM_2_EVM_MESSAGE_HASH = keccak256("EVM2EVMMessageHashV2");

ANY_2_EVM_MESSAGE_HASH

bytes32 internal constant ANY_2_EVM_MESSAGE_HASH = keccak256("Any2EVMMessageHashV1");

EVM_2_ANY_MESSAGE_HASH

bytes32 internal constant EVM_2_ANY_MESSAGE_HASH = keccak256("EVM2AnyMessageHashV1");

CHAIN_FAMILY_SELECTOR_EVM

bytes4 public constant CHAIN_FAMILY_SELECTOR_EVM = 0x2812d52c;

PRECOMPILE_SPACE

uint256 public constant PRECOMPILE_SPACE = 1024;

Functions

_hash (EVM2EVMMessage)

function _hash(
  EVM2EVMMessage memory original,
  bytes32 metadataHash
) internal pure returns (bytes32);

Parameters

NameTypeDescription
originalEVM2EVMMessageMessage to hash
metadataHashbytes32Immutable metadata hash representing a lane with a fixed OnRamp

Returns

NameTypeDescription
hashedMessagebytes32Hashed message as a keccak256

_hash (Any2EVMRampMessage)

function _hash(
  Any2EVMRampMessage memory original,
  bytes32 metadataHash
) internal pure returns (bytes32);

Parameters

NameTypeDescription
originalAny2EVMRampMessageOffRamp message to hash
metadataHashbytes32Hash preimage to ensure global uniqueness

Returns

NameTypeDescription
hashedMessagebytes32Hashed message as a keccak256

_hash (EVM2AnyRampMessage)

function _hash(
  EVM2AnyRampMessage memory original,
  bytes32 metadataHash
) internal pure returns (bytes32);

Parameters

NameTypeDescription
originalEVM2AnyRampMessageOnRamp message to hash
metadataHashbytes32Hash preimage to ensure global uniqueness

Returns

NameTypeDescription
hashedMessagebytes32Hashed message as a keccak256

_validateEVMAddress

function _validateEVMAddress(
  bytes memory encodedAddress
) internal pure returns (address);

Parameters

NameTypeDescription
encodedAddressbytesThe abi-encoded address to validate

Returns

NameTypeDescription
addressaddressThe validated address if valid

Get the latest Chainlink content straight to your inbox.