CCIPLocalSimulator v0.2.3 API Reference
A contract that simulates local CCIP (Cross-Chain Interoperability Protocol) operations for testing and development purposes.
CCIPLocalSimulator
uint64 constant CHAIN_SELECTOR = 16015286601757825753
BurnMintERC677Helper internal immutable i_ccipBnM
BurnMintERC677Helper internal immutable i_ccipLnM
LinkToken internal immutable i_linkToken
MockCCIPRouter internal immutable i_mockRouter
WETH9 internal immutable i_wrappedNative
address[] internal s_supportedTokens
error CCIPLocalSimulator__MsgSenderIsNotTokenOwner()
error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token)
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_)
| 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 |
Initializes the contract with pre-deployed token instances.
constructor()
Gets the list of supported token addresses for a given chain selector.
function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens)
| Parameter | Type | Description |
|---|
| chainSelector | uint64 | The unique CCIP Chain Selector |
| Parameter | Type | Description |
|---|
| tokens | address[] | Returns a list of token addresses that are supported for cross-chain transfers |
Checks if a given chain selector is supported.
function isChainSupported(uint64 chainSelector) public pure returns (bool supported)
| Parameter | Type | Description |
|---|
| chainSelector | uint64 | The unique CCIP Chain Selector |
| Parameter | Type | Description |
|---|
| supported | bool | Returns true if chainSelector is supported by the simulator |
Transfers LINK tokens from the faucet to a specified address.
function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success)
| Parameter | Type | Description |
|---|
| to | address | The address to which LINK tokens are to be sent |
| amount | uint256 | The amount of LINK tokens to send |
| Parameter | Type | Description |
|---|
| success | bool | Returns true if the transfer of tokens was successful |
Adds a new token to supported tokens list via AccessControl's DEFAULT_ADMIN_ROLE.
function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external
| Parameter | Type | Description |
|---|
| tokenAddress | address | The address of the token to add to the list of supported tokens |
Adds a new token to supported tokens list via CCIP admin role.
function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external
| Parameter | Type | Description |
|---|
| tokenAddress | address | The address of the token to add to the list of supported tokens |
Adds a new token to supported tokens list via token owner.
function supportNewTokenViaOwner(address tokenAddress) external
| Parameter | Type | Description |
|---|
| tokenAddress | address | The address of the token to add to the list of supported tokens |