Skip to content
/ NFT Public

ERC721 and ERC1155 standards token contracts.

Notifications You must be signed in to change notification settings

kot2271/NFT

Repository files navigation

NFT

Installation

Clone the repository using the following command: Install the dependencies using the following command:

npm i

ERC721 Token

OpenSea

Mumbai

Deployment

Fill in all the required environment variables(copy .env-example to .env and fill it).

Deploy contract to the chain (polygon-mumbai):

npx hardhat run scripts/deploy/erc721Deploy.ts --network polygonMumbai

Verify

Verify the installation by running the following command:

npx hardhat verify --network polygonMumbai {CONTRACT_ADDRESS}

Tasks

Create a new task(s) and save it(them) in the folder "tasks". Add a new task_name in the file "tasks/index.ts"

Running a mint task:

npx hardhat mintERC721 --contract {ERC721_CONTRACT_ADDRESS} --token-id {TOKEN_ID} --to {ADDRESS_TO_RECEIVE_TOKEN} --token-uri {TOKEN_URI} --network polygonMumbai

Running a burn task:

npx hardhat burnERC721 --contract {ERC721_CONTRACT_ADDRESS} --token-id {TOKEN_ID} --network polygonMumbai

Running a tokenURI task:

npx hardhat tokenUriERC721 --contract {ERC721_CONTRACT_ADDRESS} --token-id {TOKEN_ID} --network polygonMumbai

Running a balanceOf task:

npx hardhat balanceOfERC721 --contract {ERC721_CONTRACT_ADDRESS} --address {ADDERSS_TO_CHECK} --network polygonMumbai

Running a ownerOf task:

npx hardhat ownerOfERC721 --contract {ERC721_CONTRACT_ADDRESS} --token-id {TOKEN_ID} --network polygonMumbai

Running a setApprovalForAll task:

npx hardhat setApprovalForAllERC721 --contract {ERC721_CONTRACT_ADDRESS} --operator {ADDRESS_TO_GRANT_APPROVAL} --approved {TRUE/FALSE} --network polygonMumbai

Running a isApprovedForAll task:

npx hardhat isApprovedForAllERC721 --contract {ERC721_CONTRACT_ADDRESS} --owner {TOKEN_OWNER_ADDRESS} --operator {ADDRESS_TO_GRANT_APPROVAL} --network polygonMumbai

Running a approve task:

npx hardhat approveERC721 --contract {ERC721_CONTRACT_ADDRESS} --to {ADDRESS_TO_GRANT_PERMISSION} --token-id {TOKEN_ID} --network polygonMumbai

Running a getApproved task:

npx hardhat getApprovedERC721 --contract {ERC721_CONTRACT_ADDRESS} --token-id {TOKEN_ID} --network polygonMumbai

Running a transferFrom task:

npx hardhat transferFromERC721 --contract {ERC721_CONTRACT_ADDRESS} --from {ADDRESS_CURRENTLY_HOLDING_TOKEN} --to {ADDRESS_TO_RECEIVE_TOKEN} --token-id {TOKEN_ID} --network polygonMumbai

Running a safeTransferFrom task:

npx hardhat safeTransferFromERC721 --contract {ERC721_CONTRACT_ADDRESS} --from {ADDRESS_CURRENTLY_HOLDING_TOKEN} --to {ADDRESS_TO_RECEIVE_TOKEN} --token-id {TOKEN_ID} --network polygonMumbai

Running a safeTransferFromWithData task:

npx hardhat safeTransferFromWithDataERC721 --contract {ERC721_CONTRACT_ADDRESS} --from {ADDRESS_CURRENTLY_HOLDING_TOKEN} --to {ADDRESS_TO_RECEIVE_TOKEN} --token-id {TOKEN_ID} --network polygonMumbai

Running a supportsInterface task:

npx hardhat supportsInterfaceERC721 --contract {ERC721_CONTRACT_ADDRESS} --interface-id {BYTES4_ID_OF_INTERFACE} --network polygonMumbai

ERC1155 Token

OpenSea

Mumbai

Deployment

Fill in all the required environment variables(copy .env-example to .env and fill it).

Deploy contract to the chain (polygon-mumbai):

npx hardhat run scripts/deploy/erc1155Deploy.ts --network polygonMumbai

Verify

Verify the installation by running the following command:

npx hardhat verify --network polygonMumbai {CONTRACT_ADDRESS}

Tasks

Create a new task(s) and save it(them) in the folder "tasks". Add a new task_name in the file "tasks/index.ts"

Running a mint task:

npx hardhat mintERC1155 --contract {ERC1155_CONTRACT_ADDRESS} --token-id {TOKEN_ID} --to {ADDRESS_TO_RECEIVE_TOKEN} --amount {NUMBER_OF_TOKENS} --token-uri {TOKEN_URI} --network polygonMumbai

Running a balanceOf task:

npx hardhat balanceOfERC1155 --contract {ERC1155_CONTRACT_ADDRESS} --owner {ADDERSS_TO_CHECK} --token-id {TOKEN_ID} --network polygonMumbai

Running a safeTransferFrom task:

npx hardhat safeTransferFromERC1155 --contract {ERC1155_CONTRACT_ADDRESS} --from {ADDRESS_CURRENTLY_HOLDING_TOKEN} --to {ADDRESS_TO_RECEIVE_TOKEN} --token-id {TOKEN_ID} --amount {NUMBER_OF_TOKENS} --network polygonMumbai

Running a setApprovalForAll task:

npx hardhat setApprovalForAllERC1155 --contract {ERC1155_CONTRACT_ADDRESS} --owner {TOKEN_OWNER_ADDRESS} --operator {ADDRESS_TO_GRANT_APPROVAL} --approved {TRUE/FALSE} --network polygonMumbai

Running a safeBatchTransferFrom task:

npx hardhat safeBatchTransferFromERC1155 --contract {ERC1155_CONTRACT_ADDRESS} --from {ADDRESS_CURRENTLY_HOLDING_TOKEN} --to {ADDRESS_TO_RECEIVE_TOKEN} --token-ids {LIST_OF_TOKEN_IDS} --amounts {LIST_OF_AMOUNTS_TOKENS} --network polygonMumbai

Running a isApprovedForAll task:

npx hardhat isApprovedForAllERC1155 --contract {ERC1155_CONTRACT_ADDRESS} --owner {TOKEN_OWNER_ADDRESS} --operator {ADDRESS_TO_GRANT_APPROVAL} --network polygonMumbai

Running a burn task:

npx hardhat burnERC1155 --contract {ERC1155_CONTRACT_ADDRESS} --from {ADDRESS_CURRENTLY_HOLDING_TOKEN} --token-id {TOKEN_ID} --amount {NUMBER_OF_TOKENS} --network polygonMumbai

Running a supportsInterface task:

npx hardhat supportsInterfaceERC1155 --contract {ERC1155_CONTRACT_ADDRESS} --interface-id {BYTES4_ID_OF_INTERFACE} --network polygonMumbai

Running a tokenURI task:

npx hardhat tokenUriERC1155 --contract {ERC1155_CONTRACT_ADDRESS} --token-id {TOKEN_ID} --network polygonMumbai

MyERC1155_Contract: 0x7B4d25e0DD2DcA44Ae850CC1E2dFeAF98b436027

About

ERC721 and ERC1155 standards token contracts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published