DeFi Glossary
Clear definitions of DeFi and smart contract terms. Every concept you encounter while building protocols on Zealynx Academy, explained in plain language.
29 terms
Automated Market Maker (AMM)
AMMA smart contract that holds token reserves and enables trading without an order book. Prices are determined algorithmically based on the ratio of tokens in the pool. Uniswap, Curve, and Balancer are examples of AMM protocols.
Learn more in the AcademyConstant Product Formula
AMMThe pricing invariant x * y = k, where x and y are token reserves and k is a constant. When one token is bought, the other's reserve increases to maintain k. This formula is used by Uniswap V2 and most AMM forks.
Learn more in the AcademyLiquidity Pool
AMMA smart contract holding paired token reserves that enables trading. Liquidity providers deposit equal value of two tokens and receive LP tokens representing their share. Trading fees are distributed proportionally to LP token holders.
Learn more in the AcademyLiquidity Provider (LP)
AMMA user who deposits tokens into a liquidity pool to facilitate trading, earning a share of trading fees in return. LPs take on impermanent loss risk in exchange for fee income.
Learn more in the AcademyLP Token
AMMA token minted to liquidity providers representing their share of a pool. LP tokens can be burned to withdraw the underlying tokens plus accumulated fees. The first depositor's LP token amount is calculated using the geometric mean (sqrt) of the deposit amounts.
Learn more in the AcademyImpermanent Loss
AMMThe difference between holding tokens in a liquidity pool versus holding them in a wallet. When the price ratio of pooled tokens changes, the pool rebalances, and LPs end up with more of the cheaper token and less of the expensive one. The loss is 'impermanent' because it reverses if prices return to the original ratio.
Slippage
AMMThe difference between the expected price of a trade and the actual execution price. In AMMs, larger trades relative to pool size cause more slippage because each unit bought moves the price further along the bonding curve. Slippage protection (minimum output amount) prevents front-running attacks.
Learn more in the AcademyTWAP Oracle
AMMTime-Weighted Average Price oracle. An on-chain price feed calculated from cumulative price accumulators updated on every trade. Resistant to flash loan manipulation because manipulating a TWAP requires holding the price for the entire averaging window, which is economically expensive.
Learn more in the AcademyConcentrated Liquidity
AMMAn AMM design (introduced by Uniswap V3) where liquidity providers can allocate capital to specific price ranges instead of across the entire curve. This increases capital efficiency but requires active management and introduces tick-based accounting.
Flash Swap
AMMA feature of Uniswap V2 where tokens are sent to the borrower before payment is verified. The borrower can use the tokens, then either return them or pay with the other token, all within a single transaction. If the K invariant is not satisfied at the end, the transaction reverts.
Learn more in the AcademyReentrancy Attack
SecurityAn exploit where a malicious contract calls back into the vulnerable contract before the first execution is complete, manipulating state that hasn't been updated yet. The classic example is The DAO hack (2016). Prevented by the checks-effects-interactions pattern and reentrancy guards (mutex locks).
Learn more in the AcademyFlash Loan Attack
SecurityAn exploit that uses uncollateralized flash loans to temporarily manipulate prices, governance votes, or oracle readings within a single transaction. The attacker borrows millions, executes the attack, repays the loan, and profits, all atomically with zero upfront capital.
Learn more in the AcademyFront-running
SecurityObserving a pending transaction in the mempool and submitting a transaction with a higher gas price to execute before it. In DeFi, this is commonly used to sandwich trades: buying before a large swap (raising the price) and selling after (profiting from the price impact the victim caused).
Learn more in the AcademyInvariant
SecurityA condition that must always be true throughout a contract's execution. In Uniswap V2, the key invariant is x * y >= k after every swap. Violations of invariants indicate bugs or exploits. Invariant testing (fuzzing) is a powerful technique for finding vulnerabilities.
Learn more in the AcademyCEI Pattern
SecurityChecks-Effects-Interactions pattern. A Solidity best practice where you first validate inputs (Checks), then update state (Effects), then make external calls (Interactions). This ordering prevents reentrancy attacks because state is already updated before any external code executes.
Learn more in the AcademyOracle Manipulation
SecurityExploiting a price oracle to make the protocol act on incorrect price data. Spot price oracles (single-block readings) are trivially manipulable via flash loans. TWAP oracles resist this because manipulation must be sustained over time, making it economically impractical.
Learn more in the AcademyFactory Pattern
ArchitectureA design pattern where one contract (the Factory) creates and registers other contracts (Pairs/Pools). In Uniswap V2, the Factory uses CREATE2 to deploy Pair contracts with deterministic addresses, enabling gas-efficient address computation without on-chain lookups.
Learn more in the AcademyCREATE2
ArchitectureAn EVM opcode that deploys contracts to deterministic addresses based on the deployer address, a salt, and the contract bytecode. Unlike CREATE, the address can be computed off-chain before deployment. Used by Uniswap V2 Factory to enable the Router to calculate pair addresses without storage reads.
Learn more in the AcademyProxy Pattern
ArchitectureA smart contract architecture where users interact with a proxy contract that delegates calls to a separate implementation contract. Enables upgradeability (the implementation can be swapped) at the cost of added complexity and a trust assumption on the upgrade key holder.
Learn more in the AcademyCore vs Periphery
ArchitectureAn architecture pattern separating immutable, security-critical logic (Core: Pair, Factory) from replaceable user-facing contracts (Periphery: Router). Core contracts hold funds and enforce invariants. Periphery contracts handle UX concerns like slippage protection, deadline checks, and multi-hop routing.
Learn more in the AcademyFee-on-Transfer Token
ArchitectureA token that deducts a fee on every transfer, meaning the recipient receives less than the sender sent. These tokens break pre-calculated swap amounts because the actual tokens arriving at the pair differ from the expected amount. Uniswap V2 Router has special functions that measure actual balances instead of trusting calculations.
Learn more in the AcademyProtocol Revenue
TokenomicsIncome generated by a protocol's core operations, distinct from token price appreciation. In Uniswap V2, protocol revenue comes from an optional 0.05% fee (1/6th of the 0.3% trading fee), controlled by governance. Understanding the difference between protocol revenue and token value is critical for sustainable protocol design.
Learn more in the AcademyToken Vesting
TokenomicsA schedule that releases tokens to holders over time rather than all at once. Prevents early investors and team members from selling immediately after launch. Common structures include linear vesting (equal monthly releases) and cliff vesting (nothing for X months, then a lump sum).
Learn more in the AcademyGovernance Token
TokenomicsA token that grants holders voting rights over protocol decisions. Can cover parameter changes (fee rates, collateral factors), treasury allocation, and upgrade proposals. Token-weighted voting (one token = one vote) is simple but vulnerable to plutocracy and vote buying.
Learn more in the AcademyTotal Value Locked (TVL)
TokenomicsThe total value of assets deposited in a DeFi protocol's smart contracts. TVL is the most common metric for measuring protocol adoption, but it can be misleading: incentivized liquidity (paid via token emissions) inflates TVL without indicating organic demand.
Learn more in the AcademyStorage Packing
SolidityAn EVM gas optimization where multiple state variables are packed into a single 32-byte storage slot. Reading one slot costs 2,100 gas. Uniswap V2 packs both reserves (uint112 each) and a timestamp (uint32) into one slot: 112 + 112 + 32 = 256 bits, saving 2,100 gas per read compared to separate slots.
Learn more in the AcademyEIP-2612 Permit
SolidityA standard that allows token approvals via off-chain signatures instead of on-chain transactions. Users sign a permit message, and anyone can submit it on-chain. This eliminates the approve + transferFrom two-transaction pattern, improving UX and enabling gasless approvals.
Learn more in the AcademyUnchecked Block
SolidityA Solidity 0.8+ block where arithmetic overflow/underflow checks are disabled. Used when overflow is intentional (e.g., Uniswap V2 TWAP cumulative accumulators) or mathematically impossible (e.g., loop counters). Saves gas by skipping the compiler-inserted overflow checks.
Learn more in the AcademyFixed-Point Arithmetic
SolidityA technique for representing fractional numbers in Solidity (which has no native floating-point). Uniswap V2 uses UQ112.112 format: the number is multiplied by 2^112, stored as uint224, and divided back when needed. This gives 112 bits of integer precision and 112 bits of fractional precision.
Learn more in the Academy