Onchain Atlas

Bunni

Uniswap liquidity engine that evolved from fungible ERC-20 wrappers for Uniswap v3 positions into the leading 'shapeshifting' Uniswap v4 hook DEX, before an $8.4M rounding-error exploit in September 2025 forced a permanent wind-down.

▶ Run interactive simulation animated mechanism with editable parameters

Statusexploited
Launched2022
ChainsEthereum, Unichain, Arbitrum, Base
Mechanismserc20-lp-tokenization, liquidity-density-functions, uniswap-v4-hooks, surge-fees, am-amm-auction, autonomous-rebalancing, rehypothecation, options-based-liquidity-mining
Official sitehttps://bunni.xyz/
Project X@bunni_xyz (verified_by_project_documentation)
FoundersZefram Lou (zefram.eth) (@boredGenius)

How it works onchain

Diagram of how Bunni's mechanism worksOpen full-size diagram
Original diagram derived from this entry’s researched mechanism description.

Summary

Bunni was a two-act experiment in making concentrated liquidity programmable, built by Zefram Lou (zefram.eth) and the Timeless Finance team. Act one (contracts published 2022) was a minimalist wrapper that turned Uniswap v3's NFT positions into fungible ERC-20 LP tokens, restoring the composability (staking, incentives, protocol-owned liquidity) that v3's NFT model had broken; it later became the distribution rail for Timeless's LIT token and its options-based liquidity mining (oLIT). Act two, Bunni v2, launched February 1, 2025 as one of the first and most successful hook-based DEXes on Uniswap v4 — a "shapeshifting" AMM whose pools reshaped their own liquidity distributions programmatically, charged volatility-triggered "surge fees," auctioned pool management rights via an auction-managed AMM (am-AMM), and rehypothecated idle reserves into lending markets. TVL grew from roughly $2.2M in June 2025 to nearly $80M by mid-August 2025. On September 2, 2025, an attacker exploited a rounding/precision flaw in the withdrawal and rebalancing logic to drain about $8.4M across Ethereum and Unichain. Unable to fund the audits, monitoring, and months of redevelopment a safe relaunch would require, the team announced a wind-down in October 2025, pledged remaining funds to token holders, and open-sourced the v2 contracts under MIT.

Design (Mechanism)

Bunni v1 — fungible LP tokens for Uniswap v3. A BunniHub contract held Uniswap v3 positions; each (pool, tickLower, tickUpper) "BunniKey" mapped to an ERC-20 BunniToken. LPs sharing a price range held identical fungible tokens, cutting gas (positions are reused) and re-enabling classic DeFi patterns: LP staking, gauges, and bribes over concentrated liquidity. Timeless used this to run ve(3,3)-inspired incentives where liquidity mining rewards were paid in call options (oLIT) rather than naked tokens, so the DAO captured revenue when options were exercised.

Bunni v2 — the shapeshifting DEX on Uniswap v4. The core primitive was the Liquidity Density Function (LDF): instead of LPs picking static tick ranges, each pool is parameterized by a mathematical function describing how liquidity should be distributed across prices — and that function can shift with market state (e.g., tracking price, time-weighted shifts), letting a pool autonomously reshape itself. Around the LDF sat several composed mechanisms: (1) autonomous rebalancing, using swap-driven logic to keep actual token balances aligned with the target distribution; (2) surge fees, dynamic fees that spike when the pool's shape changes or volatility jumps, taxing the arbitrageurs/MEV bots who trade against stale liquidity and paying that toxic-flow premium to LPs; (3) the am-AMM, an implementation of the Auction-Managed AMM research design in which the right to set a pool's swap fee and capture arbitrage is continuously auctioned, converting LVR into rent paid to LPs; and (4) rehypothecation, lending idle reserves to venues like Aave so LP capital earned both swap fees and lending yield. It was among the most technically ambitious hook stacks deployed on Uniswap v4.

Outcome

Exploited. Bunni v1 worked as designed and became infrastructure for Timeless/LIT incentives. Bunni v2 was, for roughly seven months, the standout Uniswap v4 hook — analyses credited it with dramatically higher capital efficiency than comparable vanilla pools, and TVL reached ~$80M in August 2025. On September 2, 2025, an attacker used carefully sized swaps plus dozens of tiny withdrawals to weaponize a round-down "safety" pattern in BunniHubLogic withdrawals: the accumulated rounding shrank the pool's accounted active balance far faster than shares were burned (reported ~85% reduction in active USDC balance), distorting the LDF/rebalancing math so LP shares redeemed for more than their fair value. Approximately $8.4M was drained ($2.4M on Ethereum, ~$6M on Unichain). Withdrawals were halted and a 10% bounty offered; funds were not returned. On October 10, 2025 the team announced it could not afford the six-to-seven-figure audit and monitoring costs plus months of rebuilding needed for a safe relaunch and would wind down, distributing remaining funds to BUNNI, LIT, and veBUNNI holders (team excluded) from a pre-exploit snapshot, and relicensing the v2 code under MIT.

