This project contains two NFT smart contracts built with Foundry:
- PrimeNft: Simple ERC721 NFT that allows minting NFTs with custom URIs
- VibeNft: On-chain SVG NFT that can switch between two states (Smile and Wink)
Varun Chauhan
src/: Smart contract source filesPrimeNft.sol: Basic NFT with custom URIVibeNft.sol: On-chain SVG NFT with switchable states
test/:unit/: Unit tests for contractsinteractions/: Tests for deployment and interaction scripts
script/: Deployment and interaction scriptsimg/: SVG images used for the VibeNft
- Simple ERC721 implementation
- Mint NFTs with custom URIs
- Standard ERC721 functionality
- On-chain SVG NFT
- SVG data stored directly in the contract
- "Vibe" can be changed between Smile and Wink states
- Token metadata generated on-chain with Base64 encoding
# Clone the repository
git clone https://github.com/chauhan-varun/foundry-nft
cd foundry-nft
# Install dependencies
forge installforge buildRun all tests:
forge testRun specific tests:
# Run unit tests
forge test --match-path test/unit/**
# Run interaction tests
forge test --match-path test/interactions/**Deploy PrimeNft:
forge script script/DeployPrimeNft.s.sol:DeployPrimeNft --rpc-url <your_rpc_url> --broadcast --private-key <your_private_key>Deploy VibeNft:
forge script script/DeployVibeNft.s.sol:DeployVibeNft --rpc-url <your_rpc_url> --broadcast --private-key <your_private_key>To mint a PrimeNft:
forge script script/Interactions.s.sol:Interactions --rpc-url <your_rpc_url> --broadcast --private-key <your_private_key>For more information about Foundry:
- Forge: Ethereum testing framework
- Cast: CLI for interacting with EVM smart contracts
- Anvil: Local Ethereum node
- Chisel: Solidity REPL