HookLibrary on Robinhood Chain

Uniswap v4 Hook Contract 0x14f1ad1c3a3a4e8e3d5cf7416ba094a33074facc on Robinhood Chain · Rewards · Verified contract

Volume (24h)
$3.11
Value locked (TVL)
$1.22K
All-time volume
$1.82K
Pools using this hook
10
Swaps (24h)
3 (2 traders)
Total swaps
418

What it does

This hook charges a per-token buy/sell tax on swaps: the taxed side is set by swap direction, the tax is a basis-point percentage read from the BuilDeFi registry, and the hook also reads a TWAP oracle, so traders on taxed tokens receive less output while LPs are not directly affected.

How it works step by step

  • Exposes a library of helper functions (HookLibrary) used by a BuilDeFi Uniswap v4 hook: TWAP observation checks, TWAP sqrt price lookup, and a sqrt-ratio quote helper.
  • Computes a buy/sell tax as a flat percentage of the swap amount, with the tax currency chosen from swap direction and sign of amountSpecified.
  • Reads per-token tax rates (tokenTaxBps) from the BuilDeFi core registry to decide how much tax applies to each side of a swap.
  • Before-swap tax is taken from the specified amount; after-swap tax is taken from the realized output amount in the balance delta.
  • Reads a truncated geometric-mean oracle (observe, getState, getObservation) stored on the hook to derive arithmetic mean ticks over a lookback window.
Swap behaviour
Swap-time tax is computed in the library: beforeSwap returns a specified-currency delta equal to swapAmount times tokenTaxBps/10000, and afterSwap returns an unspecified-currency delta equal to the realized output amount times tokenTaxBps/10000. Which token is taxed depends on direction; the taxed token is whichever side the registry has a nonzero tax for.
Liquidity behaviour
No liquidity callbacks.
Fee behaviour
Uses the pool's static fee for the pool itself; the hook adds a separate per-token buy/sell tax (tokenTaxBps, in basis points) that is collected through return deltas rather than the LP fee.
Owner & admin controls
Not determinable from the provided library source; the tax rates live in the external BuilDeFi core registry (IBDeFiCore.tokenTaxBps), whose setters and owner are not included. Proxy upgrade authority for the implementation is also not shown.

Enabled Uniswap v4 callbacks

beforeInitialize, afterInitialize, beforeAddLiquidity, beforeRemoveLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize and afterInitialize are enabled for pool setup and oracle initialization; beforeAddLiquidity and beforeRemoveLiquidity are enabled for liquidity gating or bookkeeping; beforeSwap and afterSwap are enabled to read the oracle and apply the buy/sell tax; beforeSwapReturnDelta and afterSwapReturnDelta are enabled so the hook can take tax amounts from swaps.

Security & trust assessment

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

Who controls it: A privileged key on the core registry or the proxy admin could raise tokenTaxBps to a large value or replace the implementation, changing what traders pay on taxed tokens.

Risk to user funds: The hook takes a tax from swap amounts via return deltas on tokens with nonzero tax, so it does hold a claim on user swap proceeds in the taxed currency; it does not appear to block swaps outright, but a high tax setting would materially reduce user output.

Security findings

  • [medium] Return-delta tax collection: beforeSwapReturnDelta and afterSwapReturnDelta are enabled, so the hook can take a cut of every swap on taxed tokens; the tax rate is read live from the core registry, so a change there takes effect immediately on existing pools.
  • [medium] Upgradeable proxy: The hook address is a proxy delegating to implementation 0x4fc22a11ac7b0684ff8c42351e5ef7afe442c3e6; the implementation can be swapped by whoever controls the proxy admin, changing all logic including tax and oracle behaviour.
  • [low] Oracle observation reads: getOldestObservationSecondsAgo requires cardinality > 0 and TWAP consults revert when the lookback predates the oldest observation, which can block dependent calls on newly initialized pools.
  • [info] Unchecked tax arithmetic: Tax math uses int256/int128 casts of unbounded amounts; very large swap amounts could overflow the cast, though typical amounts are well within range.

Contract details

Verified source
Yes (HookLibrary)
Compiler
solc 0.8.28+commit.7893614a
Bytecode size
17,701 bytes
Upgradeable proxy
Yes
Detected patterns
oracle, return-delta, tax, upgradeable

Pools using HookLibrary