Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in README.md about Fuji chainId to be 1 (instead of 2) and update Polygon Amoy contract addresses #22

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ETHEREUM_SEPOLIA_RPC_URL=""
OPTIMISM_GOERLI_RPC_URL=""
ARBITRUM_SEPOLIA_RPC_URL=""
AVALANCHE_FUJI_RPC_URL=""
POLYGON_MUMBAI_RPC_URL=""
POLYGON_AMOY_RPC_URL=""
BNB_CHAIN_TESTNET_RPC_URL=""
BASE_SEPOLIA_RPC_URL=""
METIS_SEPOLIA_RPC_URL=""
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ PRIVATE_KEY=""
ETHEREUM_SEPOLIA_RPC_URL=""
ARBITRUM_SEPOLIA_RPC_URL=""
AVALANCHE_FUJI_RPC_URL=""
POLYGON_MUMBAI_RPC_URL=""
POLYGON_AMOY_RPC_URL=""
BNB_CHAIN_TESTNET_RPC_URL=""
WEMIX_TESTNET_RPC_URL=""
KROMA_SEPOLIA_TESTNET_RPC_URL=""
Expand All @@ -86,7 +86,7 @@ enum SupportedNetworks {
ETHEREUM_SEPOLIA, // 0
AVALANCHE_FUJI, // 1
ARBITRUM_SEPOLIA, // 2
POLYGON_MUMBAI, // 3
POLYGON_AMOY, // 3
BNB_CHAIN_TESTNET, // 4
OPTIMISM_SEPOLIA, // 5
BASE_SEPOLIA, // 6
Expand All @@ -98,7 +98,7 @@ enum SupportedNetworks {
}
```

This means that if you want to perform some action from `AVALANCHE_FUJI` blockchain to `ETHEREUM_SEPOLIA` blockchain, for example, you will need to pass `2 (uint8)` as a source blockchain flag and `0 (uint8)` as a destination blockchain flag.
This means that if you want to perform some action from `AVALANCHE_FUJI` blockchain to `ETHEREUM_SEPOLIA` blockchain, for example, you will need to pass `1 (uint8)` as a source blockchain flag and `0 (uint8)` as a destination blockchain flag.

Similarly, there is an `PayFeesIn` enum:

Expand Down Expand Up @@ -148,7 +148,7 @@ forge script ./script/Faucet.s.sol -vvv --broadcast --rpc-url ethereumSepolia --
Or if you want to mint 10\*\*18 units of `CCIP-BnM` test token on Avalanche Fuji, run:

```shell
forge script ./script/Faucet.s.sol -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 2
forge script ./script/Faucet.s.sol -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 1
```

### Example 1 - Transfer Tokens from EOA to EOA
Expand All @@ -169,7 +169,7 @@ function run(
For example, if you want to send 0.0000000000000001 CCIP-BnM from Avalanche Fuji to Ethereum Sepolia and to pay for CCIP fees in LINK, run:

```shell
forge script ./script/Example01.s.sol -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8,uint8,address,address,uint256,uint8)" -- 2 0 <RECEIVER_ADDRESS> 0xD21341536c5cF5EB1bcb58f6723cE26e8D8E90e4 100 1
forge script ./script/Example01.s.sol -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8,uint8,address,address,uint256,uint8)" -- 1 0 <RECEIVER_ADDRESS> 0xD21341536c5cF5EB1bcb58f6723cE26e8D8E90e4 100 1
```

### Example 2 - Transfer Tokens from EOA to Smart Contract
Expand Down Expand Up @@ -204,7 +204,7 @@ function run(
For example, if you want to send 0.0000000000000001 CCIP-BnM from Avalanche Fuji to Ethereum Sepolia and to pay for CCIP fees in native coin (Test AVAX), run:

```shell
forge script ./script/Example02.s.sol:CCIPTokenTransfer -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8,uint8,address,address,uint256,uint8)" -- 2 0 <BASIC_MESSAGE_RECEIVER_ADDRESS> 0xD21341536c5cF5EB1bcb58f6723cE26e8D8E90e4 100 0
forge script ./script/Example02.s.sol:CCIPTokenTransfer -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8,uint8,address,address,uint256,uint8)" -- 1 0 <BASIC_MESSAGE_RECEIVER_ADDRESS> 0xD21341536c5cF5EB1bcb58f6723cE26e8D8E90e4 100 0
```

3. Once the CCIP message is finalized on the destination blockchain, you can see the details about the latest message using the `script/Example02.s.sol:GetLatestMessageDetails` smart contract:
Expand Down Expand Up @@ -240,7 +240,7 @@ function run(SupportedNetworks source) external;
For example, if you want to send tokens from Avalanche Fuji to Ethereum Sepolia, run:

```shell
forge script ./script/Example03.s.sol:DeployBasicTokenSender -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 2
forge script ./script/Example03.s.sol:DeployBasicTokenSender -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 1
```

2. [OPTIONAL] If you want to send tokens to the smart contract, instead of EOA, you will need to deploy [`BasicMessageReceiver.sol`](./src/BasicMessageReceiver.sol) to the **destination blockchain**. For this purpose, you can reuse the `script/Example02.s.sol:DeployBasicMessageReceiver` smart contract from the previous example:
Expand Down Expand Up @@ -322,7 +322,7 @@ function run(SupportedNetworks network) external;
For example, if you want to send a message from Avalanche Fuji to Ethereum Sepolia type:

```shell
forge script ./script/Example04.s.sol:DeployProgrammableTokenTransfers -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 2
forge script ./script/Example04.s.sol:DeployProgrammableTokenTransfers -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 1
```

2. Open Metamask and fund your contract with Native tokens. For example, if you want to send a message from Avalanche Fuji to Ethereum Sepolia, you can send 0.1 Fuji AVAX to your contract. You can also do the same thing using the `cast send` command:
Expand Down Expand Up @@ -385,7 +385,7 @@ function run(SupportedNetworks source) external;
For example, if you want to send a simple cross-chain message from Avalanche Fuji, run:

```shell
forge script ./script/Example05.s.sol:DeployBasicMessageSender -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 2
forge script ./script/Example05.s.sol:DeployBasicMessageSender -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 1
```

2. Fund the [`BasicMessageSender.sol`](./src/BasicMessageSender.sol) smart contract with Native Coins, either manually using your wallet or by using the `cast send` command. For example, if you want to send 0.1 Fuji AVAX, run:
Expand Down Expand Up @@ -457,7 +457,7 @@ function run(SupportedNetworks source) external;
For example, if you want to send a simple cross-chain message from Avalanche Fuji, run:

```shell
forge script ./script/Example05.s.sol:DeployBasicMessageSender -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 2
forge script ./script/Example05.s.sol:DeployBasicMessageSender -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 1
```

2. Fund the [`BasicMessageSender.sol`](./src/BasicMessageSender.sol) smart contract with Testnet LINKs, either manually using your wallet or by using the `cast send` command. For example, if you want to send 1 Fuji LINK, run:
Expand Down Expand Up @@ -559,7 +559,7 @@ function run(SupportedNetworks source) external;
For example, if you want to mint NFTs on Ethereum Sepolia from Avalanche Fuji, run:

```shell
forge script ./script/CrossChainNFT.s.sol:DeploySource -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 2
forge script ./script/CrossChainNFT.s.sol:DeploySource -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 1
```

3. Fund the [`SourceMinter.sol`](./src/cross-chain-nft-minter/SourceMinter.sol) smart contract with tokens for CCIP fees.
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ethereumSepolia = "${ETHEREUM_SEPOLIA_RPC_URL}"
optimismGoerli = "${OPTIMISM_GOERLI_RPC_URL}"
avalancheFuji = "${AVALANCHE_FUJI_RPC_URL}"
arbitrumSepolia = "${ARBITRUM_SEPOLIA_RPC_URL}"
polygonMumbai = "${POLYGON_MUMBAI_RPC_URL}"
polygonAmoy = "${POLYGON_AMOY_RPC_URL}"
bnbChainTestnet = "${BNB_CHAIN_TESTNET_RPC_URL}"
baseSepolia = "${BASE_SEPOLIA_RPC_URL}"
metisSepolia = "${METIS_SEPOLIA_RPC_URL}"
Expand Down
48 changes: 24 additions & 24 deletions script/Helper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ contract Helper {
ETHEREUM_SEPOLIA, // 0
AVALANCHE_FUJI, // 1
ARBITRUM_SEPOLIA, // 2
POLYGON_MUMBAI, // 3
POLYGON_AMOY, // 3
BNB_CHAIN_TESTNET, // 4
OPTIMISM_SEPOLIA, // 5
BASE_SEPOLIA, // 6
Expand All @@ -22,15 +22,15 @@ contract Helper {
public networks;

enum PayFeesIn {
Native,
LINK
Native, // 0
LINK // 1
}

// Chain IDs
uint64 constant chainIdEthereumSepolia = 16015286601757825753;
uint64 constant chainIdAvalancheFuji = 14767482510784806043;
uint64 constant chainIdArbitrumSepolia = 3478487238524512106;
uint64 constant chainIdPolygonMumbai = 12532609583862916517;
uint64 constant chainIdPolygonAmoy = 16281711391670634445;
uint64 constant chainIdBnbChainTestnet = 13264668187771770619;
uint64 constant chainIdOptimismSepolia = 5224473277236331295;
uint64 constant chainIdBaseSepolia = 10344971235874465080;
Expand All @@ -47,8 +47,8 @@ contract Helper {
0xF694E193200268f9a4868e4Aa017A0118C9a8177;
address constant routerArbitrumSepolia =
0x2a9C5afB0d0e4BAb2BCdaE109EC4b0c4Be15a165;
address constant routerPolygonMumbai =
0x1035CabC275068e0F4b745A29CEDf38E13aF41b1;
address constant routerPolygonAmoy =
0x9C32fCB86BF0f4a1A8921a9Fe46de3198bb884B2;
address constant routerBnbChainTestnet =
0xE1053aE1857476f36A3C62580FF9b016E8EE8F6f;
address constant routerOptimismSepolia =
Expand All @@ -73,8 +73,8 @@ contract Helper {
0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846;
address constant linkArbitrumSepolia =
0xb1D4538B4571d411F07960EF2838Ce337FE1E80E;
address constant linkPolygonMumbai =
0x326C977E6efc84E512bB9C30f76E30c160eD06FB;
address constant linkPolygonAmoy =
0x0Fd9e8d3aF1aaee056EB9e802c3A762a667b1904;
address constant linkBnbChainTestnet =
0x84b9B910527Ad5C03A9Ca831909E21e236EA7b06;
address constant linkOptimismSepolia =
Expand All @@ -99,8 +99,8 @@ contract Helper {
0xd00ae08403B9bbb9124bB305C09058E32C39A48c;
address constant wethArbitrumSepolia =
0xE591bf0A0CF924A0674d7792db046B23CEbF5f34;
address constant wmaticPolygonMumbai =
0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889;
address constant wmaticPolygonAmoy =
0x360ad4f9a9A8EFe9A8DCB5f461c4Cc1047E1Dcf9;
address constant wbnbBnbChainTestnet =
0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd;
address constant wethOptimismSepolia =
Expand All @@ -125,8 +125,8 @@ contract Helper {
0xA8C0c11bf64AF62CDCA6f93D3769B88BdD7cb93D;
address constant ccipBnMAvalancheFuji =
0xD21341536c5cF5EB1bcb58f6723cE26e8D8E90e4;
address constant ccipBnMPolygonMumbai =
0xf1E3A5842EeEF51F2967b3F05D45DD4f4205FF40;
address constant ccipBnMPolygonAmoy =
0xcab0EF91Bee323d1A617c0a027eE753aFd6997E4;
address constant ccipBnMBnbChainTestnet =
0xbFA2ACd33ED6EEc0ed3Cc06bF1ac38d22b36B9e9;
address constant ccipBnMOptimismSepolia =
Expand All @@ -149,8 +149,8 @@ contract Helper {
0x139E99f0ab4084E14e6bb7DacA289a91a2d92927;
address constant clCcipLnMAvalancheFuji =
0x70F5c5C40b873EA597776DA2C21929A8282A3b35;
address constant clCcipLnMPolygonMumbai =
0xc1c76a8c5bFDE1Be034bbcD930c668726E7C1987;
address constant clCcipLnMPolygonAmoy =
0x3d357fb52253e86c8Ee0f80F5FfE438fD9503FF2;
address constant clCcipLnMBnbChainTestnet =
0x79a4Fc27f69323660f5Bfc12dEe21c3cC14f5901;
address constant clCcipLnMOptimismSepolia =
Expand All @@ -167,8 +167,8 @@ contract Helper {
// USDC addresses
address constant usdcAvalancheFuji =
0x5425890298aed601595a70AB815c96711a31Bc65;
address constant usdcPolygonMumbai =
0x9999f7Fea5938fD3b1E26A12c3f2fb024e194f97;
address constant usdcPolygonAmoy =
0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582;
address constant usdcOptimismSepolia =
0x5fd84259d66Cd46123540766Be93DFE6D43130D7;
address constant usdcBaseSepolia =
Expand All @@ -184,7 +184,7 @@ contract Helper {
networks[SupportedNetworks.ETHEREUM_SEPOLIA] = "Ethereum Sepolia";
networks[SupportedNetworks.AVALANCHE_FUJI] = "Avalanche Fuji";
networks[SupportedNetworks.ARBITRUM_SEPOLIA] = "Arbitrum Sepolia";
networks[SupportedNetworks.POLYGON_MUMBAI] = "Polygon Mumbai";
networks[SupportedNetworks.POLYGON_AMOY] = "Polygon Amoy";
networks[SupportedNetworks.BNB_CHAIN_TESTNET] = "BNB Chain Testnet";
networks[SupportedNetworks.OPTIMISM_SEPOLIA] = "Optimism Sepolia";
networks[SupportedNetworks.BASE_SEPOLIA] = "Base Sepolia";
Expand All @@ -204,8 +204,8 @@ contract Helper {
return (ccipBnMArbitrumSepolia, clCcipLnMArbitrumSepolia);
} else if (network == SupportedNetworks.AVALANCHE_FUJI) {
return (ccipBnMAvalancheFuji, clCcipLnMAvalancheFuji);
} else if (network == SupportedNetworks.POLYGON_MUMBAI) {
return (ccipBnMPolygonMumbai, clCcipLnMPolygonMumbai);
} else if (network == SupportedNetworks.POLYGON_AMOY) {
return (ccipBnMPolygonAmoy, clCcipLnMPolygonAmoy);
} else if (network == SupportedNetworks.BNB_CHAIN_TESTNET) {
return (ccipBnMBnbChainTestnet, clCcipLnMBnbChainTestnet);
} else if (network == SupportedNetworks.OPTIMISM_SEPOLIA) {
Expand Down Expand Up @@ -252,12 +252,12 @@ contract Helper {
wavaxAvalancheFuji,
chainIdAvalancheFuji
);
} else if (network == SupportedNetworks.POLYGON_MUMBAI) {
} else if (network == SupportedNetworks.POLYGON_AMOY) {
return (
routerPolygonMumbai,
linkPolygonMumbai,
wmaticPolygonMumbai,
chainIdPolygonMumbai
routerPolygonAmoy,
linkPolygonAmoy,
wmaticPolygonAmoy,
chainIdPolygonAmoy
);
} else if (network == SupportedNetworks.BNB_CHAIN_TESTNET) {
return (
Expand Down