MonkeyHammerHook on Ethereum

Uniswap v4 Hook Contract 0x777f3b0c2ba4c68240bbf3d5a155fe671c000080 on Ethereum · Dynamic fee · Verified contract

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

What it does

A dynamic-fee hook that raises or lowers the swap fee on this pool based on how far its price has moved away from a smoothed reference price taken from an external Uniswap V2 pair.

How it works step by step

  • Reads the spot price from the reserves of a Uniswap V2 pair (reserve1 divided by reserve0)
  • Maintains a filtered reference price using a TWAP from the V2 pair cumulative price and exponential smoothing
  • Computes the deviation between spot and filtered price and maps it through a rational fee curve with six owner-set coefficients
  • Clamps the resulting fee between 1000 and 900000 hundredths of a basis point and returns it with the override flag on each swap
  • Exposes getFee, getFilteredPrice and updateFilter for off-chain reads and manual filter updates
Swap behaviour
On every swap, beforeSwap reads the V2 pair reserves to get the spot price, updates the filtered reference price (at most once every 15 minutes), computes a fee from the price deviation using the owner-set fee curve, clamps it between 0.1% and 90%, and returns it as the override fee for that swap.
Liquidity behaviour
No liquidity callbacks.
Fee behaviour
Dynamic fee computed in beforeSwap from the deviation between the spot price (from the reserves of a Uniswap V2 pair) and a filtered price; the fee is clamped between 0.1% and 90% and returned with the override flag (0x400000) so it replaces the pool's static fee for that swap. Fee is not taken by the hook itself.
Owner & admin controls
Owner (Ownable) can call setAlphaBeta to change the filter smoothing parameters alpha and beta, setFeeCurve to reprogram the six coefficients of the dynamic fee curve, transferOwnership and renounceOwnership. No pause or upgrade mechanism found; the contract is not a proxy.

Enabled Uniswap v4 callbacks

beforeSwap

beforeSwap is the only enabled callback; it reads the V2 pair reserves, updates the filtered price state, computes the dynamic fee and returns it with the override flag.

Security & trust assessment

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

Who controls it: The owner can reprogram the fee curve (for example set fees to extreme values within the clamp range of 0.1% to 90%) and change the filter parameters, which changes the fee every trader pays on this pool. The owner cannot move pool or user funds directly.

Risk to user funds: The hook does not hold tokens and returns a zero BeforeSwapDelta, so it cannot custody or move user or pool funds. Its exposure is through fee pricing: a high or manipulated fee charged on each swap reduces what traders receive.

Security findings

  • [medium] Fee depends on external V2 pair reserves: The spot price is read from the reserves of an external Uniswap V2 pair, and the filtered price is updated from that same spot price, so the fee depends on a manipulable external source; a large reserve shift in the V2 pair can move the fee.
  • [medium] Owner can set fees to extreme values: setFeeCurve and setAlphaBeta are callable by the owner without timelock or bounds checks, so the owner can set swap fees anywhere from the 0.1% floor up to the 90% cap.
  • [low] Division by reserves can revert swaps: updateFilteredPrice and the fee computation divide by reserve0 and filteredPriceX96 without zero checks; a zero reserve would revert swaps, which could block trading on the pool.
  • [info] Ownership and pair address not validated: The hook is Ownable with no pause; ownership can be transferred or renounced, and the constructor does not validate that the V2 pair address is a real pair.

Contract details

Verified source
Yes (MonkeyHammerHook)
Compiler
solc 0.8.29+commit.ab55807c
Bytecode size
7,239 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, ownable

Pools using MonkeyHammerHook