What are we building?

We are going to build on-chain NFTs, that have different Tiers and prices.

In the previous lesson, we talked about NFTs and their use cases. If we can use an NFT to login to a web page, or to access a service, we can use them to differentiate between different levels or categories in said service. Think of some streaming services out there such as Netflix, Disney+, etc. Some have different levels of access depending on the subscription. We want to let users access different services depending on the NFT they mint and own.

Untitled

First things first 👷‍♂️

Before we start coding, we need to create our project template. We are going to follow the same steps as in previous lessons. Using our package manager (npm, yarn, etc) we create a Hardhat project and remove unnecessary files.

If you’ve done our previous lesson, it’s the exact same process. Make a note of remembering these steps and what they do, for we will use them a lot in the future.

Let’s first open a console and cd into our d_d_academy folder, or create it first if you don't have it. Then let's create a folder for our NFT project:

# (OPTIONAL) create a folder for our schoolofcode projects
mkdir d_d_academy
cd d_d_academy

# create a folder for this project
mkdir tierNFT
cd tierNFT

# initialize our folder as an npm package
npm init -y

# install hardhat (and its dependencies)
npm install --save-dev hardhat

# create a Hardhat project
npx hardhat

<aside> 💡 The --save-dev flag used in the last command, lets the project know it's a development dependency (not needed in production). You can view what dependencies are needed in the package.json file in the root of the project.

</aside>

Choose Create a Javascript project and hardhat will create an example project for us. It will give us 3 prompts for options. Choosing the defaults is ok for us. Here's what mine asked me:

✔ What do you want to do? · Create a JavaScript project
✔ Hardhat project root: · ~/d_d_academy/tierNFT
✔ Do you want to add a .gitignore? (Y/n) · y
✔ Do you want to install this sample project's dependencies with npm (@nomicfoundation/hardhat-toolbox)? (Y/n) · y

<aside> 💡 The project asked us to install @nomicfoundation/hardhat-toolbox in the last prompt. If it didn’t install or we accidentally chose ‘n’, we can always install it manually with:

npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-chai-matchers

</aside>

We delete some files so we start fresh:

rm contracts/Lock.sol
rm scripts/deploy.js
rm test/Lock.js