Skip to content

router-resources/Workshop-ERC20

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 

Repository files navigation

CrossChain ERC-20 Step by Step Guide

Effortlessly transfer ERC-20 tokens from one chain to another. Made using Router Cross-Talk.

This project is built with Router CrossTalk

Router Protocol is a solution introduced to address the issues hindering the usability of cross-chain liquidity migration in the DeFi ecosystem. It acts as a bridge connecting various layer 1 and layer 2 blockchains, allowing for the flow of contract-level data across them. The Router Protocol can either transfer tokens between chains or initiate operations on one chain and execute them on another.

Please check the official documentation of Router Protocol

⭐️ Star us

If this repository helps you build cross-chain dapps faster and easier - please star this project, every star makes us very happy!

🤝 Need help?

If you need help or have other some questions - don't hesitate to write in our discord channel and we will check asap. Discord link. The best thing about this is the super active community ready to help at any time! We help each other.

✌️Let's Begin 🚀

Step 1) Open Remix IDE https://remix.ethereum.org/

Step 2) Create a new workspace

image

Step 3) Create a new file, give a name and save it with ".sol" extension

image

Step 4) Copy the code from CrossChainERC20.sol and paste it in the editing area

image

Step 5) Install Metamask extension from https://metamask.io/download/ and to your browser

image

Step 6) Open the extension and click on Create Wallet

image

Step 7) Set a password for your wallet

image

Step 8) Select either of the 2 options. Securing your wallet is recommended.But for the time being, we can go with the 1st option.

image

Step 9) Connect to Mumbai Network :-

  1. Go to https://mumbai.polygonscan.com/
  2. Scroll down to the bottom end and click on Add Mumbai Network

image

Step 10) Connect to Fuji Network :-

  1. Go to https://testnet.snowtrace.io/
  2. Scroll down to the bottom end and click on Add C-Chain ( Fuji ) Network

image

Step 11) Come to Remix again and compile the code ( ctrl + s )

Step 12) Select Inject Provider from Environments in Deployments section

image

Step 13) Switch to Fuji Network and copy your wallet address

image

Step 14) Add faucet to your account by visiting https://faucet.avax.network/ and pasting your wallet address and then click on REQUEST 2 AVAX

image

Step 15) Switch to Mumbai Network https://mumbai.polygonscan.com/ and copy your wallet address

Step 16) Add faucet to your account by visiting https://faucet.polygon.technology/ and pasting your wallet address and then click on Submit

image

Step 17) Come back to Remix and switch to Fuji Network

Step 18) Deploy the contract by passing Gateway address corresponding to Fuji and feePayer as your wallet address

Step 19) Switch to Mumbai Network and deploy the contract by passing Gateway address corresponding to Mumbai and keeping the feepayer same or differeent than on Fuji

Gateway addresses for respective chains can be found here https://lcd.testnet.routerchain.dev//router-protocol/router-chain/multichain/chain_config

Step 20) Switch to Fuji Network again and call setContractOnChain
Function of the Fuji contract passing in 80001 and address of the Mumbai contract deployed respectively

image

Step 21) Switch to Mumbai Network and call setContractOnChain
Function of the Mumbai contract passing in 43113 and address of the Fuji Contract Deployed

Step 22) Switch to Fuji Network and mint some ERC20 Tokens through mint function of the Fuji contract deployed

image

Step 23) Generate request metadata by passing in the following parameters to getRequestMetadata function on Fuji Contract and calling it.

image

Step 24) Call TransferCrossChain function of the Fuji contract deployed , passing in the amount of tokens you want to send in amount ,80001 in destChainId, Wallet Address you want to send the tokens to on Mumbai in recipient as the first three parameters .

image

Step 24) Go to getRequestMetadata function and copy the generated Metadata and paste it as the 4th parameter in transferCrossChain function and click on call

Step 25) Visit Router Testnet Explorer https://explorer.testnet.routerchain.dev/feePayer and switch to Router Testnet by clicking on switch

image

Step 26) Search for your Fuji Contract address and click on approve

image

image

Step 27) Come to CrossChain section and find your transaction.

image

Step 28) Open your transaction and wait till all 5 checks are green in Destination Timeline

image

Step 29) Call the function , totalSupply of the Mumbai contract deployed to see the ERC20 tokens transferred

Step 30) Earn your NFT Certificate . Fill the below form.

https://docs.google.com/forms/d/e/1FAIpQLSd8Xuiuw32kOqGsWmT5s7GLjLVZ_rHXw9bAJbdbr0XzrVG6RA/viewform?embedded=true

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published