CCIPLocalSimulatorFork v0.2.3 API Reference
CCIPLocalSimulatorFork
A contract that simulates CCIP (Cross-Chain Interoperability Protocol) message routing in a Foundry test environment.
Interfaces
IRouterFork
Interface for interacting with the CCIP Router contract in a forked environment.
OffRamp
struct OffRamp {
uint64 sourceChainSelector;
address offRamp;
}
Field | Type | Description |
---|---|---|
sourceChainSelector | uint64 | The chain selector for the source chain |
offRamp | address | The address of the offRamp contract |
getOffRamps
function getOffRamps() external view returns (OffRamp[] memory)
Returns
Parameter | Type | Description |
---|---|---|
(unnamed) | OffRamp[] | Array of off-ramp configurations |
IEVM2EVMOffRampFork
Interface for executing CCIP messages on an off-ramp contract in a forked environment.
executeSingleMessage
function executeSingleMessage(
Internal.EVM2EVMMessage memory message,
bytes[] memory offchainTokenData,
uint32[] memory tokenGasOverrides
) external
Parameters
Parameter | Type | Description |
---|---|---|
message | EVM2EVMMessage | The CCIP message to be executed |
offchainTokenData | bytes[] | Additional off-chain token data |
tokenGasOverrides | uint32[] | Gas limit overrides for token transfers |
Events
CCIPSendRequested
event CCIPSendRequested(Internal.EVM2EVMMessage message)
Parameters
Parameter | Type | Description |
---|---|---|
message | EVM2EVMMessage | The EVM2EVM message that was sent |
Variables
i_register
Register immutable i_register
LINK_FAUCET
address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE
s_processedMessages
mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages
Functions
constructor
Initializes the contract and sets up logging and persistence.
constructor()
switchChainAndRouteMessage
Routes a cross-chain message on the destination network after switching to the specified fork.
function switchChainAndRouteMessage(uint256 forkId) external
Parameters
Parameter | Type | Description |
---|---|---|
forkId | uint256 | The ID of the destination network fork (returned by createFork() or createSelectFork() ) |
getNetworkDetails
Returns the network configuration details for a specified chain ID.
function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory)
Parameters
Parameter | Type | Description |
---|---|---|
chainId | uint256 | The blockchain network chain ID (e.g., 11155111 for Ethereum Sepolia) |
Returns
Parameter | Type | Description |
---|---|---|
(unnamed) | NetworkDetails | The network configuration details for the specified chain |
setNetworkDetails
Updates or adds new network configuration details for a specified chain ID.
function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external
Parameters
Parameter | Type | Description |
---|---|---|
chainId | uint256 | The blockchain network chain ID (e.g., 11155111 for Ethereum Sepolia) |
networkDetails | NetworkDetails | The network configuration details to be stored |
requestLinkFromFaucet
Requests LINK tokens from the faucet for a specified address.
function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success)
Parameters
Parameter | Type | Description |
---|---|---|
to | address | The address to receive the LINK tokens |
amount | uint256 | The amount of LINK tokens to transfer |
Returns
Parameter | Type | Description |
---|---|---|
success | bool | Returns true if the token transfer was successful |