API Version: v0.3.0 Not using latest version (v0.3.1)

CCIPLocalSimulator v0.3.0 API Reference

CCIPLocalSimulator

Local CCIP simulator (no-fork mode).

CCIPLocalSimulator

Variables

CHAIN_SELECTOR

The unique CCIP Chain Selector constant

uint64 constant CHAIN_SELECTOR = 16015286601757825753

i_ccipBnM

The BurnMintERC677Helper instance for CCIP-BnM token

BurnMintERC677Helper internal immutable i_ccipBnM

i_ccipLnM

The BurnMintERC677Helper instance for CCIP-LnM token

BurnMintERC677Helper internal immutable i_ccipLnM

i_linkToken

The LINK token instance

LinkToken internal immutable i_linkToken

i_mockRouter

The mock CCIP router instance

CCIPLocalRouter internal immutable i_mockRouter

i_wrappedNative

The wrapped native token instance

WETH9 internal immutable i_wrappedNative

s_supportedTokens

The list of supported token addresses

address[] internal s_supportedTokens

Errors

CCIPLocalSimulator__MsgSenderIsNotTokenOwner

error CCIPLocalSimulator__MsgSenderIsNotTokenOwner();

CCIPLocalSimulator__RequiredRoleNotFound

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

Functions

configuration

Returns 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

NameTypeDescription
chainSelector_uint64- The unique CCIP Chain Selector.
sourceRouter_IRouterClient- The source chain Router contract.
destinationRouter_IRouterClient- The destination chain Router contract.
wrappedNative_WETH9- The wrapped native token which can be used for CCIP fees.
linkToken_LinkToken- The LINK token.
ccipBnM_BurnMintERC677Helper- The ccipBnM token.
ccipLnM_BurnMintERC677Helper- The ccipLnM token.

constructor

Constructor to initialize the contract and pre-deployed token instances

constructor() ;

getSupportedTokens

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

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

Parameters

NameTypeDescription
chainSelectoruint64- The unique CCIP Chain Selector.

Returns

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

isChainSupported

Checks whether the provided chainSelector is supported by the simulator.

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

Parameters

NameTypeDescription
chainSelectoruint64- The unique CCIP Chain Selector.

Returns

NameTypeDescription
supportedbool- Returns true if chainSelector is supported by the simulator.

requestLinkFromFaucet

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

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

Parameters

NameTypeDescription
toaddress- The address to which LINK tokens are to be sent.
amountuint256- The amount of LINK tokens to send.

Returns

NameTypeDescription
successbool- Returns true if the transfer of tokens was successful, otherwise false.

supportNewTokenViaAccessControlDefaultAdmin

Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by the contract itself. Reverts if the caller is not the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE.

function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external;

Parameters

NameTypeDescription
tokenAddressaddress- The address of the token to add to the list of supported tokens.

supportNewTokenViaGetCCIPAdmin

Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement getCCIPAdmin() function. Reverts if the caller is not the token CCIPAdmin.

function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external;

Parameters

NameTypeDescription
tokenAddressaddress- The address of the token to add to the list of supported tokens.

supportNewTokenViaOwner

Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement owner() function. Reverts if the caller is not the token owner.

function supportNewTokenViaOwner(address tokenAddress) external;

Parameters

NameTypeDescription
tokenAddressaddress- The address of the token to add to the list of supported tokens.

Get the latest Chainlink content straight to your inbox.