API Version: v0.2.3

CCIPLocalSimulator v0.2.3 API Reference

CCIPLocalSimulator

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

CCIPLocalSimulator

Variables

CHAIN_SELECTOR

uint64 constant CHAIN_SELECTOR = 16015286601757825753

i_ccipBnM

BurnMintERC677Helper internal immutable i_ccipBnM

i_ccipLnM

BurnMintERC677Helper internal immutable i_ccipLnM

i_linkToken

LinkToken internal immutable i_linkToken

i_mockRouter

MockCCIPRouter internal immutable i_mockRouter

i_wrappedNative

WETH9 internal immutable i_wrappedNative

s_supportedTokens

address[] internal s_supportedTokens

Errors

CCIPLocalSimulator__MsgSenderIsNotTokenOwner

error CCIPLocalSimulator__MsgSenderIsNotTokenOwner()

CCIPLocalSimulator__RequiredRoleNotFound

error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token)

Functions

configuration

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

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

Returns

ParameterTypeDescription
chainSelector_uint64The unique CCIP Chain Selector
sourceRouter_IRouterClientThe source chain Router contract
destinationRouter_IRouterClientThe destination chain Router contract
wrappedNative_WETH9The wrapped native token which can be used for CCIP fees
linkToken_LinkTokenThe LINK token
ccipBnM_BurnMintERC677HelperThe ccipBnM token
ccipLnM_BurnMintERC677HelperThe ccipLnM token

constructor

Initializes the contract with pre-deployed token instances.

constructor()

getSupportedTokens

Gets the list of supported token addresses for a given chain selector.

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

Parameters

ParameterTypeDescription
chainSelectoruint64The unique CCIP Chain Selector

Returns

ParameterTypeDescription
tokensaddress[]Returns a list of token addresses that are supported for cross-chain transfers

isChainSupported

Checks if a given chain selector is supported.

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

Parameters

ParameterTypeDescription
chainSelectoruint64The unique CCIP Chain Selector

Returns

ParameterTypeDescription
supportedboolReturns true if chainSelector is supported by the simulator

requestLinkFromFaucet

Transfers LINK tokens from the faucet to a specified 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

supportNewTokenViaAccessControlDefaultAdmin

Adds a new token to supported tokens list via AccessControl's DEFAULT_ADMIN_ROLE.

function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external

Parameters

ParameterTypeDescription
tokenAddressaddressThe address of the token to add to the list of supported tokens

supportNewTokenViaGetCCIPAdmin

Adds a new token to supported tokens list via CCIP admin role.

function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external

Parameters

ParameterTypeDescription
tokenAddressaddressThe address of the token to add to the list of supported tokens

supportNewTokenViaOwner

Adds a new token to supported tokens list via token owner.

function supportNewTokenViaOwner(address tokenAddress) external

Parameters

ParameterTypeDescription
tokenAddressaddressThe address of the token to add to the list of supported tokens

Get the latest Chainlink content straight to your inbox.