CCIP v2.0.0 Internal API Reference

Summary

Internal is a shared Solidity library containing CCIP-wide:

  • Chain family selector constants
  • Shared structs and enums
  • Address validation helpers
  • Safety-oriented constants

The library contains no storage and no external calls.


Library

chains/evm/contracts/libraries/Internal.sol


Import

import {Internal} from "chainlink-ccip/chains/evm/contracts/libraries/Internal.sol";

Types

PriceUpdates

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

TokenPriceUpdate

struct TokenPriceUpdate {
  address sourceToken;
  uint224 usdPerToken;
}

GasPriceUpdate

struct GasPriceUpdate {
  uint64 destChainSelector;
  uint224 usdPerUnitGas;
}

TimestampedPackedUint224

struct TimestampedPackedUint224 {
  uint224 value;
  uint32 timestamp;
}

SourceTokenData

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

EVM2AnyTokenTransfer

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

MerkleRoot

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

MessageExecutionState

enum MessageExecutionState {
  UNTOUCHED,
  IN_PROGRESS,
  SUCCESS,
  FAILURE
}

Constants

bytes4 internal constant CHAIN_FAMILY_SELECTOR_EVM = ...;
bytes4 internal constant CHAIN_FAMILY_SELECTOR_SVM = ...;
bytes4 internal constant CHAIN_FAMILY_SELECTOR_APTOS = ...;
bytes4 internal constant CHAIN_FAMILY_SELECTOR_SUI = ...;
bytes4 internal constant CHAIN_FAMILY_SELECTOR_TVM = ...;
uint16 internal constant MAX_RET_BYTES = 4 + 4 * 32;
address internal constant GAS_ESTIMATION_SENDER = ...;
uint8 internal constant GAS_PRICE_BITS = 112;
uint256 internal constant EVM_PRECOMPILE_SPACE = 1024;
uint256 internal constant APTOS_PRECOMPILE_SPACE = 0x0b;
uint256 internal constant SUI_PRECOMPILE_SPACE = 0xdee9;

(All values match canonical source.)


Errors

error InvalidEVMAddress(bytes encodedAddress);
error Invalid32ByteAddress(bytes encodedAddress);
error InvalidTVMAddress(bytes encodedAddress);

Functions

All functions are internal and pure.


_validateEVMAddress

function _validateEVMAddress(
  bytes memory encodedAddress
) internal pure

Validates ABI-encoded EVM address format.


_leftPadBytesToBytes32

function _leftPadBytesToBytes32(
  bytes memory data
) internal pure returns (bytes32)

Left-pads byte array to 32 bytes.


_validate32ByteAddress

function _validate32ByteAddress(
  bytes memory encodedAddress,
  uint256 minValue
) internal pure

Validates 32-byte ABI encoding and minimum value.


_validateTVMAddress

function _validateTVMAddress(
  bytes memory encodedAddress
) internal pure

Validates TON (TVM) address encoding.


Usage context

Used by:

  • MessageV1Codec
  • TokenPool
  • Executor
  • OffRamp
  • FeeQuoter

Provides canonical shared data structures and address validation logic.


Get the latest Chainlink content straight to your inbox.