finds.dev

Uniswap/v4-core

🦄 🦄 🦄 🦄 Core smart contracts of Uniswap v4

View on GitHubHomepage ↗

★ 2,502Solidityupdated Apr 2026

// the take

The core smart contracts for Uniswap v4, implementing a singleton PoolManager architecture where all pool state lives in one contract. The main new primitive is hooks — contracts that can intercept before/after events on swaps, liquidity changes, and donations. Aimed at protocol integrators and hook developers building on top of Uniswap.

- Singleton PoolManager with transient-state delta accounting is a genuine architectural improvement over v3 — flash accounting means you only settle net balances at the end of an unlock, enabling complex multi-hop operations without intermediate token transfers.

- Hook system is well-structured: which callbacks fire is encoded in the hook address itself (via bit flags), so the set of active callbacks is immutable after pool creation, preventing bait-and-switch attacks.

- Test coverage is thorough — library-level unit tests, fuzz tests via Foundry, Echidna property tests for math-heavy components (TickMath, SqrtPriceMath), and gas snapshots committed to the repo so regressions are visible in PRs.

- Multiple independent audits included in the repo (Trail of Bits, Spearbit, OpenZeppelin, Certora, ABDK) plus a MythX workflow — unusually transparent for a protocol at this stage.

- BUSL-1.1 license on most files means you cannot fork and deploy a competing AMM from this code until the change date, which limits what 'open source' actually means here for builders who want production freedom.

- The unlock/callback pattern is powerful but adds meaningful integration complexity — building even a simple router requires understanding delta accounting, and the README example code has a syntax error (missing closing parenthesis on the revert), which isn't confidence-inspiring for newcomers.

- Hook contracts have no standardized safety checks in core — a malicious or buggy hook can reenter, return arbitrary deltas, or grief LPs, and the security doc ('Known Effects of Hook Permissions') is a PDF rather than inline NatDoc, making it easy to miss.

- ERC6909 is used for internal claims instead of ERC1155 or plain mappings, which is a reasonable gas tradeoff but adds a non-standard dependency that downstream tooling (wallets, indexers, analytics) doesn't yet handle well.

We read the README, the directory tree and a key source file in June 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
2,502
Forks
1,299
Language
Solidity
Last commit
24 Apr 2026

// nearby

If v4-core isn't quite it.

All repos →