CCIPLocalSimulatorFork API reference

IRouterFork

OffRamp

Structure representing an offRamp configuration

Parameters

NameTypeDescription
sourceChainSelectoruint64The chain selector for the source chain
offRampaddressThe address of the offRamp contract
struct OffRamp {
  uint64 sourceChainSelector;
  address offRamp;
}

getOffRamps

function getOffRamps() external view returns (struct IRouterFork.OffRamp[])

Gets the list of offRamps

Return Values

NameTypeDescription
[0]struct IRouterFork.OffRamp[]Array of OffRamp structs containing source chain selectors and offRamp addresses

IEVM2EVMOffRampFork

executeSingleMessage

function executeSingleMessage(struct Internal.EVM2EVMMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external

Executes a single CCIP message on the offRamp

Parameters

NameTypeDescription
messagestruct Internal.EVM2EVMMessageThe CCIP message to be executed
offchainTokenDatabytes[]Additional offchain token data for the message execution
tokenGasOverridesuint32[]Gas limit overrides for each token transfer in the message

CCIPLocalSimulatorFork

Works with Foundry only

CCIPSendRequested

event CCIPSendRequested(struct Internal.EVM2EVMMessage message)

Event emitted when a CCIP send request is made

Parameters

NameTypeDescription
messagestruct Internal.EVM2EVMMessageThe EVM2EVM message that was sent

i_register

contract Register i_register

The immutable register instance

address LINK_FAUCET

The address of the LINK faucet

s_processedMessages

mapping(bytes32 => bool) s_processedMessages

Mapping to track processed messages

constructor

constructor() public

Constructor to initialize the contract

switchChainAndRouteMessage

function switchChainAndRouteMessage(uint256 forkId) external

To be called after the sending of the cross-chain message (ccipSend). Goes through the list of past logs and looks for the CCIPSendRequested event. Switches to a destination network fork. Routes the sent cross-chain message on the destination network.

Parameters

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

getNetworkDetails

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

Returns the default values for currently CCIP supported networks. If network is not present or some of the values are changed, user can manually add new network details using the setNetworkDetails function.

Parameters

NameTypeDescription
chainIduint256The blockchain network chain ID (e.g., 11155111 for Ethereum Sepolia). Not to be confused with CCIP chain selector.

Return Values

NameTypeDescription
networkDetailsstruct Register.NetworkDetailsA struct containing the following network details:
• 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

setNetworkDetails

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

Allows manual configuration of network details if they are not present or need to be updated.

Parameters

NameTypeDescription
chainIduint256The blockchain network chain ID (e.g., 11155111 for Ethereum Sepolia). Not to be confused with CCIP chain selector.
networkDetailsstruct Register.NetworkDetailsA struct containing the following required fields:
• 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)

Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address.

Parameters

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

Return Values

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

Get the latest Chainlink content straight to your inbox.