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.

Contract Type

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

NameTypeDescription
nameString[64]Token name
symbolString[32]Token symbol
decimalsuint8Always 9
minteraddressBondingCurve address (set at init)
deployeraddressToken deployer (tx.origin at init)
stateuint80=uninitialized, 1=locked, 2=trading

Transfer Restrictions

Before enableTrading() is called (state = LOCKED):

  • transfer() — only callable by the minter
  • transferFrom() — only callable if from or to is the minter

After trading is enabled (state = TRADING), all ERC-20 transfers work normally with no restrictions.

Write Functions

initialize(_name, _symbol, _minter) external

Initialize 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 external

Standard ERC-20 transfer. Restricted to minter before trading is enabled.

transferFrom(from_addr, to, amount) → bool external

Standard ERC-20 transferFrom. Restricted before trading is enabled (from or to must be minter).

approve(spender, amount) → bool external

Standard ERC-20 approve. No restrictions.

increaseAllowance(spender, addedValue) → bool external

Increase allowance with checked addition (V05 security fix — prevents silent overflow).

decreaseAllowance(spender, subtractedValue) → bool external

Decrease allowance with underflow check.

mint(to, amount) external

Mint tokens. Minter only. Reverts if new supply exceeds MAX_SUPPLY (1.2B).

burnFrom(from_addr, amount) external

Burn tokens from an address. Minter only.

enableTrading() external

Unlock free token transfers. Minter only. Called during graduation. Emits TradingEnabled(timestamp).

View Functions

tradingEnabled() → bool view

Returns true if state == STATE_TRADING (2).

Standard ERC-20 view functions are also available: name(), symbol(), decimals(), totalSupply(), balanceOf(account), allowance(owner, spender).