Section E · Reference

Domain Context

The vocabulary, ecosystem map, and references a senior smart-contract engineer should be conversant in before walking into an AMM/DEX interview loop.

Vocabulary

TermQuick definition
AMMAutomated Market Maker. Smart-contract pool that quotes prices algorithmically.
CFMMConstant Function Market Maker. Any AMM with a held-constant invariant.
CPMMConstant Product Market Maker. x · y = k. Uniswap v1/v2.
CLMMConcentrated Liquidity Market Maker. v3-style.
LPLiquidity Provider. The party that deposits tokens earning swap fees.
TickInteger i such that price = 1.0001^i. Discrete unit of v3 prices.
sqrtPriceX96Square root of price in Q64.96 fixed-point. v3 native price representation.
HooksUser-deployed contract that the core calls at swap/LP lifecycle moments (v4).
SingletonOne core contract holds state for all pools (v4, Balancer).
PoolManagerThe singleton in v4 terminology.
CallbackPool-initiated call back into the caller's contract mid-swap. Pull-based payment.
Permit / Permit2Signature-based approval. Permit2 is a canonical wrapper for any ERC-20.
Multicall3Canonical contract for batching multiple calls into one tx.
Flash swap / flash loanBorrow within one tx; must repay before end.
JITJust-in-time liquidity. MEV pattern of adding LP right before a large swap.
SandwichMEV pattern of trading same direction before victim, reverse after.
TWAPTime-Weighted Average Price. On-chain oracle from observation cumulatives.
IntentUser signs desired outcome; off-chain solver competes to fulfill.
Batch auctionSettle all orders at one clearing price per batch (CoW model).
StableSwapCurve's invariant blending constant-sum and constant-product.
D invariantStableSwap's "virtual reserve" computed via Newton's method.
KConstant-product invariant; reserve0 · reserve1.
Virtual reservesv3 LP position's effective reserves within its tick range.
Fee growth globalPer-token, per-pool cumulative fees-per-unit-liquidity.
Slot0Single-storage-slot pool state. Read once on every swap.
Tick bitmapCompact bit set marking initialized ticks in v3.
EIP-1153Transient storage. TSTORE/TLOAD opcodes.
EIP-4844Blob transactions; reduces L2 data cost.
EIP-7702EOA delegation; EOAs can act as smart accounts in-tx.

The DEX ecosystem

ProjectFamilyWhat's distinctive
Uniswap v2CPMMTwo-token, fixed 30bps fee. The reference CPMM.
Uniswap v3CLMMConcentrated liquidity; tick-based; multiple fee tiers.
Uniswap v4CLMM + Hooks + SingletonPluggable hooks, flash accounting, singleton PoolManager.
Curve v1 / v2StableSwap / Crypto poolsD-invariant; optimized for pegged pairs. v2 supports non-pegged via internal oracle.
Balancer v2 / v3Weighted; singleton VaultMulti-token portfolios; vault architecture predates v4 singleton.
Sushi (v2/Trident)CPMM + Trident-styleFork-and-extend ecosystem.
PancakeSwapCPMM + CLMMBSC-native; gamified LP.
Aerodromev2 fork + ve(3,3)Optimism/Base. Vote-escrow + bribes.
MaverickDynamic-bin CLMMDirectional LP; auto-shift bins with price.
Trader Joe v2 / v2.1Liquidity Book (discrete bins)Per-bin reserves; no overflow-prone tick math.
CamelotConcentrated + V2Arbitrum-native; staked-LP.
Dragonswapv2/v3 forkSei-native; alt-VM but EVM-flavored.
Carbon (Bancor v3)Asymmetric strategiesLimit-order-style concentrated liquidity.
CoW SwapBatch auctionSolver-cleared, MEV-resistant.
UniswapXDutch-auction intentOff-chain fillers settle on-chain via Reactor.
1inch FusionResolver-basedPre-approved resolvers compete to fill.

