JBUniswapV4Hook on Base

Uniswap v4 Hook Contract 0x5c989a282a05e967f2d291467cc6d6c4500cd5c8 on Base · Custom pricing · Verified contract

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

What it does

Routes Uniswap v4 swaps for Juicebox project tokens, quoting between a Juicebox terminal sell and the pool price and recording TWAP oracle data for the pool.

How it works step by step

  • Seeds TWAP oracle state for each pool when it is initialized
  • Records observations on liquidity add and remove to keep the TWAP current
  • Quotes expected output from a Juicebox terminal sell versus the Uniswap pool
  • Selects the best route and fills exact-input swaps through the hook via return delta
  • Reverts exact-output swaps and enforces V4 delta limits
  • Verifies Juicebox sell delivery and reverts on shortfall
Swap behaviour
beforeSwap can fill the swap by selling Juicebox project tokens through the terminal when that yields better output, returning the resulting delta to the PoolManager; afterSwap records oracle observations.
Liquidity behaviour
afterAddLiquidity and afterRemoveLiquidity callbacks update oracle observation state for the pool; the hook does not hold LP positions itself.
Fee behaviour
Swaps may be routed through Juicebox project token sales or Uniswap v4 pools, selected by quote; the hook returns swap deltas to the PoolManager rather than setting a dynamic fee, and any fee is handled by the underlying routing.
Owner & admin controls
No admin controls found.

Enabled Uniswap v4 callbacks

afterInitialize, afterAddLiquidity, afterRemoveLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta

afterInitialize seeds pool oracle state; afterAddLiquidity and afterRemoveLiquidity record observations; beforeSwap can return a custom delta to fill swaps against Juicebox terminals; afterSwap records oracle observations and settles residual balances; beforeSwapReturnDelta lets the hook consume the input and supply the output of a swap.

Security & trust assessment

Risk level: medium (verified source, medium confidence).

Who controls it: The contract shows no owner or privileged role in its ABI; no single key appears able to change parameters or pause routing, so centralization risk is limited to whatever the Juicebox directory and terminals control.

Risk to user funds: The hook can hold and move swap input and output tokens during beforeSwap and afterSwap because it returns deltas, so user funds pass through its routing logic; it reverts rather than blocking funds when delivery checks fail.

Security findings

  • [medium] Hook takes over swap settlement via return delta: beforeSwapReturnDelta lets the hook settle swaps itself by taking input and returning output, so swap correctness depends on the Juicebox sell and terminal logic being sound.
  • [info] External terminal dependency: Custom errors such as JBUniswapV4Hook_JuiceboxSellDidNotDeliver and JBUniswapV4Hook_SellInputReturned indicate the hook verifies external terminal delivery and reverts on mismatch, reducing silent loss but adding a dependency on external contracts.
  • [info] Reentrancy protection present: Reentrancy guard error JBUniswapV4Hook_ReentrantRouting suggests explicit protection against reentrant routing during swaps.
  • [info] Delta and exact-output limits: The hook enforces V4 delta limits (MAX_V4_DELTA) and reverts on exact-output swaps, limiting the size and type of swaps it can process.

Contract details

Verified source
Yes (JBUniswapV4Hook)
Compiler
solc 0.8.28+commit.7893614a
Bytecode size
18,089 bytes
Upgradeable proxy
No
Detected patterns
moves-currency, oracle, return-delta

Pools using JBUniswapV4Hook