Fee sharing hook on Ink

Uniswap v4 Hook Contract 0xef0ab9223ec45107b513316efe356277797e80cc on Ink · Fee sharing

Volume (24h)
$0
Value locked (TVL)
$0
All-time volume
$0
Pools using this hook
2
Swaps (24h)
0 (0 traders)
Total swaps
4

What it does

A Uniswap v4 hook that applies a configurable fee on swaps for registered pools and routes part of it to a protocol fee recipient and buyback vault.

How it works step by step

  • Stores a per-pool fee configuration keyed by pool id, registered through the factory-gated registerPool function
  • Applies a swap fee in basis points (BPS constant) in beforeSwap and afterSwap
  • Uses return-delta permissions so the hook can take part of the swap amounts
  • Routes the collected fee portion to a buyback vault address
  • Sends protocol fee share to a configurable protocol fee recipient
  • Exposes Ownable administration for factory, buyback vault and fee recipient
Swap behaviour
beforeSwap and afterSwap run on every swap and use return deltas to adjust the swap amounts and take a fee portion according to the pool's fee configuration.
Liquidity behaviour
Before and after add and remove liquidity callbacks are present in the dispatch table but their bodies are not confirmed; they appear to be pass-through or validation only.
Fee behaviour
Hook uses a per-pool fee configuration (poolFeeConfigs mapping keyed by pool id, swapFeeBps and BPS constants) and a protocol fee recipient; swap-time return deltas appear to take a fee portion and route it to a buyback vault and protocol fee recipient, though exact split logic cannot be confirmed without source.
Owner & admin controls
Owner (Ownable2Step: transferOwnership then acceptOwnership, renounceOwnership) can set the factory (setFactory), buyback vault (setBuybackVault) and protocol fee recipient (setProtocolFeeRecipient). Pools are registered via registerPool, which is restricted to the factory per the FactoryOnly error. No pause or upgrade mechanism was identified.

Enabled Uniswap v4 callbacks

beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeSwap and afterSwap are used to compute and apply fees on swaps; beforeSwapReturnDelta and afterSwapReturnDelta let the hook take a portion of swap amounts as a delta; the liquidity and initialize callbacks are exposed in the dispatch table but are not clearly enabled by the permission flags.

Security & trust assessment

Risk level: medium, estimated (decoded bytecode, low confidence).

Who controls it: The owner controls the factory address, buyback vault and protocol fee recipient. Changing the fee recipient or buyback vault could redirect protocol fee flows away from intended destinations, and changing the factory could allow unauthorized pool registration.

Risk to user funds: The hook can take a portion of swap amounts through return deltas and route that value to the buyback vault and protocol fee recipient. It does not appear to hold a custody balance, but it can alter the amounts users receive on swaps.

Security findings

  • [medium] Swap return delta takes funds: Return-delta permissions let the hook take part of swap amounts directly, so fee skim logic affects trader outputs.
  • [medium] Owner can redirect fee destinations: Owner can repoint the protocol fee recipient and buyback vault at any time without a timelock visible in the bytecode.
  • [medium] Owner can change factory gate: Owner can set the factory address, which gates registerPool; a malicious factory change could register arbitrary pool configurations.
  • [info] Ownable access control: Ownable pattern with two-step ownership transfer and renounce is present.

Contract details

Verified source
No
Bytecode size
8,200 bytes
Upgradeable proxy
No
Detected patterns
ownable, return-delta

Pools using Fee sharing hook