Custom pricing hook on Base

Uniswap v4 Hook Contract 0x5aef2c787afc743d20fd632d66391b2ccd5c68c0 on Base · Custom pricing

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

What it does

A Uniswap v4 hook that adds just-in-time liquidity and protocol fee accounting around swaps, with pause and role-based admin controls.

This read was written for the hook 0x42ba…a8c0 on Arbitrum 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

  • Registers pools on initialization and maps fee tiers to tick spacing
  • Gates liquidity additions in beforeAddLiquidity
  • Runs JIT liquidity checks and settlement in beforeSwap
  • Performs post-swap accounting in afterSwap
  • Splits a protocol share of fees to a configured recipient
  • Allows pausing of the hook and individual JIT positions
Swap behaviour
beforeSwap checks the pause flag and JIT state and may provision or settle JIT liquidity; afterSwap performs accounting and can take or settle currency with the pool manager.
Liquidity behaviour
beforeAddLiquidity is implemented and gates liquidity additions; JIT positions are registered and paused through setJITPosition and pauseJITPosition, and rescueUnvaultedToken moves stranded tokens. beforeRemoveLiquidity and afterRemoveLiquidity selectors are present in the dispatch table but their behaviour cannot be confirmed from bytecode alone.
Fee behaviour
Fee tiers are configured per fee value through setFeeTier(uint24,int24), which stores a tick spacing mapping; a protocol share in basis points is set through setProtocolShareBps(uint256) and bounded by MAX_PROTOCOL_SHARE_BPS.
Owner & admin controls
Not stated.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeAddLiquidity, beforeSwap, afterSwap

beforeInitialize registers pools and tick spacing for a fee tier; beforeAddLiquidity gates liquidity additions; beforeSwap runs a JIT liquidity check and is pausable; afterSwap performs post-swap accounting and may call back into the pool manager.

Security & trust assessment

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

Who controls it: Accounts holding DEFAULT_ADMIN_ROLE or role-granted operators can grant roles, pause the hook, change protocol fee recipient and share, set the backend signer used for signature validation, and rescue tokens. A compromised key could redirect protocol fees or pause swaps.

Risk to user funds: The hook can hold and move tokens during swap and liquidity callbacks and can rescue unvaulted tokens; a privileged key can pause swaps and direct protocol fees, but no source is available to confirm the absence of other withdrawal paths.

Security findings

  • [medium] Pausable swaps: The hook is pausable and beforeSwap checks the paused flag, so a privileged key can block all swaps through this hook.
  • [medium] Protocol fee redirection: Only the protocol fee recipient and share are settable, and the share is capped by MAX_PROTOCOL_SHARE_BPS; the cap limits but does not remove the ability to redirect fees.
  • [high] Token rescue power: rescueUnvaultedToken lets a privileged role move tokens held by the hook, which is a direct custody power over balances the hook holds.
  • [info] Moves currency in callbacks: The hook takes and settles tokens during callbacks via the pool manager (take and unlock selectors present), so it moves currency on user operations.
  • [medium] Backend signer trust: Signature validation depends on a single backendSigner address that can be rotated by an admin; signed JIT operations are only as trustworthy as that key.

Contract details

Verified source
No
Bytecode size
21,611 bytes
Upgradeable proxy
No
Detected patterns
moves-currency, pausable, self-unlock

Pools using Custom pricing hook