TokenTemplate
ERC-20 token with minter-controlled mint/burn, a trading lock until graduation, and 9-decimal precision. Deployed as a minimal proxy per token.
Minimal Proxy (EIP-1167). Max supply: 1,200,000,000 tokens (9 decimals). Trading locked until enableTrading() is called by the minter (bonding curve).
Key State
| Name | Type | Description |
|---|---|---|
name | String[64] | Token name |
symbol | String[32] | Token symbol |
decimals | uint8 | Always 9 |
minter | address | BondingCurve address (set at init) |
deployer | address | Token deployer (tx.origin at init) |
state | uint8 | 0=uninitialized, 1=locked, 2=trading |
Transfer Restrictions
Before enableTrading() is called (state = LOCKED):
transfer()— only callable by the mintertransferFrom()— only callable iffromortois the minter
After trading is enabled (state = TRADING), all ERC-20 transfers work normally with no restrictions.
Write Functions
initialize(_name, _symbol, _minter) externalInitialize the token proxy. Called by Factory. Mints INITIAL_MINT_AMOUNT (60M tokens) to tx.origin (or the vesting contract if deployer is the system deployer). Sets state to LOCKED.
transfer(to, amount) → bool externalStandard ERC-20 transfer. Restricted to minter before trading is enabled.
transferFrom(from_addr, to, amount) → bool externalStandard ERC-20 transferFrom. Restricted before trading is enabled (from or to must be minter).
approve(spender, amount) → bool externalStandard ERC-20 approve. No restrictions.
increaseAllowance(spender, addedValue) → bool externalIncrease allowance with checked addition (V05 security fix — prevents silent overflow).
decreaseAllowance(spender, subtractedValue) → bool externalDecrease allowance with underflow check.
mint(to, amount) externalMint tokens. Minter only. Reverts if new supply exceeds MAX_SUPPLY (1.2B).
burnFrom(from_addr, amount) externalBurn tokens from an address. Minter only.
enableTrading() externalUnlock free token transfers. Minter only. Called during graduation. Emits TradingEnabled(timestamp).
View Functions
tradingEnabled() → bool viewReturns true if state == STATE_TRADING (2).
Standard ERC-20 view functions are also available: name(), symbol(), decimals(), totalSupply(), balanceOf(account), allowance(owner, spender).