ERC‑20
1 min read
Pronunciation
[ee-are-see twenty]
Analogy
ERC‑20 is like the US standard for electrical outlets—any device (token) following the standard works in any socket (wallet/exchange).
Definition
The Ethereum standard interface for fungible tokens, defining methods for transfers, allowances, and metadata.
Key Points Intro
ERC‑20 standardizes token behavior via:
Key Points
Functions: `totalSupply`, `balanceOf`, `transfer`, `approve`, `transferFrom`, `allowance`.
Events: `Transfer` and `Approval` for off‑chain tracking.
Metadata: Optional `name`, `symbol`, `decimals`.
Interoperability: Universally supported by wallets and exchanges.
Example
DAI implements ERC‑20: users call `approve(spender, amt)` and `transferFrom` to move tokens via smart contracts.
Technical Deep Dive
ERC‑20 specifies function signatures and event topics. Contracts use `SLOAD`/`SSTORE` for balances and allowances. Gas costs defined by EIP‑20. The `approve`/`transferFrom` pattern enables delegated spending.
Security Warning
Beware of the ERC‑20 approval race condition; use `increaseAllowance`/`decreaseAllowance` instead of `approve` to change nonzero allowances.
Caveat
ERC‑20 does not enforce totalSupply bounds; mint functions can inflate supply if not restricted.
ERC‑20 - Related Articles
No related articles for this term.