Skip to content

nitk-surathkal-unidao/week-4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📝 Assignment for Week 4: NFTs and the Metaverse

In this week's assignment, we will work on building a simple NFT contract, setting up Hardhat tasks, and creating test cases to ensure proper functionality. The tasks involve deploying, minting, and interacting with an NFT smart contract, which we'll build using OpenZeppelin and Hardhat.

Exercise Breakdown

Exercise 0 : Initialise your Hardhat project

mkdir nft-project
cd nft-project
npx hardhat

make sure to use .env file for sensetive info.

IMPORTANT : The given files are just for helping purposes and giving idea of the structure of the project.

This repo contains Demo codes for the files without the depandancies.

Exercise 1: Create Your Solidity Contract

You will write a simple ERC721-based contract for minting NFTs using OpenZeppelin libraries.

The contract file is located at:

Exercise 2: Create Hardhat Tasks for Deploying and Minting NFTs

We will create tasks to deploy the NFT contract and mint NFTs using Hardhat.

The task file is located at:

Exercise 3: Create Helpers

The helpers for interacting with our contract and environment variables are implemented in the following files:

Exercise 4: Create Tests

We will write unit and integration tests to validate the NFT contract functionality. The tests will check minting functionality and balance tracking.

Test files:

Exercise 5: Hardhat Configuration

We will configure Hardhat to use the Alchemy API and connect to the Sepolia test network.

Configuration file:


Useful Commands

  • Compile the smart contracts:

    npx hardhat compile
  • Deploy the contract:

    npx hardhat deploy-contract
  • Mint an NFT:

    npx hardhat mint-nft --tokenUri "https://example.com/token-metadata"

Running Tests

To run the test cases, execute:

npx hardhat test

Example output:

mintNft
  ✓ calls through and returns the transaction object (60ms)

MyNFT
  mintNft
    ✓ emits the Transfer event (60ms)
    ✓ returns the new item ID
    ✓ increments the item ID (57ms)
    ✓ cannot mint to address zero
  balanceOf
    ✓ gets the count of NFTs for this address

6 passing (2s)
✨  Done in 5.66s.

Resources

What to Submit

  • A link to your GitHub Pull Request with the implemented contract and tasks.

  • Head over to the Coursework submission link: Google Form to submit your work.

Inform your UniDAO lead once the submission has been made.

Feel free to ask any questions or seek clarification on Discord.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published