A Solidity / Foundry project featuring two ERC-721 NFT contracts built as part of the Cyfrin Foundry Full Course.
A straightforward ERC-721 where the caller supplies a token URI at mint time. The default interaction script mints a Shiba Inu image stored on IPFS.
| Function | Description |
|---|---|
mintNft(string tokenUri) |
Mint an NFT with a custom token URI |
tokenURI(uint256 tokenId) |
Returns the stored URI for a token |
A fully on-chain SVG NFT. Metadata and images are Base64-encoded and stored directly in the contract — no IPFS or external hosting required. Each token starts HAPPY; the owner can flip it to SAD and back.
| Function | Description |
|---|---|
mintNft() |
Mint a new Mood NFT (starts HAPPY) |
flipMood(uint256 tokenId) |
Toggle the mood between HAPPY 😊 and SAD 😢 |
tokenURI(uint256 tokenId) |
Returns on-chain Base64-encoded JSON metadata |
git clone https://github.com/AztecWarlord/foundry-nft-f23
cd foundry-nft-f23
make installCreate a .env file for testnet / mainnet deployments:
PRIVATE_KEY=<your-wallet-private-key>
SEPOLIA_RPC_URL=<your-sepolia-rpc-url>
ETHERSCAN_API_KEY=<your-etherscan-api-key>make build
# or
forge buildmake test
# or
forge testmake formatmake anvil# Local Anvil
make deploy
# Sepolia testnet
make deploy ARGS="--network sepolia"# Local Anvil
make deployMood
# Sepolia testnet
make deployMood ARGS="--network sepolia"make mintmake mintMood├── src/
│ ├── BasicNft.sol # Simple ERC-721 with external token URI
│ └── MoodNft.sol # On-chain SVG ERC-721 with flippable mood
├── script/
│ ├── DeployBasicNft.s.sol
│ ├── DeployMoodNft.s.sol
│ └── Interactions.s.sol # MintBasicNft interaction script
├── test/
│ ├── unit/
│ │ ├── BasicNftTest.t.sol
│ │ └── MoodNft.t.sol
│ └── integrations/
│ ├── MoodNftIntegration.t.sol
│ └── DeployMoodNftTest.t.sol
└── images/
├── happy.svg
├── sad.svg
└── shiba-inu.png
| Library | Version |
|---|---|
| forge-std | v1.5.3 |
| openzeppelin-contracts | v4.8.3 |
| foundry-devops | 0.0.11 |
MIT