Skip to content

Onasachi/Polygon_NFTs

Repository files navigation

Overview


This project involves the creation and deployment of an ERC721A-compliant NFT (Non-Fungible Token) contract named MetaTokenNFT on Sepolia Ethereum testnet then approve and deposit the NFT to Polygon Amoy using their fxPortal bridge.

Getting Started


Prerequisites

  • Install nvm.
  • Use Node.js version 18 or higher.
nvm install 18
nvm use 18

Project Initialization


git clone <this-repo-url>
cd <the-repo>
npm install

Configuration


Deploy contract

First compile the contract using npx hardhat compile then deploy the contract onto Sepolia Ethereum testnet using the following command:

npx hardhat run --network sepolia scripts/nft/deploy.js

Then, if everything is set up right, you get a console response like this:

MetaToken NFT deployed to: <CONTRACT-ADDRESS>

Batch mint NFTs

To batch mint NFTs to the deployed contract, update the contract address in the .env.example. file and rename the file to .env. Also, subsequently update the required variables in the .env file.

Then run the batchMint.js script with this hardhat command:

npx hardhat run --network sepolia scripts/nft/batchMint.js

The response log will look like:

Successfully minted: <number> MetaToken NFTs to <WALLET-ADDRESS>

Approve transfer and deposit the NFTs to Polygon bridge

Pass in the Polygon Amoy bridged address of your contract to BRIDGE-ADDRESS in .env, then run the approveTransfer.js script with hardhat:

npx hardhat run --network sepolia scripts/nft/approveTransfer.js

The response should look like this:

NFT approval confirmed
NFT deposited on Polygon Amoy

Author

Onanike Samuel Chisom @samtheanalysts

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •