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.
| 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) |
- 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
git clone https://github.com/manu-cadena/foudry-nft
cd foudry-nft
forge install
forge buildmake anvil# Deploy ManuNft (IPFS NFT)
make deploy
# Deploy MoodNft (On-chain SVG NFT)
make deployMood# Mint a ManuNft
make mint
# Mint a MoodNft
make mintMoodNft
# Flip MoodNft mood (BUILDING <-> CHILLING)
make flipMoodNftforge testOr with verbose output:
forge test -vvvforge coverage- Set up environment variables in a
.envfile:
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.
- Deploy:
make deploy ARGS="--network sepolia"To manually encode an SVG for on-chain use:
echo "data:image/svg+xml;base64,$(base64 -i ./img/manu-building.svg)"forge snapshotforge fmtsrc/
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)
- Foundry - Smart contract development framework
- OpenZeppelin Contracts v5 - ERC721, Ownable, Base64
- Foundry DevOps - Deployment address resolution
Built while following the Cyfrin Updraft Advanced Foundry course, with custom pixel-art SVGs and personalized contract logic.
