Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kaymen99/classydogs-nft-project

A complete NFT project for the Classy Dogs collection with art-generator, whitelisting, presale and reveal.
https://github.com/kaymen99/classydogs-nft-project

hardhat hashlips-art-engine minting-nfts mintingwebsite nft-collection nft-project nfts react solidity

Last synced: about 2 months ago
JSON representation

A complete NFT project for the Classy Dogs collection with art-generator, whitelisting, presale and reveal.

Awesome Lists containing this project

README

        

# Classy-Dogs-NFT-Project

A complete NFT project from start to finish with +10000 ClassyDogs collection created with an art generator, development and testing of the ERC721 contract and a minting dapp which enables whitelisting, presale and nfts reveal.


Dark

### Built With

* [Solidity](https://docs.soliditylang.org/)
* [Hardhat](https://hardhat.org/getting-started/)
* [React.js](https://reactjs.org/)
* [ethers.js](https://docs.ethers.io/v5/)
* [web3modal](https://github.com/Web3Modal/web3modal)
* [material ui](https://mui.com/getting-started/installation/)

Table of Contents



  1. Project structure



  2. How to Run


  3. Ressources

  4. Contact

  5. License

## Project Structure

### Art generator

It would take an insane amount of time to manually generate 10000 NFTs and create their metadata, so it's common for all NFT projects to programmatically design those items and then store them into IPFS. In this project i used a modified version of the [hashlip art engine](https://github.com/HashLips/hashlips_art_engine), this engine supports multiple layers setup, layers shuffling and items raritites, the source code can be found in the art_generator folder, the structure is as follows :

* layers folder : it's the location where you put the different layers used in the creation of the images like: background, eyes, mouths,...
* src folder it contains two files :


  • config.js : it contains the configuration for the NFT collection like : layers names and orders, attributes, weights, collection size, images format...

  • main.js : the core of the engine it uses the information from the config file to draw the different layers and then save the resulting image and it's metadata into the build folder.

### Smart contracts

The contract development and testing is done using the Hardhat framework in the smart_contracts folder, for this project there is two version of the ERC721 : the traditional ERC721Enumerable and the gas optimised ERC721A but currently only the first version is used. The ERC721 contract was modified to enable users whitelisting, custom minting prices and NFT reveal.

In the smart_contracts folder you'll find the deployment and testing scripts in the scripts and tests folder respectively, and there is also a config folder where you must provide your collection informations like token name & symbol, minting price for whitelisting, presale and public sale period and the whitelisted addresses...

### User interface

The front end is built with React JS, it allows users to mint new NFTS and they can find on the home page a complete roadmap for the entire NFT project, the app also give a simple admin dashboard for setting minting prices and managing the sales period ( whitelisting, presale, public sale).

The front-end is built using the following libraries:



  • Ethers.js: used as interface between the UI and the deployed smart contract


  • Web3modal: for conecting to Metamask


  • @reduxjs/toolkit & redux-persist: for managing the app states (account, balance, blockchain)


  • Material UI: used for react components and styles



The main component is Mint.js which handles the nft minting and the coundown periods :

![Capture d’écran 2022-08-23 à 23 04 48](https://user-images.githubusercontent.com/83681204/186274665-e2d7c1a4-c2b0-412d-93d2-6eb4be03eaba.png)

The roadmap explains the steps followed in the NFT project progression :

![Capture d’écran 2022-07-04 à 18 58 28](https://user-images.githubusercontent.com/83681204/177201365-c446e19d-f5c8-4ee8-bf58-afbc9051f646.png)

The dashboard can only be accessed by the nft contract owner from the account window when clicking on the account button in the top of the page, it gives the owner the possibility of withdraw the contract balance, changing nft minting parametres or changing contract state (whitelisting, presale, public sale):

![Capture d’écran 2022-08-03 à 21 07 41](https://user-images.githubusercontent.com/83681204/182701220-af3fd413-18dc-4f51-b253-674e0d85a863.png)

(back to top)

## How to Run

### Prerequisites

Please install or have installed the following:
* [nodejs](https://nodejs.org/en/download/) and [yarn](https://classic.yarnpkg.com/en/)
* [MetaMask](https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn) Chrome extension installed in your browser
* [Ganache](https://trufflesuite.com/ganache/) for local smart contracts deployement and testing
* [Pinata](https://www.pinata.cloud) account for IPFS storage (free account).

### Art generation

After installing node open a terminal in your code editor (VS Code for example) and clone this repository :
```sh
git clone https://github.com/kaymen99/ClassyDogs-NFT-Project.git
cd ClassyDogs-NFT-Project
```

Then install the art engine dependancies by running :
```sh
cd nft_generator
yarn
```

This will install all the libraries needed for creating the nfts, the next step is to add the differents layers, the art used for this collection is not of my creation, the orginal images can be downloaded [here](https://www.firevectors.com/2022/03/free-nft-layers-download.html?m=1) or you can use the ones i already edited and added rarities to them (the folder size was too big so i couldn't upload to Github), you can get them from Google drive with this [link](https://drive.google.com/drive/folders/1za0Wg11BrowiIOaWEGb2UE4fJexoJi5e?usp=sharing).

In the config file you can change the collection name and description (if you want), you can choose how many items you want to generate by changing the `growEditionSizeTo` variable and also the images size (format).

After finishing the configuration run the command to generate the items :
```sh
yarn build
```

When the build ends you'll find the generated images in the images folder inside th build folder and their respective metadata in the json folder, the next step is to upload the images folder to IPFS with your previously created Pinata account, you can then copy the resulting CID and paste it in the config file :
```sh
const baseUri = "ipfs://YOUR-IMAGES-CID";
```
Update the URIs for all the NFTs metadata files by running this command :

```sh
yarn update_info
```
Now upload the final json folder to IPFS as you did with images folder.

Finally in the build folder you'll also find a hidden folder which contains the hidden NFT image & metadata used in the collection pre-reveal step,the hidden image must be uploaded to IPFS and its CID should be copied to the hidden metadata file which in the end must also be uploaded to IPFS to get the final hidden NFT URI.

If you find problems going through the upload part you can refere back to hashlips Youtube video which explain each step perfectly [How to create an NFT collection - Masterclass](https://www.youtube.com/watch?v=Zhmj4PiJ-GA)

### Contracts

As mentioned before the contracts are developed with the Hardhat framework, before deploying them you must first install the required dependancies by running :
```sh
cd smart_contracts
yarn
```

Next you need to setup the environement variables in the .env file, this are used when deploying the contracts :

```sh
POLYGONSCAN_API_KEY = 'your polygonscan api key'
POLYGON_RPC_URL="Your polygon RPC url from alchemy or infura"
MUMBAI_RPC_URL="Your mumbai RPC url from alchemy or infura"
PRIVATE_KEY="your private key"
```
* NOTE : Only the private key is needed when deploying to the ganache network, the others variables are for deploying to the testnets or real networks and etherscan api key is for verifying your contracts on rinkeby etherscan.

Then in the config folder you'll find the collection config file where you must add the NFT name & decription and the IPFS CID for both the nfts and the hidden nft those you get from pinata, you can also change the minting cost and the maximum supply.
```sh
tokenName: "Classy Dogs Collection",
tokenSymbol: 'CD',
baseMetadataURI: "ipfs://YOUR-NFT-CID/",
hiddenMetadataUri: 'ipfs://YOUR-Hidden-NFT-CID',
maxSupply: 10000,
whitelistSale: {
price: 0.05,
maxMintAmountPerTx: 1,
},
preSale: {
price: 0.07,
maxMintAmountPerTx: 3,
},
publicSale: {
price: 0.09,
maxMintAmountPerTx: 5,
},
```

After going through all the configuration step, you'll need to deploy the smart contract to the ganache network by running:
```sh
yarn deploy --network ganache
```
This will create a config.js file and an artifacts folder and transfer them to the src folder to enable the interaction between the contract and the UI

* IMPORTANT : I used the ganache network for development purposes only, you can choose another testnet or real network if you want, for that you need to add it to the hardhat.config file for example for the polygon mumbai testnet :

```sh
mumbai: {
url: MUMBAI_RPC_URL,
accounts: [process.env.PRIVATE_KEY],
chainId: 80001,
}
```

If you want to test the functionnalities of the NFT contract you can do it by running:
```sh
yarn test
```
### Front end

To start the user interface just run the following commands :
```sh
cd front-end
yarn
yarn start
```

(back to top)

## Ressources

If you want to learn more about NFT projects, these great tutorials may help:
* [How to create an NFT collection - Masterclass](https://www.youtube.com/watch?v=Zhmj4PiJ-GA) by hashlips
* [BEST NFT Collection Minting Site (dApp) - Entire Process! Whitelist & Launch a Collection (10,000+)](https://www.youtube.com/watch?v=cLB7u0KQFIs&t=270s)

(back to top)

## Contact

If you have any question or problem running this project just contact me: [email protected]

(back to top)

## License

Distributed under the MIT License. See `LICENSE.txt` for more information.

(back to top)