Skip to content

About

This repository is a section of the Cyfrin Foundry Solidity Course.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Foundry NFT - Pixel Manuel

A Foundry-based NFT project featuring two ERC721 contracts: a simple IPFS-hosted NFT and a dynamic on-chain SVG NFT with mood-switching capabilities.


Pixel Manuel NFT
Pixel Manuel (IPFS)

Manu Building
MoodNft - BUILDING
Manu Chilling
MoodNft - CHILLING

Overview

Contract Type Description
ManuNft ERC721 Simple NFT with IPFS-hosted metadata and custom token URIs
MoodNft ERC721 + Ownable Dynamic SVG NFT with on-chain metadata and mood-switching (BUILDING / CHILLING)

MoodNft Features

  • 100% on-chain SVG rendering with Base64-encoded metadata
  • Two animated states: BUILDING (focused eyes + coffee) and CHILLING (relaxed eyes + trees)
  • Owner-controlled mood flipping via flipMood()
  • Dynamic tokenURI() that returns different SVG art based on current state

Getting Started

Requirements

Quickstart

git clone https://github.com/manu-cadena/foudry-nft
cd foudry-nft
forge install
forge build

Usage

Start a Local Node

make anvil

Deploy

# Deploy ManuNft (IPFS NFT)
make deploy

# Deploy MoodNft (On-chain SVG NFT)
make deployMood

Interact

# Mint a ManuNft
make mint

# Mint a MoodNft
make mintMoodNft

# Flip MoodNft mood (BUILDING <-> CHILLING)
make flipMoodNft

Testing

forge test

Or with verbose output:

forge test -vvv

Test Coverage

forge coverage

Deployment to Sepolia Testnet

  1. Set up environment variables in a .env file:
SEPOLIA_RPC_URL=<your_sepolia_rpc_url>
PRIVATE_KEY=<your_private_key>
ETHERSCAN_API_KEY=<your_etherscan_api_key>

Note: Use a key that doesn't hold real funds for development.

  1. Deploy:
make deploy ARGS="--network sepolia"

Base64 Encoding (SVG to URI)

To manually encode an SVG for on-chain use:

echo "data:image/svg+xml;base64,$(base64 -i ./img/manu-building.svg)"

Gas Estimation

forge snapshot

Formatting

forge fmt

Project Structure

src/
  ManuNft.sol          - Simple ERC721 with IPFS URI storage
  MoodNft.sol          - Dynamic SVG NFT with mood states
script/
  DeployManuNft.sol    - ManuNft deployment script
  DeployMoodNft.s.sol  - MoodNft deployment (reads & encodes SVGs)
  Interaction.s.sol    - Mint and flip mood scripts
test/
  ManuNftTest.t.sol    - ManuNft unit tests
  MoodNftTest.t.sol    - MoodNft unit tests (state, events, auth)
img/
  manu-building.svg    - Animated pixel-art (building state)
  manu-chilling.svg    - Animated pixel-art (chilling state)

Tech Stack

Acknowledgements

Built while following the Cyfrin Updraft Advanced Foundry course, with custom pixel-art SVGs and personalized contract logic.

About

This repository is a section of the Cyfrin Foundry Solidity Course.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages