CCIPLocalSimulator v0.2.2 API Reference
CCIPLocalSimulator
A contract that simulates local CCIP (Cross-Chain Interoperability Protocol) operations for testing and development purposes.
Errors
CCIPLocalSimulator__MsgSenderIsNotTokenOwner
error CCIPLocalSimulator__MsgSenderIsNotTokenOwner()
Thrown when a caller attempts to add a token but is not the token owner or CCIP admin.
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
Functions
constructor
Initializes the contract by deploying and configuring all required token instances.
constructor()
configuration
Retrieves the complete configuration for local CCIP simulations.
function configuration()
public
view
returns (
uint64 chainSelector_,
IRouterClient sourceRouter_,
IRouterClient destinationRouter_,
WETH9 wrappedNative_,
LinkToken linkToken_,
BurnMintERC677Helper ccipBnM_,
BurnMintERC677Helper ccipLnM_
)
Returns
Parameter | Type | Description |
---|---|---|
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 |
getSupportedTokens
Retrieves the list of tokens supported for cross-chain transfers.
function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens)
Parameters
Parameter | Type | Description |
---|---|---|
chainSelector | uint64 | The unique CCIP Chain Selector |
Returns
Parameter | Type | Description |
---|---|---|
tokens | address[] | Returns a list of token addresses that are supported for cross-chain transfers by the simulator |
isChainSupported
Verifies if a given chain selector is supported by the simulator.
function isChainSupported(uint64 chainSelector) public pure returns (bool supported)
Parameters
Parameter | Type | Description |
---|---|---|
chainSelector | uint64 | The unique CCIP Chain Selector |
Returns
Parameter | Type | Description |
---|---|---|
supported | bool | Returns true if chainSelector is supported by the simulator |
requestLinkFromFaucet
Transfers LINK tokens from the faucet to a specified recipient address.
function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success)
Parameters
Parameter | Type | Description |
---|---|---|
to | address | The address to which LINK tokens are to be sent |
amount | uint256 | The amount of LINK tokens to send |
Returns
Parameter | Type | Description |
---|---|---|
success | bool | Returns true if the transfer of tokens was successful, otherwise false |
supportNewTokenViaGetCCIPAdmin
Adds support for a new token using CCIP admin verification.
function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external
Parameters
Parameter | Type | Description |
---|---|---|
tokenAddress | address | The address of the token to add to the list of supported tokens |
supportNewTokenViaOwner
Adds support for a new token using owner verification.
function supportNewTokenViaOwner(address tokenAddress) external
Parameters
Parameter | Type | Description |
---|---|---|
tokenAddress | address | The address of the token to add to the list of supported tokens |