// the find
Uniswap/v2-periphery
🎚 Peripheral smart contracts for interacting with Uniswap V2
The peripheral contracts layer for Uniswap V2 — the Router and helper libraries that sit on top of the core pair contracts and handle swap routing, liquidity management, and price oracle utilities. This is what most DeFi protocols and frontends actually integrate with rather than touching the core directly. Historically significant as the template that countless AMM forks copied.
Router01/02 split is a clean example of how to extend a deployed protocol without breaking existing integrations — Router02 adds support for fee-on-transfer tokens that Router01 couldn't handle. The oracle library (TWAP via cumulative price accumulators) is genuinely clever: manipulation-resistant price feeds with no off-chain infrastructure required. Flash swap example contracts are well-written teaching material for how to build atomic arbitrage. Library separation (UniswapV2Library vs UniswapV2OracleLibrary) keeps pure math functions stateless and easily auditable.
This is V2 — Uniswap V3 and V4 have been out for years. Concentrated liquidity (V3) made constant-product AMMs largely obsolete for capital efficiency; you'd only reach for V2 periphery today for a fork or legacy integration. The sliding window oracle is subtly tricky to use correctly: the granularity and window size interact in ways that will burn you if you don't read the math carefully. No upgradeability or governance hooks — fine for Uniswap itself since they just deploy a new version, but a trap for forks that try to extend this without understanding the immutable deployment model. Test tooling is dated (Waffle + Mocha rather than Hardhat or Foundry), which matters if you're forking and want to add tests.