Ready. This template is published in uzolabs/templates and has been deployed and verified on testnet. It’s a learning template and hasn’t been audited. Use test funds only.
What you’ll build
Your own version ofUzoNFT. The settings change without code. The artwork, traits, wallet limits and royalties each need a small contract change. Pick the ones you need.
Prerequisites
- A copy of the template that deploys, from Use a template.
- The walkthrough, so you know how
tokenURIbuilds the art.
Name, price and supply
Set these in.env and deploy again:
.env
NFT_MINT_PRICE is in BOT. The deploy script converts it to wei and passes it to Foundry as NFT_MINT_PRICE_WEI, so you don’t set that yourself. For a free mint, use NFT_MINT_PRICE=0.
NFT_MAX_SUPPLY can’t change after deploy. The owner can change the price at any time with setMintPrice.
Change the contract
1
Edit the contract
- Artwork
- More traits
- Limit per wallet
- Royalties
Edit
_svg in contracts/UzoNFT.sol. It receives the token ID and its hue and returns an SVG string.- Use single quotes inside the SVG. The SVG sits inside a JSON string, and double quotes would break it.
- Keep it small. Every byte adds to the deploy cost.
- If you need a different colour per token, reuse
_hue, which gives the same ID the same hue every time.
2
Run the tests
Terminal
tokenURI, so a broken quote in your artwork shows up here. Add tests for any new rule, such as a fourth mint from one wallet reverting.3
Refresh the ABI
Terminal
frontend/src/abi.ts, so the web app knows about new functions and errors.4
Deploy and verify
Terminal
npm run frontend so it reads the new address.Change the look
Edit the variables at the top offrontend/src/theme.css for colours and fonts, and frontend/src/styles.css for styles that belong only to this app.
Hand over ownership
The owner sets the price and receives withdrawals. To hand that to a multisig, calltransferOwnership(newOwner) from the owner wallet. The new owner receives all future withdrawals.
Terminal
PRIVATE_KEY from your .env into the shell first, for example with source .env, rather than pasting it into the command.
Verify
Mint one token from the web app and check the gallery shows your new art. On BOTScan, open the token’s page and check its image and attributes. If you added royalties, callroyaltyInfo(1, 10000) on the Read contract tab. It should return the owner and 500.
Troubleshooting
Tests fail to decode the JSON after I changed the artwork
Tests fail to decode the JSON after I changed the artwork
A double quote inside the SVG ends the JSON string early. Use single quotes for every SVG attribute.
WrongPayment when minting
WrongPayment when minting
You must send exactly
mintPrice. The owner may have changed it since the page loaded. Reload and try again.Compiler error about supportsInterface or _update
Compiler error about supportsInterface or _update
Each parent that defines the function must appear in the
override(...) list. With ERC2981 added, supportsInterface needs all three.I want to charge USDT instead of BOT
I want to charge USDT instead of BOT
USDT on BOT Chain has 6 decimals, so use
parseUnits(amount, 6), never parseEther, and move it with OpenZeppelin’s SafeERC20. See USDT and decimals.Next steps
Gasless app template
Let users act without holding tBOT.
Events without getLogs
Read history without event logs.