Dynamic fee hook on BNB Chain
Uniswap v4 Hook Contract 0x78542983f487ef50dc6e4af9e49eaaa3e22fa58b on BNB Chain · Dynamic fee
- Volume (24h)
- $0
- Value locked (TVL)
- $0.02
- All-time volume
- $0
- Pools using this hook
- 1
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 0
What it does
This hook charges a dynamic fee on swaps through its beforeSwap return delta and sends collected amounts to an owner-set fee receiver, though the exact direction and size of the fee cannot be confirmed from the decoded bytecode.
How it works step by step
- Hook is initialized through beforeInitialize and stores configuration in slot 0 (two uint16 values and an address), which appears to include a fee-related parameter set by selector 0x534eb4cf or 0xcb9442e2.
- beforeSwap runs on every swap and can return a delta, allowing the hook to take or give currency during the swap.
- afterAddLiquidity and afterRemoveLiquidity record per-position accounting in a nested mapping keyed by uint256 and address, and can return deltas that settle currency with the pool manager.
- Owner-controlled fee receiver (feeReceiver/setFeeReceiver) indicates collected amounts are routed to an address chosen by the owner.
- Debt accounting via debtOf and a take() external call suggests the hook settles balances it owes or is owed with the pool manager.
- Owner can transfer or renounce ownership, and uniswapV3/pancakeV3 swap callbacks are present, suggesting it can also interact with an external pool for routing.
- Swap behaviour
- beforeSwap is executed on each swap and can return a return delta, so the hook can take a portion of input or output currency on swaps; exact direction and amounts cannot be fully determined from bytecode alone.
- Liquidity behaviour
- afterAddLiquidity and afterRemoveLiquidity execute on liquidity changes, update internal accounting keyed by uint256 and address, and return deltas that can move currency between the hook and the pool.
- Fee behaviour
- Hook uses beforeSwap and return deltas to charge a dynamic fee, with the fee-related values stored in slot 0 and collected amounts directed to the feeReceiver address set by the owner.
- Owner & admin controls
- Owner (storage slot 2) can set the fee receiver, transfer ownership and renounce ownership; selectors 0x534eb4cf and 0xcb9442e2 write uint16 parameters that likely set fee or configuration values, and the exact permitted ranges are not visible.
Enabled Uniswap v4 callbacks
beforeInitialize, afterAddLiquidity, afterRemoveLiquidity, beforeSwap, beforeSwapReturnDelta, afterAddLiquidityReturnDelta, afterRemoveLiquidityReturnDelta
beforeInitialize sets initial hook configuration; beforeSwap and beforeSwapReturnDelta let the hook alter swap amounts and take fees; afterAddLiquidity and afterRemoveLiquidity with their return-delta flags let the hook settle currency on liquidity changes.
Security & trust assessment
Risk level: high, estimated (decoded bytecode, medium confidence).
Who controls it: A single owner key can change fee parameters, redirect the fee receiver to any address, and transfer or renounce ownership, which can alter how swappers and LPs are charged.
Risk to user funds: The hook holds and settles currency through return deltas and take() calls on swaps and liquidity changes, so user funds passing through the pool are exposed to whatever fee logic and owner settings the hook applies.
Security findings
- [high] Return deltas let the hook take currency: beforeSwapReturnDelta and afterAdd/RemoveLiquidityReturnDelta are enabled and the bytecode calls take(), so the hook can move pool currency on swaps and liquidity changes.
- [medium] Owner-controlled fee parameters: Owner-only setters write uint16 values in slot 0 and cb9442e2 and an address fee receiver, so the owner can change fee levels and redirect collected fees; the bounds were not verified.
- [medium] Owner can change configuration without a timelock: Ownable pattern with transferOwnership and renounceOwnership and no visible timelock or pause means a single key controls the hook.
- [info] No source for verification: Analysis relies on decoded bytecode, so exact fee formulas, bounds and access checks are inferred and may be incomplete.
Contract details
- Verified source
- No
- Bytecode size
- 12,611 bytes
- Upgradeable proxy
- No
- Detected patterns
- dynamic-fee, moves-currency, ownable, return-delta
Pools using Dynamic fee hook
- BNB / USDT (0.00% fee) — 24h volume $0, TVL $0.02, 0 swaps today