Skip to content

Migrate CCIP tutorials to Fuji #1876

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

Merged
merged 14 commits into from
Apr 12, 2024
Merged
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
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"composability",
"GLMR",
"IERC",
"Juels",
"Linea",
"Mainnets",
"Merkle",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Binary file not shown.
Binary file not shown.
13 changes: 6 additions & 7 deletions src/content/any-api/testnet-oracles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ To retrieve the LINK token address or get faucet details for your testnet of cho

Testnet [Operator contracts](https://github.com/smartcontractkit/chainlink/blob/master/contracts/src/v0.8/operatorforwarder/dev/Operator.sol) are deployed and maintained on the following networks:

| Testnet | Oracle Address |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| Ethereum Sepolia | [`0x6090149792dAAeE9D1D568c9f9a6F6B46AA29eFD`](https://sepolia.etherscan.io/address/0x6090149792dAAeE9D1D568c9f9a6F6B46AA29eFD) |
| Avalanche Fuji | [`0x022EEA14A6010167ca026B32576D6686dD7e85d2`](https://testnet.snowtrace.io/address/0x022EEA14A6010167ca026B32576D6686dD7e85d2) |
| Polygon Mumbai | [`0x40193c8518BB267228Fc409a613bDbD8eC5a97b3`](https://mumbai.polygonscan.com/address/0x40193c8518BB267228Fc409a613bDbD8eC5a97b3) |
| Binance Testnet | [`0xCC79157eb46F5624204f47AB42b3906cAA40eaB7`](https://testnet.bscscan.com/address/0xCC79157eb46F5624204f47AB42b3906cAA40eaB7) |
| Fantom Testnet | [`0xCC79157eb46F5624204f47AB42b3906cAA40eaB7`](https://testnet.ftmscan.com/address/0xCC79157eb46F5624204f47AB42b3906cAA40eaB7) |
| Testnet | Oracle Address |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Ethereum Sepolia | [`0x6090149792dAAeE9D1D568c9f9a6F6B46AA29eFD`](https://sepolia.etherscan.io/address/0x6090149792dAAeE9D1D568c9f9a6F6B46AA29eFD) |
| Avalanche Fuji | [`0x022EEA14A6010167ca026B32576D6686dD7e85d2`](https://testnet.snowtrace.io/address/0x022EEA14A6010167ca026B32576D6686dD7e85d2) |
| Binance Testnet | [`0xCC79157eb46F5624204f47AB42b3906cAA40eaB7`](https://testnet.bscscan.com/address/0xCC79157eb46F5624204f47AB42b3906cAA40eaB7) |
| Fantom Testnet | [`0xCC79157eb46F5624204f47AB42b3906cAA40eaB7`](https://testnet.ftmscan.com/address/0xCC79157eb46F5624204f47AB42b3906cAA40eaB7) |

## Jobs

Expand Down
2 changes: 1 addition & 1 deletion src/content/ccip/concepts/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Finality varies across different networks. Some networks offer instant finality

## Lane

A Chainlink CCIP _lane_ is a distinct pathway between a source and a destination blockchain. Lanes are unidirectional. For instance, _Ethereum Sepolia => Polygon Mumbai_ and _Polygon Mumbai => Ethereum Sepolia_ are two different lanes.
A Chainlink CCIP _lane_ is a distinct pathway between a source and a destination blockchain. Lanes are unidirectional. For instance, _Ethereum Mainnet => Polygon Mainnet_ and _Polygon Mainnet => Ethereum Mainnet_ are two different lanes.

## Decentralized Oracle Network (DON)

Expand Down
80 changes: 41 additions & 39 deletions src/content/ccip/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,104 +16,106 @@ import { CodeSample, ClickToZoom, CopyText, Aside } from "@components"

A simple use case for Chainlink CCIP is sending data between smart contracts on different blockchains. This guide shows you how to deploy a CCIP sender contract and a CCIP receiver contract to two different blockchains and send data from the sender contract to the receiver contract. You pay the CCIP fees using LINK.

Fees can also be paid in alternative assets, which currently include the native gas tokens of the source blockchain and their ERC20 wrapped version. For example, you can pay ETH or WETH when you send transactions to the CCIP router on Ethereum and MATIC or WMATIC when you send transactions to the CCIP router on Polygon.
Fees can also be paid in alternative assets, which currently include the native gas tokens of the source blockchain and their ERC20 wrapped version. For example, you can pay ETH or WETH when you send transactions to the CCIP router on Ethereum and AVAX or WAVAX when you send transactions to the CCIP router on Avalanche.

## Before you begin

- If you are new to smart contract development, learn how to [Deploy Your First Smart Contract](/quickstarts/deploy-your-first-contract) so you are familiar with the tools that are necessary for this guide:
- The [Solidity](https://soliditylang.org/) programming language
- The [MetaMask](https://metamask.io) wallet
- The [Remix](https://remix.ethereum.org/) development environment
- Acquire testnet funds. This guide requires a testnet ETH and LINK on _Ethereum Sepolia_. It also requires testnet MATIC on _Polygon Mumbai_. If you need to use different networks, you can find more faucets on the [LINK Token Contracts](/resources/link-token-contracts) page.
- Go to [faucets.chain.link](https://faucets.chain.link/) and get testnet ETH and LINK on _Ethereum Sepolia_.
- Go to [faucet.polygon.technology](https://faucet.polygon.technology/) to acquire testnet MATIC.
- Acquire testnet funds. This guide requires testnet AVAX and LINK on _Avalanche Fuji_. It also requires testnet ETH on _Ethereum Sepolia_. If you need to use different networks, you can find more faucets on the [LINK Token Contracts](/resources/link-token-contracts) page.
- Go to [faucets.chain.link](https://faucets.chain.link/) to get your testnet tokens.
- Learn how to [Fund your contract with LINK](/resources/fund-your-contract).

## Deploy the sender contract

Deploy the `Sender.sol` contract on _Ethereum Sepolia_. To see a detailed explanation of this contract, read the [Code Explanation](#sender-code) section.
Deploy the `Sender.sol` contract on _Avalanche Fuji_. To see a detailed explanation of this contract, read the [Code Explanation](#sender-code) section.

1. [Open the Sender.sol contract](https://remix.ethereum.org/#url=https://docs.chain.link/samples/CCIP/Sender.sol) in Remix.

<CodeSample src="samples/CCIP/Sender.sol" showButtonOnly={true} />

1. Compile the contract.

1. Deploy the sender contract on _Ethereum Sepolia_:
1. Deploy the sender contract on _Avalanche Fuji_:

1. Open MetaMask and select the _Ethereum Sepolia_ network.
1. In Remix under the **Deploy & Run Transactions** tab, select _Injected Provider - MetaMask_ in the **Environment** list. Remix will use the MetaMask wallet to communicate with _Ethereum Sepolia_.
1. Under the **Deploy** section, fill in the router address and the LINK token contract addresses for your specific blockchain. You can find both of these addresses on the [Supported Networks](/ccip/supported-networks) page. The LINK token contract address is also listed on the [LINK Token Contracts](/resources/link-token-contracts) page. For _Ethereum Sepolia_, the router address is <CopyText text="0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59" code/> and the LINK address is <CopyText text="0x779877A7B0D9E8603169DdbD7836e478b4624789" code/>.
1. Open MetaMask and select the _Avalanche Fuji_ network.
1. In Remix under the **Deploy & Run Transactions** tab, select _Injected Provider - MetaMask_ in the **Environment** list. Remix will use the MetaMask wallet to communicate with _Avalanche Fuji_.
1. Under the **Deploy** section, fill in the router address and the LINK token contract addresses for your specific blockchain. You can find both of these addresses on the [Supported Networks](/ccip/supported-networks) page. The LINK token contract address is also listed on the [LINK Token Contracts](/resources/link-token-contracts) page. For _Avalanche Fuji_, the router address is <CopyText text="0xF694E193200268f9a4868e4Aa017A0118C9a8177" code/> and the LINK address is <CopyText text="0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846" code/>.

<ClickToZoom src="/images/ccip/tutorials/deploy-sender-sepolia.jpg" alt="Chainlink CCIP deploy sender Sepolia" />
<ClickToZoom
src="/images/ccip/tutorials/deploy-sender-avalanche-fuji.webp"
alt="Chainlink CCIP deploy sender Avalanche Fuji"
/>

1. Click the **Deploy** button to deploy the contract. MetaMask prompts you to confirm the transaction. Check the transaction details to make sure you are deploying the contract to _Ethereum Sepolia_.
1. Click the **transact** button to deploy the contract. MetaMask prompts you to confirm the transaction. Check the transaction details to make sure you are deploying the contract to _Avalanche Fuji_.

1. After you confirm the transaction, the contract address appears in the **Deployed Contracts** list. Copy your contract address.

<ClickToZoom
src="/images/ccip/tutorials/deployed-sender-sepolia.jpg"
alt="Chainlink CCIP Deployed sender Sepolia"
src="/images/ccip/tutorials/deployed-sender-avalanche-fuji.webp"
alt="Chainlink CCIP Deployed sender Avalanche Fuji"
style="max-width: 70%;"
/>

1. Open MetaMask and send <CopyText text="0.1" code/> LINK to the contract address that you copied. Your contract will pay CCIP fees in LINK.

<ClickToZoom
src="/images/ccip/tutorials/fund-deployed-sender-sepolia.jpg"
alt="Chainlink CCIP fund deployed sender Sepolia"
src="/images/ccip/tutorials/fund-deployed-sender-avalanche-fuji.webp"
alt="Chainlink CCIP fund deployed sender Avalanche Fuji"
/>

## Deploy the receiver contract

Deploy the receiver contract on _Polygon Mumbai_. You will use this contract to receive data from the sender that you deployed on _Ethereum Sepolia_. To see a detailed explanation of this contract, read the [Code Explanation](#receiver-code) section.
Deploy the receiver contract on _Ethereum Sepolia_. You will use this contract to receive data from the sender that you deployed on _Avalanche Fuji_. To see a detailed explanation of this contract, read the [Code Explanation](#receiver-code) section.

1. [Open the Receiver.sol](https://remix.ethereum.org/#url=https://docs.chain.link/samples/CCIP/Receiver.sol) contract in Remix.

<CodeSample src="samples/CCIP/Receiver.sol" showButtonOnly={true} />

1. Compile the contract.

1. Deploy the receiver contract on _Polygon Mumbai_:
1. Deploy the receiver contract on _Ethereum Sepolia_:

1. Open MetaMask and select the _Polygon Mumbai_ network.
1. Open MetaMask and select the _Ethereum Sepolia_ network.

1. In Remix under the **Deploy & Run Transactions** tab, make sure the **Environment** is still set to _Injected Provider - MetaMask_.
1. Under the **Deploy** section, fill in the router address field. For _Polygon Mumbai_, the Router address is <CopyText text="0x1035CabC275068e0F4b745A29CEDf38E13aF41b1" code/>. You can find the addresses for each network on the [Supported Networks](/ccip/supported-networks) page.
1. Under the **Deploy** section, fill in the router address field. For _Ethereum Sepolia_, the Router address is <CopyText text="0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59" code/>. You can find the addresses for each network on the [Supported Networks](/ccip/supported-networks) page.

<ClickToZoom
src="/images/ccip/tutorials/deploy-receiver-mumbai.jpg"
alt="Chainlink CCIP Deploy receiver Mumbai"
src="/images/ccip/tutorials/deploy-receiver-sepolia.webp"
alt="Chainlink CCIP Deploy receiver Sepolia"
/>

1. Click the **Deploy** button to deploy the contract. MetaMask prompts you to confirm the transaction. Check the transaction details to make sure you are deploying the contract to _Polygon Mumbai_.
1. Click the **Deploy** button to deploy the contract. MetaMask prompts you to confirm the transaction. Check the transaction details to make sure you are deploying the contract to _Ethereum Sepolia_.

1. After you confirm the transaction, the contract address appears as the second item in the **Deployed Contracts** list. Copy this contract address.

<ClickToZoom
src="/images/ccip/tutorials/deployed-receiver-mumbai.jpg"
alt="Chainlink CCIP deployed receiver Mumbai"
src="/images/ccip/tutorials/deployed-receiver-sepolia.webp"
alt="Chainlink CCIP deployed receiver Sepolia"
style="max-width: 70%;"
/>

You now have one _sender_ contract on _Ethereum Sepolia_ and one _receiver_ contract on _Polygon Mumbai_. You sent `0.1` LINK to the _sender_ contract to pay the CCIP fees. Next, send data from the sender contract to the receiver contract.
You now have one _sender_ contract on _Avalanche Fuji_ and one _receiver_ contract on _Ethereum Sepolia_. You sent `0.1` LINK to the _sender_ contract to pay the CCIP fees. Next, send data from the sender contract to the receiver contract.

## Send data

Send a `Hello World!` string from your contract on _Ethereum Sepolia_ to the contract you deployed on _Polygon Mumbai_:
Send a `Hello World!` string from your contract on _Avalanche Fuji_ to the contract you deployed on _Ethereum Sepolia_:

1. Open MetaMask and select the _Ethereum Sepolia_ network.
1. Open MetaMask and select the _Avalanche Fuji_ network.
1. In Remix under the **Deploy & Run Transactions** tab, expand the first contract in the **Deployed Contracts** section.
1. Expand the **sendMessage** function and fill in the following arguments:

| Argument | Description | Value (_Polygon Mumbai_) |
| Argument | Description | Value (_Ethereum Sepolia_) |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
| destinationChainSelector | CCIP Chain identifier of the target blockchain. You can find each network's chain selector on the [ supported networks page ](/ccip/supported-networks) | <CopyText text="12532609583862916517" code/> |
| destinationChainSelector | CCIP Chain identifier of the target blockchain. You can find each network's chain selector on the [ supported networks page ](/ccip/supported-networks) | <CopyText text="16015286601757825753" code/> |
| receiver | The destination smart contract address | Your deployed contract address |
| text | Any `string` | <CopyText text="Hello World!" code/> |

<ClickToZoom
src="/images/ccip/tutorials/sepolia-sendmessage.jpg"
src="/images/ccip/tutorials/fuji-sendmessage.webp"
alt="Chainlink CCIP Sepolia send message"
style="max-width: 70%;"
/>
Expand All @@ -125,35 +127,35 @@ Send a `Hello World!` string from your contract on _Ethereum Sepolia_ to the con
transaction fails, fund your contract with more _LINK_ tokens and try again.
</Aside>

1. After the transaction is successful, note the transaction hash. Here is an [example](https://sepolia.etherscan.io/tx/0x79cc7b6686a0a9744540cfefac24f1ecb830be1c4025116886a7d0c55bee06ce) of a successful transaction on _Ethereum Sepolia_.
1. After the transaction is successful, note the transaction hash. Here is an [example](https://testnet.snowtrace.io/tx/0x113933ec9f1b2e795a1e2f564c9d452db92d3e9a150545712687eb546916e633) of a successful transaction on _Avalanche Fuji_.

After the transaction is finalized on the source chain, it will take a few minutes for CCIP to deliver the data to _Polygon Mumbai_ and call the `ccipReceive` function on your receiver contract. You can use the [CCIP explorer](https://ccip.chain.link/) to see the status of your CCIP transaction and then read data stored by your receiver contract.
After the transaction is finalized on the source chain, it will take a few minutes for CCIP to deliver the data to _Ethereum Sepolia_ and call the `ccipReceive` function on your receiver contract. You can use the [CCIP explorer](https://ccip.chain.link/) to see the status of your CCIP transaction and then read data stored by your receiver contract.

1. Open the [CCIP explorer](https://ccip.chain.link/) and use the transaction hash that you copied to search for your cross-chain transaction. The explorer provides several details about your request.

<ClickToZoom
src="/images/ccip/tutorials/ccip-explorer-tx-details.jpg"
src="/images/ccip/tutorials/ccip-explorer-tx-details.webp"
alt="Chainlink CCIP Explorer transaction details"
/>

1. When the status of the transaction is marked with a "Success" status, the CCIP transaction and the destination transaction are complete.

<ClickToZoom
src="/images/ccip/tutorials/ccip-explorer-tx-details-success.jpg"
src="/images/ccip/tutorials/ccip-explorer-tx-details-success.webp"
alt="Chainlink CCIP Explorer transaction details success"
/>

## Read data

Read data stored by the receiver contract on _Polygon Mumbai_:
Read data stored by the receiver contract on _Ethereum Sepolia_:

1. Open MetaMask and select the _Polygon Mumbai_ network.
1. In Remix under the **Deploy & Run Transactions** tab, open the list of contracts of your smart contract deployed on _Polygon Mumbai_.
1. Open MetaMask and select the _Ethereum Sepolia_ network.
1. In Remix under the **Deploy & Run Transactions** tab, expand the receiver contract deployed on _Ethereum Sepolia_.
1. Click the **getLastReceivedMessageDetails** function button to read the stored data. In this example, it is "Hello World!".

<ClickToZoom
src="/images/ccip/tutorials/mumbai-getmessagedetails.jpg"
alt="Chainlink CCIP Mumbai message details"
src="/images/ccip/tutorials/sepolia-getmessagedetails.webp"
alt="Chainlink CCIP Sepolia message details"
style="max-width: 70%;"
/>

Expand Down
Loading