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

Hands-On

Refer to all the code from this gist 👇

Sepolia

  1. MyNFT
    We're using https://wizard.openzeppelin.com/#erc721
    Try visit testnet.opensea.com after deployed
  2. CCIPTokenAndDataReceiver.sol

Avalanche Fuji

3. CCIPTokenAndDataSender.sol

Steps

  1. We deployed MyNFT, CCIPTokenAndDataReceiver on Sepolia
  2. Change the chain to Avalanche Fuji, Then we deployed CCIPTokenAndDataSender on Fuji
  3. Supply LINK to CCIPTokenAndDataSender contract
  4. 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