First of all, I would like to say thank you to Solange Gueiros fellow Chainlink Developer Expert for a wonderful session (which I've used as a guide to wrote this article haha)
Outline
- Basic CCIP
- Smart Contracts structure
- Pre-requisite
- Hands-on
- Summary
Basic CCIP
Smart Contracts structure
We will create 3 smart contracts on 2 chains in this session and it would look somewhat similar to this.
Ethereum Sepolia
1. MyNFT.sol
2. CCIPTokenAndDataReceiver.sol
Avalanche Fuji
1. CCIPTokenAndDataSender.sol
Prerequisite
- Get ETH/LINK on Sepolia -> https://faucets.chain.link/sepolia
- Get AVAX/LINK on Fuji -> https://faucets.chain.link/fuji
Hands-On
Refer to all the code from this gist 👇
Sepolia
- MyNFT
We're using https://wizard.openzeppelin.com/#erc721
Try visit testnet.opensea.com after deployed - CCIPTokenAndDataReceiver.sol
Avalanche Fuji
3. CCIPTokenAndDataSender.sol
Steps
- We deployed MyNFT, CCIPTokenAndDataReceiver on Sepolia
- Change the chain to Avalanche Fuji, Then we deployed CCIPTokenAndDataSender on Fuji
- Supply LINK to CCIPTokenAndDataSender contract
- We can call mintNFT() on CCIPTokenAndDataSender to mint a new NFT on Sepolia!
Deployed Contract
Sepolia
MyNFT: 0xBF3d94450104487c25C2BEe4CA7E40eDD7caC73D
Receiver: 0x1d151E9c47f78742827e25F1D80fCE58cb2b6caE
Fuji
Sender: 0xd0FD63f94811d9Fd8f147f22bd94AbF21c1d0445
Success Transaction
TX Hash: 0x7d11de32d00fff6f9e46adbda885f93719daa4cadadbf31489302d47baac6116