Fee sharing hook on Base

Uniswap v4 Hook Contract 0x9380d0b27282efc4ca76d04f465ecd8ef0042888 on Base · Fee sharing

Volume (24h)
$0
Value locked (TVL)
$0
All-time volume
$0
Pools using this hook
89
Swaps (24h)
0 (0 traders)
Total swaps
11,418

What it does

A Uniswap v4 hook that applies a configurable fee on swaps and can route collected fees to a token jar, with a privileged admin role controlling the fee parameter.

How it works step by step

  • Records pool state on initialization in a mapping keyed by pool id
  • Gates liquidity additions in beforeAddLiquidity
  • Reads a configurable uint24 fee in beforeSwap and quote
  • Returns a delta in beforeSwap so part of the swap can be taken by the hook
  • Forwards collected fees to a token jar and interacts with a protocol fee controller
  • Exposes admin, poolManager, expiryBlock and hook permission getters
Swap behaviour
beforeSwap and afterSwap-related selectors are present; beforeSwap reads a stored fee and pool state and, via return delta, can take or settle a share of the swap amounts.
Liquidity behaviour
beforeAddLiquidity is enabled and returns a selector; liquidity removal and afterAddLiquidity/afterRemoveLiquidity are present as functions but their permission bits are not enabled, so they are not invoked by the pool manager. Behaviour on add is not clearly determined from bytecode.
Fee behaviour
A uint24 stored at slot 0 offset 20 is written by a nonpayable setter (0xc5cda8d2) and read in beforeSwap and quote, suggesting a configurable fee applied per swap; the exact fee math cannot be confirmed without source. protocolFeeFlags and protocolFeeController references suggest protocol fee interaction.
Owner & admin controls
Storage slot 0 holds an address (likely admin) with a uint24 at offset 20 (likely a fee value) written by selector 0xc5cda8d2; pollTokenJar and quote write slot 0 as well. Owner-only gating is not confirmed without source, but the admin() getter and writes to slot 0 indicate a privileged role that can set a fee value and trigger token jar operations.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeAddLiquidity, beforeSwap, beforeSwapReturnDelta

beforeInitialize: runs on pool creation, likely to validate pool parameters and record pool state in mapping at slot 3. beforeAddLiquidity: runs before liquidity is added, likely to gate or validate LP actions (a LiquidityNotAllowed error is present). beforeSwap: runs before each swap, reading the fee value and pool state to compute the swap result. beforeSwapReturnDelta: lets the hook return a delta that alters the swap amounts, meaning it can take or settle a portion of the swap currency.

Security & trust assessment

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

Who controls it: A privileged key appears able to change the stored fee value and possibly trigger token jar collection; the magnitude of fee changes and any caps cannot be determined from the bytecode.

Risk to user funds: Because beforeSwapReturnDelta is enabled and the hook uses take and settle, it can hold or redirect a portion of swap proceeds and forward fees to a token jar; the scope depends on the stored fee value and logic not visible without source.

Security findings

  • [medium] Return delta can move swap currency: beforeSwapReturnDelta is enabled, so the hook can alter the amounts exchanged in a swap and move currency using take and settle calls.
  • [medium] Adjustable fee by privileged caller: A uint24 fee value is stored in slot 0 and written by a nonpayable setter (0xc5cda8d2); without a cap check visible in decoded form, an authorized caller may be able to set a very high fee.
  • [info] Admin gating not verified: Selectors for OnlyAdmin and LiquidityNotAllowed errors plus the admin getter suggest access control exists, but enforcement cannot be verified without source.
  • [info] External token jar and fee controller dependency: Hook calls a token jar and a protocol fee controller; collected fees are forwarded to external contracts whose behaviour is outside this hook.

Contract details

Verified source
No
Bytecode size
12,153 bytes
Upgradeable proxy
No
Detected patterns
moves-currency, return-delta

Pools using Fee sharing hook