This repo helps you learn to deploy and mint NFTs using Hardhat-deploy
and ethers.js
-
Requires minimal configuration
Just set up your
.env
file. -
Example ERC721
The included contract is barebone (for clarity) but functional.
ℹ️ the contract is intended for training purpose, it hasn't been vetted for production, use at your own risk.
-
Example scripts for minting and testing
-
Extra-functionalities thanks to
Hardhat-deploy
npx hardhat deploy
deploys only if your contract has changednpx hardhat test
enable test fixtures for faster testsnpx hardhat sourcify
simplifies the process of contract verification with Sourcify.dev
-
An INFURA account (optional)
This repo has been pre-configured to use INFURA as a convenience but you can choose any provider you wish.
-
Basic understanding of Ethereum/Solidity
-
Basic understanding of Hardhat
- Catch up with Hardhat here: Hardhat documentation
- Since this repo relies heavily on
hardhat-deploy
, you might want to read their README, too.
```bash
npm install
```
Fill out your env values in .example-env
then rename the file .env
:
ETH_NODE_URI_MAINNET=https://eth-mainnet.alchemyapi.io/v2/
ETH_NODE_URI=https://{{networkName}}.infura.io/v3/
MNEMONIC_MAINNET=
MNEMONIC=
```bash
npx hardhat compile
```
Start Hardhat's localhost network:
```bash
npx hardhat node
```
Deploy on localhost network:
ℹ️ You can choose the network you want to interact with by using the
--network
suffix.
```bash
npx hardhat deploy --network localhost
```
```bash
npx hardhat deploy --network production
```
```bash
npx hardhat mint-nft --token-uri "the-URI-of-your-NFT" --network production
```
```bash
npx hardhat test
```
```bash
npx hardhat --network mainnet sourcify
```
Credits to Ronan Sandford for creating Hardhat-deploy.
deploy-mainnet