MyNewHook on Ethereum
Uniswap v4 Hook Contract 0x47f1c7c7d5bd2039d9d3a997d91569869edf1080 on Ethereum · Dynamic fee · Verified contract
- Volume (24h)
- $21.75K
- Value locked (TVL)
- $823.86K
- All-time volume
- $1.60M
- Pools using this hook
- 1
- Swaps (24h)
- 172 (112 traders)
- Total swaps
- 8,682
What it does
A dynamic-fee hook that prices each swap's fee from recent realized tick volatility, raising fees during price dislocations and keeping them low in calm markets.
How it works step by step
- Tracks the pool tick across 5m, 15m, 30m and 1h observation windows, each with its own timestamp, and computes a weighted tick-rate volatility.
- Smooths volatility with an EWMA (alpha 0.4) that decays per elapsed minute, applying missed decay lazily on the next swap.
- Prices the swap fee as max(EWMA, instantaneous volatility), mapped through four continuous regime curves from 0.01% to 2.00%.
- Returns the fee as an override flag in beforeSwap and re-syncs the pool's stored LP fee when the change is at least 0.01%.
- Exposes read-only previewSwapFee, getCurrentFee and getCurrentVolatility for routers and analytics.
- Swap behaviour
- On each swap the hook reads the current tick, advances the volatility windows and EWMA at most once per minute, computes the effective volatility and charges the resulting dynamic fee as an override.
- Liquidity behaviour
- No liquidity callbacks.
- Fee behaviour
- Fee is recomputed each swap from effective volatility (max of EWMA and instantaneous multi-timeframe tick volatility), using four regimes with a floor of 0.01% and a cap of 2.00%. The fee is returned as an override in beforeSwap and the pool's stored LP fee is re-synced when it moves by at least 0.01%.
- Owner & admin controls
- No admin controls found. The contract has no owner, no pausability and no upgrade path; all parameters are constants and the poolManager is immutable.
Enabled Uniswap v4 callbacks
afterInitialize, beforeSwap
afterInitialize sets initial per-pool volatility state and rejects non-dynamic-fee pools; beforeSwap advances the volatility/EWMA state and returns the dynamic fee override.
Security & trust assessment
Risk level: low (verified source, high confidence).
Who controls it: No privileged role exists, so no single key can alter fees, pause swaps or move funds.
Risk to user funds: The hook does not hold or move user or pool funds and cannot block swaps (beforeSwap reverts only if the pool is uninitialized or the caller is not the PoolManager). Users are exposed only to the fee level charged, which is bounded between 0.01% and 2.00%.
Security findings
- [info] No token custody or delta capture: The hook returns BeforeSwapDelta.ZERO and has no return-delta permissions, so it cannot take or hold user tokens.
- [info] Manipulation-resistant volatility measure: Volatility is measured from tick observations advanced at most once per 60 seconds on block.timestamp, and the effective volatility uses max(EWMA, instant), so fees rise instantly but decay only via the EWMA, limiting cheap fee suppression.
- [info] Hard fee bounds: Fees are bounded to 0.01% through 2.00% by _convertBpsToV4Fee, so a swapper cannot push fees to extremes or to zero beyond the floor.
- [low] Lazy state advancement: Swaps and volatility state depend on pool price observations that are sampled when swaps occur; a pool with no swaps retains stale volatility until the next swap, and the EWMA decay is applied lazily on that swap.
Contract details
- Verified source
- Yes (MyNewHook)
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Bytecode size
- 17,946 bytes
- Upgradeable proxy
- No
- Detected patterns
- dynamic-fee
Pools using MyNewHook
- ETH / USDC (Dynamic fee) — 24h volume $21.75K, TVL $412.31K, 172 swaps today