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 ofUzoToken: a new name and supply, and optionally a fixed supply, burning or a hard cap. Each change below is independent, so pick the ones you need.
Prerequisites
- A copy of the template that deploys, from Use a template.
- The walkthrough, so you know which file does what.
Name, symbol and supply
These need no code changes. Set them in.env and deploy again:
.env
TOKEN_INITIAL_SUPPLY is in whole tokens. The deploy script converts it to the smallest unit for you. Each deploy creates a new contract. The old one stays on chain.
Change the contract
1
Edit the contract
Pick one or more of the changes in the tabs.
- Burnable
- Capped
- Fixed supply
- Decimals
Add OpenZeppelin’s
ERC20Burnable, so holders can destroy their own tokens.contracts/UzoToken.sol
2
Run the tests
Terminal
3
Refresh the ABI
Terminal
frontend/src/abi.ts, so the web app can call the new functions.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 to change colours. Swap its two @import lines to load your own fonts. Put styles that belong only to your app in frontend/src/styles.css.
Hand over ownership
The deployer owns the token and is the only account that can mint. To give that power to a multisig, calltransferOwnership(newOwner) from the owner wallet:
Terminal
PRIVATE_KEY from your .env into the shell first, for example with source .env, rather than pasting it into the command.
Verify
After deploying, open the BOTScan link from the deploy output. On the Read contract tab, checkname, symbol, totalSupply and, if you added one, cap.
Troubleshooting
Compiler error: function needs to specify overridden contracts
Compiler error: function needs to specify overridden contracts
Two parents define the same function, usually
_update. Add an override that lists both, as in the Capped tab.The web app doesn't show my new function
The web app doesn't show my new function
Run
npm run abi after changing the contract, then restart npm run frontend.Hardhat verify fails after I changed the constructor
Hardhat verify fails after I changed the constructor
scripts/verify.ts passes the arguments saved in deployments/968.json. Update scripts/deploy.ts and the Ignition module so they save and pass your new arguments.Next steps
NFT template
A paid mint with on-chain art.
Add liquidity
Make your token tradable on BDEX.