NEW

CCIP is now live for all developers. See what's new.

CCIPLocalSimulator API reference

CCIPLocalSimulator

This contract simulates local CCIP (Cross-Chain Interoperability Protocol) operations for testing and development purposes.

This contract includes methods to manage supported tokens and configurations for local simulations.

CHAIN_SELECTOR

uint64 CHAIN_SELECTOR

The unique CCIP Chain Selector constant

i_wrappedNative

contract WETH9 i_wrappedNative

The wrapped native token instance

i_linkToken

contract LinkToken i_linkToken

The LINK token instance

i_ccipBnM

contract BurnMintERC677Helper i_ccipBnM

The BurnMintERC677Helper instance for CCIP-BnM token

i_ccipLnM

contract BurnMintERC677Helper i_ccipLnM

The BurnMintERC677Helper instance for CCIP-LnM token

i_mockRouter

contract MockCCIPRouter i_mockRouter

The mock CCIP router instance

s_supportedTokens

address[] s_supportedTokens

The list of supported token addresses

constructor

constructor() public

Constructor to initialize the contract and pre-deployed token instances

supportNewToken

function supportNewToken(address tokenAddress) external

Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers.

Parameters

NameTypeDescription
tokenAddressaddressThe address of the token to add to the list of supported tokens.

isChainSupported

function isChainSupported(uint64 chainSelector) public pure returns (bool supported)

Checks whether the provided chainSelector is supported by the simulator.

Parameters

NameTypeDescription
chainSelectoruint64The unique CCIP Chain Selector.

Return Values

NameTypeDescription
supportedboolReturns true if chainSelector is supported by the simulator.

getSupportedTokens

function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens)

Gets a list of token addresses that are supported for cross-chain transfers by the simulator.

Parameters

NameTypeDescription
chainSelectoruint64The unique CCIP Chain Selector.

Return Values

NameTypeDescription
tokensaddress[]Returns a list of token addresses that are supported for cross-chain transfers by the simulator.

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.

configuration

function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_)

Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations.

Return Values

NameTypeDescription
chainSelector_uint64The unique CCIP Chain Selector.
sourceRouter_contract IRouterClientThe source chain Router contract.
destinationRouter_contract IRouterClientThe destination chain Router contract.
wrappedNative_contract WETH9The wrapped native token which can be used for CCIP fees.
linkToken_contract LinkTokenThe LINK token.
ccipBnM_contract BurnMintERC677HelperThe ccipBnM token.
ccipLnM_contract BurnMintERC677HelperThe ccipLnM token.

Stay updated on the latest Chainlink news