CCIPLocalSimulator v0.2.3 API Reference
CCIPLocalSimulator
A contract that simulates local CCIP (Cross-Chain Interoperability Protocol) operations for testing and development purposes.
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
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 |
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
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 |
isChainSupported
Checks if a given chain selector is supported.
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 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 |
supportNewTokenViaAccessControlDefaultAdmin
Adds a new token to supported tokens list via AccessControl's DEFAULT_ADMIN_ROLE.
function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external
Parameters
Parameter | Type | Description |
---|---|---|
tokenAddress | address | The 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
Parameter | Type | Description |
---|---|---|
tokenAddress | address | The 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
Parameter | Type | Description |
---|---|---|
tokenAddress | address | The address of the token to add to the list of supported tokens |