API Version: v0.2.1 Not using latest version (v0.2.3)

CCIPLocalSimulatorFork v0.2.1 API Reference

CCIPLocalSimulatorFork

CCIPLocalSimulatorFork enables testing of CCIP cross-chain messaging in forked network environments. This contract provides essential utilities for configuring networks and simulating message routing between chains in a Foundry test environment.

Events

CCIPSendRequested

event CCIPSendRequested(Internal.EVM2EVMMessage message)

Emitted when a cross-chain message is requested to be sent through CCIP.

Variables

i_register

Register immutable i_register

Stores and manages network configuration details required for CCIP operations.

address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE

Provides test LINK tokens to addresses during testing.

s_processedMessages

mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages

Prevents duplicate processing by tracking which messages have already been handled.

Functions

constructor

constructor() public

Initializes the simulator environment by deploying and configuring a persistent Register contract.

getNetworkDetails

function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory)

Retrieves network-specific CCIP configuration details. Use this function to access default settings or custom configurations for a given network.

Parameters:

ParameterTypeDescription
chainIduint256The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector.

Returns:

ParameterTypeDescription
networkDetailsRegister.NetworkDetailsA struct containing:

• chainSelector - The unique CCIP Chain Selector • routerAddress - The address of the CCIP Router contract • linkAddress - The address of the LINK token • wrappedNativeAddress - The address of the wrapped native token for CCIP fees • ccipBnMAddress - The address of the CCIP BnM token • ccipLnMAddress - The address of the CCIP LnM token |

requestLinkFromFaucet

function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success)

Transfers LINK tokens from the faucet to a specified address for testing purposes.

Parameters:

ParameterTypeDescription
toaddressThe address to which LINK tokens are to be sent
amountuint256The amount of LINK tokens to send

Returns:

ParameterTypeDescription
successboolReturns true if the transfer of tokens was successful, otherwise false

setNetworkDetails

function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external

Updates or adds CCIP configuration details for a specific blockchain network.

Parameters:

ParameterTypeDescription
chainIduint256The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector.
networkDetailsRegister.NetworkDetailsA struct containing:

• chainSelector - The unique CCIP Chain Selector • routerAddress - The address of the CCIP Router contract • linkAddress - The address of the LINK token • wrappedNativeAddress - The address of the wrapped native token for CCIP fees • ccipBnMAddress - The address of the CCIP BnM token • ccipLnMAddress - The address of the CCIP LnM token |

switchChainAndRouteMessage

function switchChainAndRouteMessage(uint256 forkId) external

Processes a cross-chain message by switching to the destination fork and executing the message.

Parameters:

ParameterTypeDescription
forkIduint256The ID of the destination network fork. This is the returned value of createFork() or createSelectFork()

Get the latest Chainlink content straight to your inbox.