HookeFeeHook on Robinhood Chain

Uniswap v4 Hook Contract 0xb51d89bbc50b5ae469be8cfbf305cab6ff3a50cc on Robinhood Chain · Dynamic fee · Verified contract

Volume (24h)
$75.57K
Value locked (TVL)
$5.31M
All-time volume
$6.44M
Pools using this hook
1
Swaps (24h)
1,844 (262 traders)
Total swaps
29,650

What it does

A dynamic-fee hook for a tokenized stock pool that charges a 2% to 4% USDC protocol fee on each swap, with the rate set by how far the pool price deviates from an oracle stock price, and sends the fee to a fixed Treasury.

How it works step by step

  • Charges a dynamic USDC protocol fee between 2% and 4% based on the deviation of the pool price from an oracle stock price.
  • Reads the stock price from HookeOracleRegistry, treating the market as closed or unhealthy by applying the anchor fee of 2%.
  • Fixes the fee on the specified stablecoin leg in beforeSwap using a bisection search over read-only replays of the pool swap.
  • Takes the USDC fee to the immutable Treasury address and emits Uniswap v4 HookFee, DynamicFeeResolved and ProtocolFeeCollected events.
  • Records tick-cumulative observations at initialization and each block's first swap, exposing a TWAP mean tick via consultMeanTick.
Swap behaviour
On each swap the hook reads the oracle, prices the fee and takes the USDC protocol fee to the Treasury. For exact-input buys and exact-output sells the fee on the specified stablecoin amount is fixed in beforeSwap; for other modes the fee is taken on the unspecified leg in afterSwap at the post-swap price. Swaps revert if they do not match the snapshot or if the pool is unsupported.
Liquidity behaviour
No liquidity callbacks.
Fee behaviour
Fee is dynamic and set by the hook, not by the pool (the canonical pool has a zero LP fee). The fee rate is a function of the deviation between the pool price and an oracle stock price: taxFromDeviation maps deviation to a rate between FEE_MIN (20000 ppm, 2%) and FEE_MAX (40000 ppm, 4%), with the anchor at 20000 ppm when the market is closed or the oracle is unhealthy. Buys and sells use the aggravating or converging curves depending on direction. The full protocol fee is taken in USDC and sent to the Treasury address. Exact-input buys and exact-output sells have the fee fixed in beforeSwap via a bisection search over read-only replays of the pool swap; other modes charge the fee at the post-swap end price in afterSwap. An optional 32-byte hookData can carry a fee commitment that is verified after the swap.
Owner & admin controls
HookeFeeHook has no owner, pause or upgrade functions; its parameters (fee bounds, observation settings, treasury, token, usdc, oracle and feed) are immutable or constant. The associated HookeOracleRegistry is Ownable2Step: its owner can add or remove publishers via setPublisher, and publishers can push prices that the hook reads, so the price feed is controlled by that owner and its publishers.

Enabled Uniswap v4 callbacks

afterInitialize, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

afterInitialize: records the initial tick-cumulative observation for the TWAP ring buffer. beforeSwap: reads the oracle price, fixes the fee on the specified stablecoin leg, snapshots swap state and optionally checks the commitment in hookData. afterSwap: verifies the swap matched the snapshot, computes the post-swap fee, takes the USDC protocol fee to the Treasury via manager.take and emits HookFee, DynamicFeeResolved and ProtocolFeeCollected events. beforeSwapReturnDelta and afterSwapReturnDelta: allow the hook to take a specified-currency amount in beforeSwap and an unspecified-currency fee in afterSwap, which is how the protocol fee is collected.

Security & trust assessment

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

Who controls it: The oracle registry owner can add or remove publishers, and publishers can push arbitrary prices within the registry's validity rules (MAX_PRICE, MAX_AGE, closed-market validity window). A malicious or compromised publisher or owner could push a false stock price, moving the deviation and therefore the fee charged on every swap up to the FEE_MAX cap, or force the oracle to appear unhealthy so the fee falls to the anchor. The hook itself has no admin keys and cannot be paused or upgraded.

Risk to user funds: The hook can take a USDC protocol fee on every swap through return deltas and manager.take, sent to the immutable Treasury; the hook does not hold user funds and cannot block swaps except by reverting on invalid callbacks, unsupported pools, or a commitment mismatch. The main exposure is that the fee size can be driven to its cap by a manipulated oracle price.

Security findings

  • [medium] Fee depends on a centrally controlled oracle: The fee is a function of an externally supplied oracle price. The registry owner (Ownable2Step) controls which publishers can post prices, and any publisher can post any price within the registry's bounds, so a bad price can move the fee on every swap.
  • [info] Protocol fee sent to a fixed Treasury: The hook takes a protocol fee of 2% to 4% in USDC on each swap and sends it to an immutable Treasury address; the Treasury can be an EOA and the fee cannot be changed by the hook owner, but the rate tracks the oracle price deviation.
  • [info] Hook moves currency via return deltas and take: The hook uses beforeSwapReturnDelta and afterSwapReturnDelta to take the fee, and it calls manager.take on the USDC currency during afterSwap. This means the hook directly moves user funds, though only the fee amount and only to the fixed Treasury.
  • [low] TWAP oracle is manipulable over short windows: The contract records tick-cumulative observations on each block's first swap and exposes a time-weighted mean tick through consultMeanTick, which is intended for bonding-curve calibration. Observations are not manipulation-resistant against an actor who can move the price across a whole window.

Contract details

Verified source
Yes (HookeFeeHook)
Compiler
solc 0.8.26+commit.8a97fa7a
Bytecode size
15,279 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, moves-currency, oracle, return-delta, rewards, tax

Pools using HookeFeeHook