A collection of NFT smart contracts built with Solidity and Foundry, featuring an IPFS-based NFT and a dynamic on-chain SVG NFT with mood-flipping functionality.
A standard ERC-721 NFT contract where token metadata is stored off-chain via IPFS. Each token is minted with a custom URI pointing to its metadata hosted on IPFS.
Key Features:
- ERC-721 compliant via OpenZeppelin
- Per-token URI storage
- Open minting — any address can mint
A fully on-chain dynamic NFT whose image and metadata are stored entirely on-chain as base64-encoded SVGs. Token owners can flip their NFT between a Happy and Sad mood at any time.
Key Features:
- Fully on-chain SVG metadata — no IPFS or external dependency
- Dynamic token URI that changes based on current mood
- Mood flipping restricted to token owner or approved address
- ERC-721 compliant via OpenZeppelin
├── script
│ ├── DeployBasicNFT.s.sol # Deployment script for BasicNFT
│ ├── DeployMoodNFT.s.sol # Deployment script for MoodNFT
│ └── Interactions.s.sol # Mint interaction script
├── src
│ ├── BasicNFT.sol # IPFS-based NFT contract
│ └── MoodNFT.sol # On-chain SVG dynamic NFT contract
└── test
├── integrations
│ ├── BasicNFTTest.t.sol
│ ├── DeployMoodNFTTest.t.sol
│ └── MoodNFTIntegration.t.sol
└── unit
└── MoodNFTTest.t.sol
git clone https://github.com/BuildsWithKing/nft-smart-contract
cd nft-smart-contract
forge installforge buildforge testforge coverageStart a local Anvil node:
make anvilDeploy contracts locally:
make deployCreate a .env file at the project root:
SEPOLIA_RPC_URL=your_sepolia_rpc_url
ETHERSCAN_API_KEY=your_etherscan_api_keyThen run:
make deploy-sepoliaMint a MoodNFT on Sepolia after deployment:
make mint-sepolia| Variable | Description |
|---|---|
SEPOLIA_RPC_URL |
RPC endpoint for Sepolia testnet |
ETHERSCAN_API_KEY |
API key for contract verification |
MichealKing — @BuildsWithKing
This project is licensed under the MIT License.