-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
2,168 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Solidity API | ||
|
||
## BurnMintERC677Helper | ||
|
||
This contract extends the functionality of the BurnMintERC677 token contract to include a `drip` function that mints one full token to a specified address. | ||
|
||
_Inherits from the BurnMintERC677 contract and sets the token name, symbol, decimals, and initial supply in the constructor._ | ||
|
||
### constructor | ||
|
||
```solidity | ||
constructor(string name, string symbol) public | ||
``` | ||
|
||
Constructor to initialize the BurnMintERC677Helper contract with a name and symbol. | ||
|
||
_Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and initial supply (0)._ | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| name | string | - The name of the token. | | ||
| symbol | string | - The symbol of the token. | | ||
|
||
### drip | ||
|
||
```solidity | ||
function drip(address to) external | ||
``` | ||
|
||
Mints one full token (1e18) to the specified address. | ||
|
||
_Calls the internal `_mint` function from the BurnMintERC677 contract._ | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| to | address | - The address to receive the minted token. | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
# Solidity API | ||
|
||
## CCIPLocalSimulator | ||
|
||
This contract simulates local CCIP (Cross-Chain Interoperability Protocol) operations for testing and development purposes. | ||
|
||
_This contract includes methods to manage supported tokens and configurations for local simulations._ | ||
|
||
### CHAIN_SELECTOR | ||
|
||
```solidity | ||
uint64 CHAIN_SELECTOR | ||
``` | ||
|
||
The unique CCIP Chain Selector constant | ||
|
||
### i_wrappedNative | ||
|
||
```solidity | ||
contract WETH9 i_wrappedNative | ||
``` | ||
|
||
The wrapped native token instance | ||
|
||
### i_linkToken | ||
|
||
```solidity | ||
contract LinkToken i_linkToken | ||
``` | ||
|
||
The LINK token instance | ||
|
||
### i_ccipBnM | ||
|
||
```solidity | ||
contract BurnMintERC677Helper i_ccipBnM | ||
``` | ||
|
||
The BurnMintERC677Helper instance for CCIP-BnM token | ||
|
||
### i_ccipLnM | ||
|
||
```solidity | ||
contract BurnMintERC677Helper i_ccipLnM | ||
``` | ||
|
||
The BurnMintERC677Helper instance for CCIP-LnM token | ||
|
||
### i_mockRouter | ||
|
||
```solidity | ||
contract MockCCIPRouter i_mockRouter | ||
``` | ||
|
||
The mock CCIP router instance | ||
|
||
### s_supportedTokens | ||
|
||
```solidity | ||
address[] s_supportedTokens | ||
``` | ||
|
||
The list of supported token addresses | ||
|
||
### constructor | ||
|
||
```solidity | ||
constructor() public | ||
``` | ||
|
||
Constructor to initialize the contract and pre-deployed token instances | ||
|
||
### supportNewToken | ||
|
||
```solidity | ||
function supportNewToken(address tokenAddress) external | ||
``` | ||
|
||
Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| tokenAddress | address | - The address of the token to add to the list of supported tokens. | | ||
|
||
### isChainSupported | ||
|
||
```solidity | ||
function isChainSupported(uint64 chainSelector) public pure returns (bool supported) | ||
``` | ||
|
||
Checks whether the provided `chainSelector` is supported by the simulator. | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| chainSelector | uint64 | - The unique CCIP Chain Selector. | | ||
|
||
#### Return Values | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| supported | bool | - Returns true if `chainSelector` is supported by the simulator. | | ||
|
||
### getSupportedTokens | ||
|
||
```solidity | ||
function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens) | ||
``` | ||
|
||
Gets a list of token addresses that are supported for cross-chain transfers by the simulator. | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| chainSelector | uint64 | - The unique CCIP Chain Selector. | | ||
|
||
#### Return Values | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | | ||
|
||
### requestLinkFromFaucet | ||
|
||
```solidity | ||
function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) | ||
``` | ||
|
||
Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| to | address | - The address to which LINK tokens are to be sent. | | ||
| amount | uint256 | - The amount of LINK tokens to send. | | ||
|
||
#### Return Values | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | | ||
|
||
### configuration | ||
|
||
```solidity | ||
function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_) | ||
``` | ||
|
||
Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations. | ||
|
||
#### Return Values | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| chainSelector_ | uint64 | - The unique CCIP Chain Selector. | | ||
| sourceRouter_ | contract IRouterClient | - The source chain Router contract. | | ||
| destinationRouter_ | contract IRouterClient | - The destination chain Router contract. | | ||
| wrappedNative_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. | | ||
| linkToken_ | contract LinkToken | - The LINK token. | | ||
| ccipBnM_ | contract BurnMintERC677Helper | - The ccipBnM token. | | ||
| ccipLnM_ | contract BurnMintERC677Helper | - The ccipLnM token. | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
# Solidity API | ||
|
||
## IRouterFork | ||
|
||
### OffRamp | ||
|
||
```solidity | ||
struct OffRamp { | ||
uint64 sourceChainSelector; | ||
address offRamp; | ||
} | ||
``` | ||
|
||
### getOffRamps | ||
|
||
```solidity | ||
function getOffRamps() external view returns (struct IRouterFork.OffRamp[]) | ||
``` | ||
|
||
Gets the list of offRamps | ||
|
||
#### Return Values | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs | | ||
|
||
## IEVM2EVMOffRampFork | ||
|
||
### executeSingleMessage | ||
|
||
```solidity | ||
function executeSingleMessage(struct Internal.EVM2EVMMessage message, bytes[] offchainTokenData) external | ||
``` | ||
|
||
Executes a single CCIP message on the offRamp | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| message | struct Internal.EVM2EVMMessage | - The CCIP message to be executed | | ||
| offchainTokenData | bytes[] | - Additional offchain token data | | ||
|
||
## CCIPLocalSimulatorFork | ||
|
||
Works with Foundry only | ||
|
||
### CCIPSendRequested | ||
|
||
```solidity | ||
event CCIPSendRequested(struct Internal.EVM2EVMMessage message) | ||
``` | ||
|
||
Event emitted when a CCIP send request is made | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| message | struct Internal.EVM2EVMMessage | - The EVM2EVM message that was sent | | ||
|
||
### i_register | ||
|
||
```solidity | ||
contract Register i_register | ||
``` | ||
|
||
The immutable register instance | ||
|
||
### LINK_FAUCET | ||
|
||
```solidity | ||
address LINK_FAUCET | ||
``` | ||
|
||
The address of the LINK faucet | ||
|
||
### s_processedMessages | ||
|
||
```solidity | ||
mapping(bytes32 => bool) s_processedMessages | ||
``` | ||
|
||
Mapping to track processed messages | ||
|
||
### constructor | ||
|
||
```solidity | ||
constructor() public | ||
``` | ||
|
||
Constructor to initialize the contract | ||
|
||
### switchChainAndRouteMessage | ||
|
||
```solidity | ||
function switchChainAndRouteMessage(uint256 forkId) external | ||
``` | ||
|
||
To be called after the sending of the cross-chain message (`ccipSend`). Goes through the list of past logs and looks for the `CCIPSendRequested` event. Switches to a destination network fork. Routes the sent cross-chain message on the destination network. | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | | ||
|
||
### getNetworkDetails | ||
|
||
```solidity | ||
function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) | ||
``` | ||
|
||
Returns the default values for currently CCIP supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | | ||
|
||
#### Return Values | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | | ||
|
||
### setNetworkDetails | ||
|
||
```solidity | ||
function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external | ||
``` | ||
|
||
If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | | ||
| networkDetails | struct Register.NetworkDetails | - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | | ||
|
||
### requestLinkFromFaucet | ||
|
||
```solidity | ||
function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) | ||
``` | ||
|
||
Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| to | address | - The address to which LINK tokens are to be sent. | | ||
| amount | uint256 | - The amount of LINK tokens to send. | | ||
|
||
#### Return Values | ||
|
||
| Name | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | | ||
|
Oops, something went wrong.