Token standards are the shared interfaces (ERC-20, ERC-721, ERC-1155, and their extensions) that let wallets, exchanges, and smart contracts interoperate with any Ethereum-based asset without custom integration work, while DeFi (decentralized finance) builds financial primitives — exchanges, lending markets, staking systems — directly on top of those tokens using open, composable smart contracts instead of centralized intermediaries. Together they form the backbone of on-chain finance: a fungible token standard makes currencies and governance shares interchangeable, non-fungible standards make unique or semi-fungible assets tradeable, and DeFi protocols turn those tokens into liquidity pools, collateral, and yield-bearing positions. The critical mental model to keep is composability with risk: every protocol here is "money legos" that can be combined permissionlessly, but that same composability is what lets a single flash loan chain together an oracle manipulation, a mispriced liquidation, and a drained pool in one atomic transaction — so the security patterns are not optional extras, they are load-bearing parts of the design.
What This Cheat Sheet Covers
This topic spans 13 focused tables and 104 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: ERC-20 Fungible Token Standard
Every DeFi primitive from AMMs to lending markets ultimately moves ERC-20 balances around, so its six required functions and two events are the vocabulary the rest of this cheat sheet builds on. Understanding decimals and the approve/transferFrom pattern up front avoids the most common integration bugs.
| Function | Example | Description |
|---|---|---|
function transfer(address to, uint256 value) external returns (bool) | Moves tokens directly from the caller's balance to to; emits Transfer. | |
function balanceOf(address owner) external view returns (uint256) | Returns the raw token balance of owner, denominated in the smallest unit (before dividing by decimals). | |
token.approve(spender, 100e18) | • approve lets spender pull up to value tokens on the owner's behalf• allowance(owner, spender) reads the remaining amount. | |
function transferFrom(address from, address to, uint256 value) external returns (bool) | Lets an approved spender move tokens out of from's balance; the two-step approve/transferFrom pattern is how contracts pull tokens (DEX routers, lending pools). | |
function totalSupply() external view returns (uint256) | Returns the total number of tokens in existence across all holders. |