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
If this repository helps you build cross-chain dapps faster and easier - please star this project, every star makes us very happy!
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.
Step 1) Open Remix IDE https://remix.ethereum.org/
Step 2) Create a new workspace
Step 3) Create a new file, give a name and save it with ".sol" extension
Step 4) Copy the code from CrossChainERC20.sol and paste it in the editing area
Step 5) Install Metamask extension from https://metamask.io/download/ and to your browser
Step 6) Open the extension and click on Create Wallet
Step 7) Set a password for your wallet
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.
Step 9) Connect to Mumbai Network :-
- Go to https://mumbai.polygonscan.com/
- Scroll down to the bottom end and click on Add Mumbai Network
Step 10) Connect to Fuji Network :-
- Go to https://testnet.snowtrace.io/
- Scroll down to the bottom end and click on Add C-Chain ( Fuji ) Network
Step 11) Come to Remix again and compile the code ( ctrl + s )
Step 12) Select Inject Provider from Environments in Deployments section
Step 13) Switch to Fuji Network and copy your wallet address
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
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
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
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
Step 23) Generate request metadata by passing in the following parameters to getRequestMetadata function on Fuji Contract and calling it.
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 .
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
Step 26) Search for your Fuji Contract address and click on approve
Step 27) Come to CrossChain section and find your transaction.
Step 28) Open your transaction and wait till all 5 checks are green in Destination Timeline
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.