ShivamGupta92 / METACRAFTERS-POLYGON-MODULE-1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

METACRAFTERS-POLYGON-MODULE-1

Building with Polygon Bridge

Project

  • For this project, I will deploy an NFT collection on the Ethereum blockchain
  • Map the collection to Polygon
  • Transfer assets over via the Polygon Bridge.

Dependencies

  • Generate a 5-item collection using DALLE 2 or Midjourney
  • Store items on IPFS using pinata.cloud
  • Deploy an ERC721 or ERC1155 to the Goerli Ethereum Testnet
  • You should have a promptDescription function on the contract that returns the prompt you used to generate the images
  • Map Your NFT Collection using Polygon network token mapper. Note: this isn’t necessary but helpful for visualization.
  • Write a hardhat script to batch mint all NFTs. Hint: ERC721A is optimal here.
  • Write a hardhat script to batch transfer all NFTs from Ethereum to Polygon Mumbai using the FxPortal Bridge
  • Approve the NFTs to be transferred
  • Deposit the NFTs to the Bridge
  • Test balanceOf on Mumbai

Contract deployement and Program Execution

  1. clone the repository :
git clone https://github.com/ShivamGupta92/METACRAFTERS-POLYGON-MODULE-1.git
  1. Run following commands after changeing directory
npm i
  1. Add your environment variables in .env file.

  2. This will generate a contract address that will get written in contractAddress.js in metadata folder. Paste that address into batchMint.js and also in approveDeposit.js

npx hardhat run scripts/deploy.js --network goerli 
  1. This will batch Mint all the nfts stored in pinata cloud
npx hardhat run scripts/batchMint.js --network goerli

Time to map network and set bridging in motion

Go to https://mapper.polygon.technology/map and use deployed contract address to Map. Approve the mapping by paying required gas fee.

Wait for a good 20-30 minute for mapping to complete view it here: https://mapper.polygon.technology/

npx hardhat run scripts/approveDeposit.js --network goerli

Running this will first approve the transfer to FxPortal bridge and then will transfer to Polygon Mumbai Finaly all the BirdOfParadise NFT's will be transfered from Ethereum to Polygon Network usiing fxPortal Bridge.

And Balance in Eth will become 0 and in Polygon Mumbai 5 NFT's

console Output

image image

Visualization and Links

image

image

image

image

image

https://goerli.etherscan.io/address/0x919a50c80ab3de90613d8031b90457b2922968cf https://mumbai.polygonscan.com/token/0xfc8e8c05329432f9604897dc2cf6c263a8f947ca

Author

Shivam Gupta

LICENSE

This project is licensed under the MIT License.

About

License:MIT License


Languages

Language:JavaScript 91.5%Language:Solidity 8.5%