Why it worked

  • It solved a real regression. Uniswap v3's NFT positions broke every incentive and composability pattern built for v2-era ERC-20 LP tokens; Bunni v1's fungible wrapper was a small, correct primitive that many protocols needed.
  • Research-grade mechanism design, shipped. v2 productized frontier academic ideas (LDFs, am-AMM auctions, dynamic anti-MEV fees) into a coherent LP-first product, and Uniswap v4 hooks gave it a credible substrate at exactly the right moment — first-mover advantage among serious v4 hooks.
  • Aligned LP economics. Stacking swap fees, surge-fee capture of toxic flow, auction rent, and lending yield gave LPs a materially better deal than passive pools, which is what drove the rapid mid-2025 TVL growth.

Where the design broke

  • Complexity outran verification. The interaction surface between rounding behavior, withdrawal accounting, LDF state, and rebalancing was enormous; a precision error that was individually "safe" (rounding down) became catastrophic when composed and iterated. Audits did not catch the compounding path.
  • Thin capitalization for a high-stakes system. The project held tens of millions in TVL but lacked the treasury to absorb an $8.4M incident or fund the re-audit/monitoring burden of a relaunch — the exploit was survivable technically, not financially.
  • Novel-mechanism risk premium was real. Every extra mechanism (rehypothecation, dynamic fees, self-modifying liquidity) added expressiveness for LPs and attack surface for adversaries; the attacker only needed one seam.

Lessons

  • Rounding direction is not a security property by itself. "Round in the protocol's favor" only helps if errors cannot be accumulated and amplified; invariant checks on aggregate accounting (shares burned vs. balance reduction) would have caught 44 consecutive dust withdrawals shrinking a pool 85%.
  • Expressiveness multiplies audit cost superlinearly. A DEX whose pools are user-parameterized functions needs verification budgets and runtime monitoring sized to its state space, not to its codebase line count — and that budget must exist before TVL arrives.
  • Protocol solvency planning matters as much as contract security. Bunni's post-exploit math (relaunch cost > available capital) shows that incident-response reserves, insurance, or fee-funded war chests are part of mechanism design, not an afterthought.
  • Composability wrappers can outlive their creators. The v1 fungible-LP primitive and the MIT-relicensed v2 code (LDFs, surge fees, am-AMM) remain public goods; a project's mechanisms can succeed even when the business fails.

Redesign (EDITORIAL — hypothesis, not fact)

This section is editorial hypothesis, not established fact. A revived Bunni-style design would keep the LDF abstraction but wrap it in defense-in-depth accounting: (1) a global conservation invariant enforced on every withdrawal — the ratio of balance removed to shares burned may never exceed the pro-rata ratio plus a fixed epsilon — reverting on violation rather than trusting per-operation rounding; (2) rate-limited withdrawals and per-block share-burn floors to make dust-iteration attacks uneconomical; (3) circuit breakers driven by on-chain monitors that pause pools when active-balance drift exceeds thresholds, funded by a mandatory protocol-fee-financed security reserve targeted at, say, 10–20% of TVL before incentive emissions begin; and (4) staged mechanism rollout — ship the LDF core alone, add surge fees, am-AMM, and rehypothecation one at a time behind caps, so each new interaction surface is battle-tested in isolation. Economically, prepaying for continuous formal verification of the withdrawal/rebalance path (the money pipe, not the whole system) would have cost a fraction of $8.4M. The deeper hypothesis: hook-based DEXes should treat "solvency of the wind-down plan" as a launch requirement — Bunni's mechanisms were arguably good enough to survive; its balance sheet was not.

Sources

  1. Bunni v1 GitHub (ZeframLou/bunni — ERC-20 LP tokens for Uniswap V3) — primary (contract)
  2. Bunni v2 GitHub (Bunniapp/bunni-v2 — Shapeshifting DEX built on Uniswap v4) — primary (contract)
  3. Bunni v2 documentation — primary (docs)
  4. BunniHub v1 on Etherscan — primary (contract)
  5. Bunni v2 Hub on Etherscan — primary (contract)
  6. Zefram's projects page — primary (retrospective)
  7. QuillAudits — Bunni V2 Exploit: $8.3M Drained via Liquidity Flaw (audit)
  8. Coinspect — Learn EVM Attacks: Bunni (analysis)
  9. DefiLlama — Bunni V2 TVL, Fees & Volume (analysis)
  10. Cryptonews — Bunni DEX Shuts Down After $8.4M Exploit, Citing Lack of Funds for Relaunch (news)
  11. Auditless Research — Bunni: How To Build a Leading Uniswap v4 Hook (analysis)

Related experiments

Last verified: 2026-07-26 · Spot an error? Suggest a correction