Technical Senior Level

Explain how an automated market maker works. What are the key smart contract patterns behind a protocol like Uniswap?

Quick Tip

Explain the core clearly: "The constant product formula sets the price. As someone buys token A, its supply in the pool decreases, raising its price. LPs earn fees proportional to their share of the pool."

What good answers include

AMMs use the constant product formula (x * y = k) to determine prices. Liquidity providers deposit paired assets into pools and receive LP tokens representing their share. Swaps change the ratio, moving the price along the curve. Key patterns: pair contracts as minimal proxies, factory pattern for pool creation, flash swaps, price oracles (TWAP), and fee distribution to LPs. Strong candidates discuss: impermanent loss, concentrated liquidity (Uniswap V3), and sandwich attack protection.

What interviewers are looking for

Tests DeFi knowledge depth. Candidates who understand AMM mechanics can reason about a wide range of DeFi protocols. Ask about impermanent loss — it is the most common misunderstanding.

← All Solidity questions