This project contains two basic ERC-721 tokens:
TERC721Standalone
for an immutable deployment, without proxyTERC721Upgradeable
for an upgradeable deployment, with a compatible proxy (Transparent or Beacon)
These ERC-721 tokens have the following characteristics:
Mint
-
A mint function only accessible with the MINTER role
-
A mint batch function only accessible with the MINTER role
Burn
- A burn function only accessible with the BURNER role
- A burn in batch function only accessible with the BURNER role
ERC721
-
At deployment, the issuer can set the name, symbol and the baseURI
-
Once deployed, it is no longer possible to modify the name and symbol except via an upgrade in the case of the proxy. A setter function is available to set the baseURI again.
There are three roles: MINTER_ROLE, BURNER_ROLE and DEFAULT_ADMIN_ROLE
The DEFAULT_ADMIN_ROLE has all the roles by default
Contract | Type | Bases | ||
---|---|---|---|---|
β | Function Name | Visibility | Mutability | Modifiers |
TERC721Standalone | Implementation | TERC721Share, AccessControl, ERC721 | ||
β | Public βοΈ | π | ERC721 | |
β | mint | Public βοΈ | π | onlyRole |
β | mintBatch | Public βοΈ | π | onlyRole |
β | mintBatch | Public βοΈ | π | onlyRole |
β | burn | Public βοΈ | π | onlyRole |
β | burnBatch | Public βοΈ | π | onlyRole |
β | setBaseURI | Public βοΈ | π | onlyRole |
β | baseURI | Public βοΈ | NOβοΈ | |
β | _setBaseURI | Internal π | π | |
β | _baseURI | Internal π | ||
β | supportsInterface | Public βοΈ | NOβοΈ | |
β | hasRole | Public βοΈ | NOβοΈ |
Contract | Type | Bases | ||
---|---|---|---|---|
β | Function Name | Visibility | Mutability | Modifiers |
TERC721Upgradeable | Implementation | Initializable, ERC721Upgradeable, AccessControlUpgradeable, TERC721Share | ||
β | Public βοΈ | π | NOβοΈ | |
β | initialize | Public βοΈ | π | initializer |
β | __TERC721Upgradeable_init_unchained | Internal π | π | onlyInitializing |
β | mint | Public βοΈ | π | onlyRole |
β | mintBatch | Public βοΈ | π | onlyRole |
β | mintBatch | Public βοΈ | π | onlyRole |
β | burn | Public βοΈ | π | onlyRole |
β | burnBatch | Public βοΈ | π | onlyRole |
β | setBaseURI | Public βοΈ | π | onlyRole |
β | baseURI | Public βοΈ | NOβοΈ | |
β | _setBaseURI | Internal π | π | |
β | _baseURI | Internal π | ||
β | hasRole | Public βοΈ | NOβοΈ | |
β | supportsInterface | Public βοΈ | NOβοΈ | |
β | _getTERC721UpgradeableStorage | Private π |
Symbol | Meaning |
---|---|
π | Function can modify state |
π΅ | Function is payable |
The toolchain includes the following components, where the versions are the latest ones that we tested:
- Foundry
- Solidity 0.8.28 (via solc-js)
- OpenZeppelin Contracts (submodule) v5.2.0
- OpenZeppelin Contracts upgradeable (submodule) v5.2.0
See slither
npx prettier --write --plugin=prettier-plugin-solidity 'src/**/*.sol'
npx prettier --write --plugin=prettier-plugin-solidity 'test/**/*.sol'
slither . --checklist --filter-paths "openzeppelin-contracts|openzeppelin-contracts-upgradeable|test|forge-std" > slither-report.md
See ./doc/script
Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
Foundry consists of:
- Forge: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- Cast: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- Anvil: Local Ethereum node, akin to Ganache, Hardhat Network.
- Chisel: Fast, utilitarian, and verbose solidity REPL.
Explain how it works.
The contracts are developed and tested with Foundry, a smart contract development toolchain.
To install the Foundry suite, please refer to the official instructions in the Foundry book.
You must first initialize the submodules, with
forge install
See also the command's documentation.
Later you can update all the submodules with:
forge update
See also the command's documentation.
The official documentation is available in the Foundry website
forge build
You can run the tests with
forge test
To run a specific test, use
forge test --match-contract <contract name> --match-test <function name>
See also the test framework's official documentation, and that of the test commands.
- Perform a code coverage
forge coverage
- Generate LCOV report
forge coverage --report lcov
- Generate
index.html
forge coverage --ffi --report lcov && genhtml lcov.info --branch-coverage --output-dir coverage
See Solidity Coverage in VS Code with Foundry & Foundry forge coverage
The original code is copyright (c) Taurus 2025, and is released under MIT license.