BunniHookLogic on Arbitrum
Uniswap v4 Hook Contract 0x000052423c1db6b7ff8641b85a7eefc7b2791888 on Arbitrum · Liquidity management · Verified contract
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $0
- Pools using this hook
- 9
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 0
What it does
Trades pay a dynamic fee that rises when the price moves away from the TWAP and spikes after vault share price changes, so trades moving the price further from the TWAP pay more and those moving it back pay less, while LPs earn the swap fee minus a protocol and curator cut.
This read was written for the hook 0x0000…1888 on BNB Chain and reused here: the two share a code shape, so constants such as fees, owners and addresses can differ.
How it works step by step
- Bunni hook for Uniswap v4 that prices swaps from a liquidity density function over the pool's active balances instead of a plain constant-product curve
- Computes a dynamic swap fee from the TWAP-based price deviation, bounded by feeMin and feeMax, plus a surge fee that decays after vault share price jumps or LDF-triggered rebalances
- Skips swaps with zero amountSpecified and reverts on invalid price limits, zero active output balance, or swaps that would move price the wrong way
- Maintains a tick oracle written on every swap and initialized in afterInitialize, used for the arithmetic mean tick and fee TWAP
- Optionally lets an am-AMM manager bid for the right to set a swap fee, with fees accrued to the manager and a protocol hook fee plus curator fee taken from swap fees
- Can trigger rebalance orders through FloodPlain after swaps when the balance ratio drifts past rebalanceThreshold, with withdrawals blocked while such an order is active
- Swap behaviour
- Swaps are priced by the LDF and the hook returns a beforeSwap delta taking the swap fee, hook fee and curator fee out of the output (exact-in) or adding them to the input (exact-out). Trades pay the dynamic fee, which rises with price deviation from the TWAP and with the surge fee after vault share price changes, so trades that push the price further from the TWAP pay more and those that move toward it pay less. Under am-AMM, the manager's fee applies instead, with a floor from the surge fee.
- Liquidity behaviour
- beforeAddLiquidity is permitted by the hook permissions; the implementation's liquidity handling is delegated to BunniHub and the rebalance logic, and the decoded beforeAddLiquidity path was not fully visible in the provided source. Liquidity deposits and withdrawals are routed through BunniHub; withdrawals are blocked while a rebalance order is active unless the owner unblocks them.
- Fee behaviour
- Dynamic fee computed from price deviation from the fee TWAP, clamped between feeMin and feeMax, with a quadratic multiplier and a surge fee that decays with surgeFeeHalfLife. When a hooklet overrides the fee, the override is used instead. When am-AMM is active, the manager's bid fee applies, capped by maxAmAmmFee. A hook fee (hookFeeModifier, 10% to 50% of swap fees) goes to hookFeeRecipient and a curator fee (up to 30% of the base swap fee) accrues to the curator.
- Owner & admin controls
- Owner (set via Ownable with 2-step handover) can set the Zone, set hookFeeModifier (10% to 50%), toggle withdrawal unblocking per pool, and schedule a higher K for am-AMM. The hookFeeRecipientController can set the hook fee recipient, and the owner can do so after 180 days if unset. Curators per pool can set their fee rate up to 30%. The implementation is reached through a proxy, so it may be upgraded by whoever controls the proxy.
Enabled Uniswap v4 callbacks
afterInitialize, beforeAddLiquidity, beforeSwap, beforeSwapReturnDelta
afterInitialize seeds slot0 and the oracle for each pool; beforeSwap runs the LDF-based swap, fee logic, am-AMM fee accrual and rebalance triggering; beforeAddLiquidity is enabled for pool liquidity checks; beforeSwapReturnDelta lets the hook return a specified/unspecified delta that takes fees and the output amount itself.
Security & trust assessment
Risk level: medium (verified source, medium confidence).
Who controls it: The owner can change the hook fee share, the Zone, withdrawal unblocking and the K schedule; the implementation can be upgraded through the proxy, which would change the logic that moves pool funds. The hookFeeRecipientController controls where protocol fees go.
Risk to user funds: The hook can take protocol and curator fees out of swap output and can run rebalance orders that move pool balances through FloodPlain, and it can block LP withdrawals while an order is active. Funds are custodied in BunniHub and PoolManager claim tokens, not the hook directly, but upgrade or owner changes could alter how they are moved.
Security findings
- [info] Hook takes fees and output via return deltas: beforeSwapReturnDelta lets the hook set the specified and unspecified deltas, so it directly determines the swap output and how much the pool gives up, subject to its LDF and fee math.
- [medium] Owner can raise hook fee up to 50%: setHookFeeModifier lets the owner set the protocol share of swap fees between 10% and 50%, changing how much of LP fee income goes to the hook fee recipient.
- [medium] Upgradeable proxy implementation: The hook delegates to an implementation behind a proxy, so the logic (fees, swap math, fund movement) can change if the proxy admin upgrades it; no timelock was observed in the provided source.
- [low] Withdrawals can be blocked during rebalance orders: canWithdraw returns false while a rebalance order is active, and only the owner can unblock it, so a stuck order can delay LP withdrawals.
- [low] Am-AMM manager can set swap fee up to maxAmAmmFee: A winning am-AMM bidder sets the swap fee for the pool up to maxAmAmmFee (at most 10%), which affects all swappers while the bid is active.
Contract details
- Verified source
- Yes (BunniHookLogic)
- Compiler
- solc 0.8.30+commit.73712a01
- Bytecode size
- 24,564 bytes
- Upgradeable proxy
- Yes
- Detected patterns
- liquidity-management, oracle, return-delta, upgradeable
Pools using BunniHookLogic
- ETH / DOT (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ARB / USD₮0 (0.0001% fee) — 24h volume $0, TVL $0, 0 swaps today
- ARB / USD₮0 (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ARB / USD₮0 (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USD₮0 (0.0001% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USD₮0 (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.00% fee) — 24h volume $0, TVL $0, 0 swaps today