Documentation · Reference
GeneToken
The GENE ERC-20: a fixed-supply OpenZeppelin token with one addition, burn of the caller's own balance.
GeneToken is "a plain fixed-supply ERC-20": no admin role, no further mint, no pause, no blacklist, no fee on transfer and no transfer hook. The only addition to standard ERC-20 is burn, which destroys the caller's own balance (GeneToken.sol:6-10). It inherits OpenZeppelin ERC20 5.0.2, vendored in v4-core (GeneToken.sol:4, GeneToken.sol:11).
All line references are to src/GeneToken.sol at tag rc4-audit-candidate (aca5fcd) unless another file is named. OZ is lib/v4-core/lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol.
#Deployment and supply
| Item | Detail | Source |
|---|---|---|
| Deployer | GeneHook's constructor, with CREATE |
GeneHook.sol:233 |
| Constructor | constructor(address genesisHolder): name "GENE", symbol "GENE"; mints INITIAL_SUPPLY to genesisHolder, which is the hook |
GeneToken.sol:15-18 |
| Decimals | 18 (OpenZeppelin default) | OZ:83-85 |
| Supply path | At launch() the hook transfers the whole supply into the pool's genesis band and burns any dust left over |
GeneHook.sol:420-435, GeneHook.sol:262-263 |
| Supply changes | totalSupply never increases (invariant SUP). It decreases only through burn: the launch dust, REGENERATION's buyback burn, and any holder burning its own tokens |
GenePermanence.t.sol:155; GeneHook.sol:263, GeneHook.sol:308; GeneToken.sol:21-23 |
| Transfers | Any holder can transfer any amount anywhere (invariant XFER) | GeneToken.sol:6-10 |
| Runtime size | 1,980 bytes | build at aca5fcd |
INITIAL_SUPPLY equals the Genome constant SUPPLY (GeneToken.sol:12; Genome.sol:15).
#Functions
The ABI has 12 functions. Selectors are on Selectors.
#GENE-specific
| Function | Mutability | Caller | Behaviour | Source |
|---|---|---|---|---|
INITIAL_SUPPLY() |
view (constant) | anyone | The supply minted at construction, in 18-decimal units | GeneToken.sol:12 |
GENESIS_HOLDER() |
view (immutable) | anyone | The address that received the supply: the GeneHook | GeneToken.sol:13, GeneToken.sol:16 |
burn(uint256 amount) |
nonpayable | anyone | Destroys amount of the caller's own tokens with _burn(msg.sender, amount). Emits Transfer(caller, address(0), amount). Reverts ERC20InsufficientBalance if the balance is too small |
GeneToken.sol:20-23; OZ:241-245, OZ:188-195 |
#Standard ERC-20 (OpenZeppelin)
| Function | Mutability | Behaviour | Source |
|---|---|---|---|
name() |
view | "GENE" |
OZ:58; GeneToken.sol:15 |
symbol() |
view | "GENE" |
OZ:66; GeneToken.sol:15 |
decimals() |
view | 18 | OZ:83-85 |
totalSupply() |
view | Current supply | OZ:90 |
balanceOf(address) |
view | Balance of an account | OZ:97 |
transfer(address,uint256) |
nonpayable | Moves tokens from the caller; emits Transfer |
OZ:109, OZ:171-178 |
allowance(address,address) |
view | Remaining allowance of a spender | OZ:118 |
approve(address,uint256) |
nonpayable | Sets an allowance; emits Approval |
OZ:132, OZ:284-293 |
transferFrom(address,address,uint256) |
nonpayable | Spends allowance without emitting Approval, then moves tokens; emits Transfer |
OZ:154, OZ:303-310, OZ:171-178 |
#Events
IERC20 is lib/v4-core/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol.
| Event | Indexed | Emitted | Source |
|---|---|---|---|
Transfer(address,address,uint256) |
from, to |
Mint at construction (from address(0)), every transfer, every burn (to address(0)) |
IERC20.sol:16; OZ:215 |
Approval(address,address,uint256) |
the approver, the spender | approve |
IERC20.sol:22; OZ:293 |
Topics are on Selectors.
#Errors
GeneToken defines no custom errors of its own. The OpenZeppelin ERC-6093 errors it can raise are on Errors.
Sources (12)
- src/GeneToken.sol:4-23
- src/GeneHook.sol:233-235
- src/GeneHook.sol:262-263
- src/GeneHook.sol:308
- src/GeneHook.sol:420-435
- src/Genome.sol:15
- lib/v4-core/lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:58-154
- lib/v4-core/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol:16-22
- lib/v4-core/lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:171-178
- lib/v4-core/lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:188-215
- lib/v4-core/lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:226-245
- lib/v4-core/lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:284-310
Paths are relative to the GENE repository at tag rc4-audit-candidate (aca5fcd).