Code Monkey home page Code Monkey logo

hardhat-nft-smart-contract's Introduction

Hardhat NFT Smart Contract

This smart contract is for minting NFTs and has features for allowlist mint and public mint. Since ERC721A is used, it significantly reduces gas (you can mint multiple NFTs at essentially the same cost as minting a single NFT!). Besides that, it is designed to reduce gas as much as possible.

More features:

  • A mocked contract for testing
  • An unit test example for testing the contracts
  • Automatically verify the source code for the contract on Etherscan when deploying
  • A feature for updating shared files on the front end (dApp)
  • Scripts for opening allowlist/public sale, close sales, and reveal your collection

Usage

1 . Clone this repo:

git clone https://github.com/kjmczk/hardhat-nft-smart-contract.git

2 . Change into the directory:

cd hardhat-nft-smart-contract

3 . Install dependencies:

npm install

4 . Set up environment variables:

cp .env.example .env

Replace the values of the variables you need in the .env file with yours.

5 . Set up project-config.ts:

  • Replace the file paths with yours
  • Replace hiddenMetadataUri with yours

Commands

Test

npx hardhat test

Deploy

1 . Network: hardhat(default):

npx hardhat deploy

2 . Network: localhost:

npx hardhat node

Launch another terminal and run the following command:

npx hardhat deploy --network localhost

3 . Network: rinkeby/mainnet/mumbai/polygon:

npx hardhat deploy --network <networkName>

4 . Tags:

Deploying without the --tags <tags> option runs all deploy scripts in the deploy directory.

For example, if you want to run only deploy/02-update-front-end.ts using the rinkeby network:

npx hardhat deploy --network rinkeby --tags updateFrontEnd

The tag name is set at the bottom of the deploy script file.

Using Hardhat Network and running only deploy/02-update-front-end.ts will result in an error.

Scripts

1 . Open allowlist sale:

npm run open-allowlist -- --network <networkName>

2 . Open public sale:

npm run open-public -- --network <networkName>

3 . Close sales:

npm run close -- --network <networkName>

4 . Reveal collection:

npm run reveal -- --network <networkName>

A dApp for front end

A sample dApp for this contract is available!

hardhat-nft-smart-contract's People

Contributors

komzweb avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.