JBUniswapV4Hook on Base

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

Volume (24h)
$0.03
Value locked (TVL)
$1.17K
All-time volume
$24.13K
Pools using this hook
8
Swaps (24h)
9 (3 traders)
Total swaps
1,329

What it does

Routes swaps on Uniswap v4 pools for Juicebox project tokens, choosing between minting through Juicebox and selling on Uniswap while recording TWAP oracle observations for pricing.

How it works step by step

  • Initializes and records per-pool oracle observations in afterInitialize, afterAddLiquidity, afterRemoveLiquidity and afterSwap
  • Estimates expected outputs for Juicebox issuance versus Uniswap liquidity using TWAP data
  • Routes swaps in beforeSwap by returning deltas, so the hook fills part of the trade itself
  • Enforces slippage and delta limits and reverts on exact-output requests
  • Guards against reentrant routing and verifies that sells deliver the expected tokens
Swap behaviour
beforeSwap can supply a return delta so the hook fills swaps by issuing project tokens through Juicebox or selling into Uniswap, choosing the best route with estimated outputs; afterSwap records observations; exact-output swaps revert.
Liquidity behaviour
afterAddLiquidity and afterRemoveLiquidity update oracle observations and per-pool state; the hook does not take custody of LP positions.
Fee behaviour
Does not set a custom fee; swap routing via beforeSwap returns a delta that substitutes Juicebox token issuance or sell routing for the pool swap, so the trader's effective price is determined by the Juicebox bonding/issuance path or the Uniswap pool chosen by the router logic.
Owner & admin controls
No owner or pause controls found in the ABI; the hook is configured through constructor-set immutables (directory, prices, tokens, pool manager) with no setter functions exposed, so no admin can change parameters after deployment.

Enabled Uniswap v4 callbacks

afterInitialize, afterAddLiquidity, afterRemoveLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta

afterInitialize initializes oracle state for new pools; afterAddLiquidity and afterRemoveLiquidity record oracle observations; beforeSwap routes swaps between Juicebox issuance and Uniswap liquidity and returns a delta; afterSwap records post-swap observations; beforeSwapReturnDelta lets the hook take over part of the swap amount.

Security & trust assessment

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

Who controls it: No privileged owner key is present in the ABI, so centralization risk is low; the main trust assumptions are the immutable directory and price feed addresses set at deployment.

Risk to user funds: The hook can receive, hold briefly, and forward user input and output tokens through Juicebox and Uniswap during swaps, so user funds pass through the hook's routing logic; it does not expose a withdrawal or admin sweep function in the ABI.

Security findings

  • [medium] Return-delta swap routing: beforeSwapReturnDelta is enabled, so the hook can specify deltas that consume part of a swap, meaning it routes value rather than only observing the swap.
  • [medium] Hook briefly holds and approves tokens during routing: The contract includes explicit guards such as ReentrantRouting, SellInputReturned, TemporaryAllowanceNotConsumed and JuiceboxSellDidNotDeliver, indicating that the hook holds or temporarily approves tokens during routing and checks outcomes.
  • [low] Price depends on pool oracle observations: Oracle and TWAP outputs (observeTWAP, TWAP_SLIPPAGE_DENOMINATOR) determine expected outputs, so a manipulated or thin pool could skew the quoted expectation, though slippage checks bound the impact.
  • [info] Exact-output swaps are explicitly unsupported: Exact-output swaps are rejected and delta amounts are capped by MAX_V4_DELTA, limiting the surface for unbounded deltas.

Contract details

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

Pools using JBUniswapV4Hook