BunniHook on Unichain
Uniswap v4 Hook Contract 0x000052423c1db6b7ff8641b85a7eefc7b2791888 on Unichain · Dynamic fee · Verified contract
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $0
- Pools using this hook
- 50
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 76,106
What it does
BunniHook is the Uniswap v4 hook behind Bunni liquidity pools: it runs dynamic swap fees from an on-chain TWAP oracle, lets outside bidders run an am-AMM that captures arbitrage value as a swap fee discount/rebate, and auto-rebalances pool inventory through FloodPlain orders.
How it works step by step
- Records a TWAP oracle of pool ticks in afterInitialize and on swaps, used to compute dynamic swap fees and rebalance prices.
- beforeSwap computes the swap fee (base fee, quadratic volatility term, optional surge fee after vault share price changes or large imbalances) and can return a beforeSwapDelta to take a hook fee or am-AMM fee.
- Runs an am-AMM auction per pool where managers bid rent in BunniTokens to set the swap fee for a period; winning managers receive swap fee revenue accrued in pool manager claim balances.
- Can trigger a rebalance order: when the pool's idle balance exceeds a threshold, the hook sells excess tokens through a FloodPlain order and reinjects the output into the pool via BunniHub.
- beforeAddLiquidity restricts liquidity additions during rebalances and withdrawals are gated by canWithdraw until rebalance orders expire or the owner unblocks them.
- Optionally sends a configured share of swap fees to a hook fee recipient and lets a curator take a fee rate on pools they manage.
- Swap behaviour
- beforeSwap (nonReentrant, pool manager only) computes the dynamic fee, updates the TWAP oracle and slot0 timestamps, may apply a surge fee, takes a hook fee or am-AMM fee through the return delta, and accrues am-AMM fees to the current manager.
- Liquidity behaviour
- beforeAddLiquidity is restricted while a rebalance is in progress (notDuringRebalance). Withdrawals depend on canWithdraw, which is false while a rebalance order is active unless the owner unblocks the pool. Liquidity itself is managed by the separate BunniHub contract, not this hook.
- Fee behaviour
- Dynamic: base fee between feeMin and feeMax with a quadratic term driven by TWAP deviation, plus a surge fee that decays with a half-life. am-AMM managers can set a swap fee within maxAmAmmFee (capped at 10%). A hook fee of 10% to 50% of swap fees can be enabled and is sent to hookFeeRecipient.
- Owner & admin controls
- Owner (Solady Ownable with two-step handover) can set the FloodZone, the hook fee modifier (10% to 50%, cannot be turned off once on), a withdrawal unblock flag per pool, and schedule an increase of the am-AMM K constant. A hookFeeRecipientController can set the hook fee recipient once; the owner can do so after 180 days if unset. Curators of a pool can set their fee rate (max 3%) and claim accrued curator fees. The owner can also transfer or renounce ownership.
Enabled Uniswap v4 callbacks
afterInitialize, beforeAddLiquidity, beforeSwap, beforeSwapReturnDelta
afterInitialize records initial slot0 and oracle state for the pool. beforeAddLiquidity blocks liquidity changes during an active rebalance. beforeSwap computes the dynamic fee, updates the oracle, and returns a delta for hook and am-AMM fees. beforeSwapReturnDelta lets the hook take a share of the swap in the return delta.
Security & trust assessment
Risk level: medium (verified source, high confidence).
Who controls it: The owner key controls the FloodZone used for rebalance orders, the hook fee share, per-pool withdrawal unblocking, and the K schedule. A compromised owner could route rebalance activity to a malicious zone and combine that with fee changes and withdrawal unblocking to extract value from pools. The hookFeeRecipientController can permanently set the fee recipient.
Risk to user funds: The hook can take a fee from swaps via return delta, hold pool-manager claim tokens during rebalances, and send protocol and curator fee balances to recipients. Rebalance orders can execute swaps of pool inventory through FloodPlain. Withdrawals can be blocked while a rebalance is active. There is no evidence of an upgradeable proxy in the given code.
Security findings
- [medium] Owner can set hook fee share and unblock withdrawals: The owner can raise the hook fee modifier up to 50% of swap fees (once enabled it cannot be disabled) and can set withdrawalUnblocked per pool, which overrides the rebalance-based withdrawal block.
- [medium] Rebalance orders can block liquidity operations: While a rebalance is active, beforeAddLiquidity reverts and canWithdraw returns false until the deadline passes or the owner unblocks, so a stuck or unfilled rebalance order can freeze LP deposits and exits for a pool.
- [info] Hook takes value via return delta: beforeSwapReturnDelta means the hook can alter the amounts exchanged in a swap, taking protocol and am-AMM fees from the swap; this is by design but moves user funds on every swap.
- [info] Hook holds claim tokens and currency: The hook mints and burns pool manager claim tokens and can take tokens to a configured recipient in claimProtocolFees and curatorClaimFees, and it holds pool balances during rebalances.
- [low] Owner can change the am-AMM K constant: scheduleKChange lets the owner raise K (only upwards, activated at a scheduled block), which changes the am-AMM bid economics for all pools that use it.
Contract details
- Verified source
- Yes (BunniHook)
- Compiler
- solc 0.8.30+commit.73712a01
- Bytecode size
- 24,564 bytes
- Upgradeable proxy
- No
- Detected patterns
- auction, dynamic-fee, liquidity-management, moves-currency, oracle, ownable, return-delta, self-unlock
Pools using BunniHook
- ETH / USDC (0.0001% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.0003% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.0007% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.0001% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.0001% fee) — 24h volume $0, TVL $0, 0 swaps today
- USDC / WETH (0.0001% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / weETH (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.0001% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.0002% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.0008% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / ezETH (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- USDC / WETH (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / wstETH (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / rsETH (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / weETH (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.0004% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.0004% fee) — 24h volume $0, TVL $0, 0 swaps today