Aggregator / router ecosystem

AggregatorSpeciality
1inchPathfinder; on-chain settler; Fusion intents.
0xRFQ + AMM hybrid. Settler per chain.
ParaSwapAdapters; supports many DEX families.
KyberSwapMeta-aggregator + own pools (Elastic).
OdosSOR; splitting; gas-aware routing.
CoW SwapOrder batching; not strictly an aggregator but consumes DEX liquidity.
BebopRFQ; market-maker driven.
LiFi / Socket / SquidCross-chain DEX aggregation + bridging.
Matcha (0x front-end)Retail UX over 0x infra.

The EVM L2 landscape

DEXes are deployed across many L2s. Each has quirks that affect contract engineering.

ChainTechQuirks for DEX engineers
Arbitrum OneOptimistic rollup, NitroL1 calldata pricing; gas reimbursement model differs slightly. Long-running tx limit.
OptimismOP StackSame as Base. Mature ecosystem.
BaseOP StackCancun. Very low fees. Big DEX volume.
UnichainOP Stack, DEX-focusedLiquidity-hub aspirations; sequencer-level intent batching.
ScrollzkEVM (Type 2)Bytecode-equivalent. Some opcodes priced differently. Newer Cancun support.
LineazkEVMType-2 equivalent. Gas accounting differs slightly.
zkSync Erazk-VM (account abstraction native)NOT bytecode equivalent. Contracts must be recompiled with zksolc. Some opcodes (SELFDESTRUCT) unsupported.
Polygon zkEVMType-3 zkEVMMostly compatible.
BNB ChainEVM L1Older Solidity compatibility considerations. Cheap; high-volume.
Avalanche C-ChainEVMStandard EVM behavior.
Polygon PoSEVM L1Mostly standard.
BlastOP-derivedNative yield on ETH/USDB; affects accounting.
Mode / Manta / Linea / ZoraOP Stack variantsStandard EVM.
Where the volume actually lives

Most DEX volume currently sits on Ethereum L1, Base, Arbitrum, and BNB Chain. New EVM chains compete for it via incentives. Senior engineers think about which chains are "first-class" supported vs "best-effort."

The contract engineer's stack

  • Solidity 0.8.26+ — current default. Older codebases on 0.7.x / 0.8.10.
  • Foundry — build, test, fuzz, invariant, script, snapshot, mainnet fork.
  • Solady — Yul-optimized library; FixedPointMathLib, SafeTransferLib, EIP712, etc.
  • OpenZeppelin — for periphery, governance, upgradeable patterns.
  • Halmos / hevm / Certora — formal verification.
  • Echidna / Medusa — property-based fuzzers.
  • Slither / Aderyn / Wake — static analyzers.
  • Tenderly — simulation, alerts, traces.
  • Etherscan + Dedaub — bytecode inspection.
  • Dune / Flipside — SQL on-chain.
  • The Graph + Goldsky + Envio — indexing.
  • Forta / Hypernative / OZ Defender — monitoring.

Recommended reading

  • Uniswap v2 whitepaper — Adams & Zinsmeister (2020).
  • Uniswap v3 whitepaper — Adams et al. (2021).
  • Uniswap v4 whitepaper + draft (Adams, 2023; finalized 2024).
  • StableSwap (Curve) whitepaper — Egorov (2019).
  • Improving Front Running Resistance of x*y=k Market Makers — Atallah, Ciamac (2021).
  • An analysis of Uniswap markets — Angeris & Chitra (2019). The foundational CFMM-LVR paper.
  • LVR (Loss Versus Rebalancing) — Milionis, Moallemi, Roughgarden (2022).
  • Flash Boys 2.0 — Daian et al. (2019). MEV foundational.
  • Spearbit, Trail of Bits, OpenZeppelin public audit reports — read 5+.
  • Code4rena / Sherlock contest reports — the long-tail bug catalog.
  • Solidity docs, Yul docs, EVM Codes — bookmark.