Skip to content

Commit 6edfd9d

Browse files
committed
generate api reference
1 parent fd9ea91 commit 6edfd9d

32 files changed

+2168
-107
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Solidity API
2+
3+
## BurnMintERC677Helper
4+
5+
This contract extends the functionality of the BurnMintERC677 token contract to include a `drip` function that mints one full token to a specified address.
6+
7+
_Inherits from the BurnMintERC677 contract and sets the token name, symbol, decimals, and initial supply in the constructor._
8+
9+
### constructor
10+
11+
```solidity
12+
constructor(string name, string symbol) public
13+
```
14+
15+
Constructor to initialize the BurnMintERC677Helper contract with a name and symbol.
16+
17+
_Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and initial supply (0)._
18+
19+
#### Parameters
20+
21+
| Name | Type | Description |
22+
| ---- | ---- | ----------- |
23+
| name | string | - The name of the token. |
24+
| symbol | string | - The symbol of the token. |
25+
26+
### drip
27+
28+
```solidity
29+
function drip(address to) external
30+
```
31+
32+
Mints one full token (1e18) to the specified address.
33+
34+
_Calls the internal `_mint` function from the BurnMintERC677 contract._
35+
36+
#### Parameters
37+
38+
| Name | Type | Description |
39+
| ---- | ---- | ----------- |
40+
| to | address | - The address to receive the minted token. |
41+
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# Solidity API
2+
3+
## CCIPLocalSimulator
4+
5+
This contract simulates local CCIP (Cross-Chain Interoperability Protocol) operations for testing and development purposes.
6+
7+
_This contract includes methods to manage supported tokens and configurations for local simulations._
8+
9+
### CHAIN_SELECTOR
10+
11+
```solidity
12+
uint64 CHAIN_SELECTOR
13+
```
14+
15+
The unique CCIP Chain Selector constant
16+
17+
### i_wrappedNative
18+
19+
```solidity
20+
contract WETH9 i_wrappedNative
21+
```
22+
23+
The wrapped native token instance
24+
25+
### i_linkToken
26+
27+
```solidity
28+
contract LinkToken i_linkToken
29+
```
30+
31+
The LINK token instance
32+
33+
### i_ccipBnM
34+
35+
```solidity
36+
contract BurnMintERC677Helper i_ccipBnM
37+
```
38+
39+
The BurnMintERC677Helper instance for CCIP-BnM token
40+
41+
### i_ccipLnM
42+
43+
```solidity
44+
contract BurnMintERC677Helper i_ccipLnM
45+
```
46+
47+
The BurnMintERC677Helper instance for CCIP-LnM token
48+
49+
### i_mockRouter
50+
51+
```solidity
52+
contract MockCCIPRouter i_mockRouter
53+
```
54+
55+
The mock CCIP router instance
56+
57+
### s_supportedTokens
58+
59+
```solidity
60+
address[] s_supportedTokens
61+
```
62+
63+
The list of supported token addresses
64+
65+
### constructor
66+
67+
```solidity
68+
constructor() public
69+
```
70+
71+
Constructor to initialize the contract and pre-deployed token instances
72+
73+
### supportNewToken
74+
75+
```solidity
76+
function supportNewToken(address tokenAddress) external
77+
```
78+
79+
Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers.
80+
81+
#### Parameters
82+
83+
| Name | Type | Description |
84+
| ---- | ---- | ----------- |
85+
| tokenAddress | address | - The address of the token to add to the list of supported tokens. |
86+
87+
### isChainSupported
88+
89+
```solidity
90+
function isChainSupported(uint64 chainSelector) public pure returns (bool supported)
91+
```
92+
93+
Checks whether the provided `chainSelector` is supported by the simulator.
94+
95+
#### Parameters
96+
97+
| Name | Type | Description |
98+
| ---- | ---- | ----------- |
99+
| chainSelector | uint64 | - The unique CCIP Chain Selector. |
100+
101+
#### Return Values
102+
103+
| Name | Type | Description |
104+
| ---- | ---- | ----------- |
105+
| supported | bool | - Returns true if `chainSelector` is supported by the simulator. |
106+
107+
### getSupportedTokens
108+
109+
```solidity
110+
function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens)
111+
```
112+
113+
Gets a list of token addresses that are supported for cross-chain transfers by the simulator.
114+
115+
#### Parameters
116+
117+
| Name | Type | Description |
118+
| ---- | ---- | ----------- |
119+
| chainSelector | uint64 | - The unique CCIP Chain Selector. |
120+
121+
#### Return Values
122+
123+
| Name | Type | Description |
124+
| ---- | ---- | ----------- |
125+
| tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. |
126+
127+
### requestLinkFromFaucet
128+
129+
```solidity
130+
function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success)
131+
```
132+
133+
Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address.
134+
135+
#### Parameters
136+
137+
| Name | Type | Description |
138+
| ---- | ---- | ----------- |
139+
| to | address | - The address to which LINK tokens are to be sent. |
140+
| amount | uint256 | - The amount of LINK tokens to send. |
141+
142+
#### Return Values
143+
144+
| Name | Type | Description |
145+
| ---- | ---- | ----------- |
146+
| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. |
147+
148+
### configuration
149+
150+
```solidity
151+
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_)
152+
```
153+
154+
Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations.
155+
156+
#### Return Values
157+
158+
| Name | Type | Description |
159+
| ---- | ---- | ----------- |
160+
| chainSelector_ | uint64 | - The unique CCIP Chain Selector. |
161+
| sourceRouter_ | contract IRouterClient | - The source chain Router contract. |
162+
| destinationRouter_ | contract IRouterClient | - The destination chain Router contract. |
163+
| wrappedNative_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. |
164+
| linkToken_ | contract LinkToken | - The LINK token. |
165+
| ccipBnM_ | contract BurnMintERC677Helper | - The ccipBnM token. |
166+
| ccipLnM_ | contract BurnMintERC677Helper | - The ccipLnM token. |
167+
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# Solidity API
2+
3+
## IRouterFork
4+
5+
### OffRamp
6+
7+
```solidity
8+
struct OffRamp {
9+
uint64 sourceChainSelector;
10+
address offRamp;
11+
}
12+
```
13+
14+
### getOffRamps
15+
16+
```solidity
17+
function getOffRamps() external view returns (struct IRouterFork.OffRamp[])
18+
```
19+
20+
Gets the list of offRamps
21+
22+
#### Return Values
23+
24+
| Name | Type | Description |
25+
| ---- | ---- | ----------- |
26+
| [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs |
27+
28+
## IEVM2EVMOffRampFork
29+
30+
### executeSingleMessage
31+
32+
```solidity
33+
function executeSingleMessage(struct Internal.EVM2EVMMessage message, bytes[] offchainTokenData) external
34+
```
35+
36+
Executes a single CCIP message on the offRamp
37+
38+
#### Parameters
39+
40+
| Name | Type | Description |
41+
| ---- | ---- | ----------- |
42+
| message | struct Internal.EVM2EVMMessage | - The CCIP message to be executed |
43+
| offchainTokenData | bytes[] | - Additional offchain token data |
44+
45+
## CCIPLocalSimulatorFork
46+
47+
Works with Foundry only
48+
49+
### CCIPSendRequested
50+
51+
```solidity
52+
event CCIPSendRequested(struct Internal.EVM2EVMMessage message)
53+
```
54+
55+
Event emitted when a CCIP send request is made
56+
57+
#### Parameters
58+
59+
| Name | Type | Description |
60+
| ---- | ---- | ----------- |
61+
| message | struct Internal.EVM2EVMMessage | - The EVM2EVM message that was sent |
62+
63+
### i_register
64+
65+
```solidity
66+
contract Register i_register
67+
```
68+
69+
The immutable register instance
70+
71+
### LINK_FAUCET
72+
73+
```solidity
74+
address LINK_FAUCET
75+
```
76+
77+
The address of the LINK faucet
78+
79+
### s_processedMessages
80+
81+
```solidity
82+
mapping(bytes32 => bool) s_processedMessages
83+
```
84+
85+
Mapping to track processed messages
86+
87+
### constructor
88+
89+
```solidity
90+
constructor() public
91+
```
92+
93+
Constructor to initialize the contract
94+
95+
### switchChainAndRouteMessage
96+
97+
```solidity
98+
function switchChainAndRouteMessage(uint256 forkId) external
99+
```
100+
101+
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.
102+
103+
#### Parameters
104+
105+
| Name | Type | Description |
106+
| ---- | ---- | ----------- |
107+
| forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` |
108+
109+
### getNetworkDetails
110+
111+
```solidity
112+
function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails)
113+
```
114+
115+
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.
116+
117+
#### Parameters
118+
119+
| Name | Type | Description |
120+
| ---- | ---- | ----------- |
121+
| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. |
122+
123+
#### Return Values
124+
125+
| Name | Type | Description |
126+
| ---- | ---- | ----------- |
127+
| [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. |
128+
129+
### setNetworkDetails
130+
131+
```solidity
132+
function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external
133+
```
134+
135+
If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function.
136+
137+
#### Parameters
138+
139+
| Name | Type | Description |
140+
| ---- | ---- | ----------- |
141+
| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. |
142+
| 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. |
143+
144+
### requestLinkFromFaucet
145+
146+
```solidity
147+
function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success)
148+
```
149+
150+
Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address.
151+
152+
#### Parameters
153+
154+
| Name | Type | Description |
155+
| ---- | ---- | ----------- |
156+
| to | address | - The address to which LINK tokens are to be sent. |
157+
| amount | uint256 | - The amount of LINK tokens to send. |
158+
159+
#### Return Values
160+
161+
| Name | Type | Description |
162+
| ---- | ---- | ----------- |
163+
| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. |
164+

0 commit comments

Comments
 (0)