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

CCIPLocalSimulatorFork v0.2.2 API Reference

CCIPLocalSimulatorFork

A contract that simulates CCIP (Cross-Chain Interoperability Protocol) message routing in forked network environments, specifically designed to work with Foundry for testing cross-chain applications.

CCIPLocalSimulatorFork

Events

CCIPSendRequested

event CCIPSendRequested(Internal.EVM2EVMMessage message)

Parameters

ParameterTypeDescription
messageInternal.EVM2EVMMessageThe EVM2EVM message that was sent

Interfaces

IEVM2EVMOffRampFork

Interface for executing CCIP messages on the off-ramp.

interface IEVM2EVMOffRampFork {
  function executeSingleMessage(
    Internal.EVM2EVMMessage memory message,
    bytes[] memory offchainTokenData,
    uint32[] memory tokenGasOverrides
  ) external;
}

IRouterFork

Interface for accessing off-ramp configurations.

interface IRouterFork {
  struct OffRamp {
    uint64 sourceChainSelector;
    address offRamp;
  }

  function getOffRamps() external view returns (OffRamp[] memory);
}

Structs

OffRamp

Configuration for a CCIP off-ramp.

struct OffRamp {
  uint64 sourceChainSelector;
  address offRamp;
}

Fields

FieldTypeDescription
sourceChainSelectoruint64The chain selector for the source chain
offRampaddressThe address of the offRamp contract

Variables

i_register

Register immutable i_register
address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE

s_processedMessages

mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages

Functions

constructor

Sets up the simulator environment by creating a persistent register instance and enabling event recording.

constructor()

getNetworkDetails

Fetches the network configuration for a specified blockchain network ID.

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

Parameters

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

Returns

ParameterTypeDescription
networkDetailsRegister.NetworkDetailsThe tuple containing: chainSelector, routerAddress, linkAddress, wrappedNativeAddress, ccipBnMAddress, ccipLnMAddress

requestLinkFromFaucet

Transfers LINK tokens from the faucet to a specified recipient address.

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

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

Registers or updates the network configuration for a specific blockchain.

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

Parameters

ParameterTypeDescription
chainIduint256The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector
networkDetailsRegister.NetworkDetailsThe tuple containing: chainSelector, routerAddress, linkAddress, wrappedNativeAddress, ccipBnMAddress, ccipLnMAddress

switchChainAndRouteMessage

Routes a cross-chain message by finding it in the event logs, switching to the destination chain, and executing it through the appropriate off-ramp.

function switchChainAndRouteMessage(uint256 forkId) external

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.