YinYangHook on Ethereum

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

Volume (24h)
$33
Value locked (TVL)
$0.20
All-time volume
$33
Pools using this hook
1
Swaps (24h)
11 (2 traders)
Total swaps
11

What it does

This hook charges traders a dynamic fee on the ETH/YINYANG pool that rises when a trade pushes price further from the block's opening price and is discounted (via the backrun-capture side) when a trade moves price back toward that opening level, with the total fee capped at 3 percent.

How it works step by step

  • Sets a dynamic LP fee on every swap of a single native ETH and YINYANG pool, using a volatile-pair fee model from the vendored VolatilePair math.
  • Tracks the pool sqrt price once per block and measures the relative price move since the last block open.
  • Moving price toward one side raises that side's permanent skew fee (capped by maxSkew and maxSkewStep) and places a one-block temporary fee on the opposite side.
  • Price moves back toward the block open charge a backrun-capture fee proportional to displacement; continuing moves away from the block open charge a capped mid-fade fee.
  • Caps the total fee (LP fee plus protocol fee) at 3 percent (MAX_TOTAL_FEE_E6 = 30,000) via FeeCap.
  • Blocks any pool initialization not made by the hook's own initializePool function, and rejects swaps on any other pool key.
Swap behaviour
beforeSwap checks the pool key, updates the per-block fee state on the first swap of a block, and returns an overridden LP fee for the swap direction. ZERO_DELTA is returned, so the hook takes no tokens and does not alter swap amounts. Sells of YINYANG (ETH received, zeroForOne false in the ETH/token orientation described by the source comments as ask) and buys of YINYANG face different fees depending on which side the price recently moved; the side that pushes price further from the block open pays the higher continuing fee, while trades back toward the block open pay the backrun-capture fee.
Liquidity behaviour
No liquidity callbacks.
Fee behaviour
Dynamic LP fee overridden per swap via the OVERRIDE_FEE_FLAG. Fee = baseline (permanent skew fee, plus temporary fee on the backrun side) plus a displacement-based component, clamped to 1e6-2 pips internally, then capped so that LP fee plus protocol fee does not exceed 3 percent. The resting spread is set at configuration and split between ask and bid sides; the constructor initializes the ask permanent fee to half of it.
Owner & admin controls
No owner, pause, upgrade or parameter-change functions are present in the ABI or source. The only privileged address is the immutable initializer, which alone can call initializePool once. The fee configuration is fixed in the constructor and cannot be changed afterwards.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeSwap

beforeInitialize: reverts every initialization, so only the hook's own initializePool call (which the PoolManager skips for self-calls) can create the pool. beforeSwap: updates fee state each block and returns the directional dynamic LP fee with the override flag; it returns no delta and does not hold or move funds.

Security & trust assessment

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

Who controls it: The initializer address can only create the single pool once and cannot alter fees, pause swaps, or move funds. No other privileged key exists in the code.

Risk to user funds: The hook does not hold or transfer user funds; it only supplies the swap fee via the LP fee override, so user funds are affected only through the fee amount charged to traders and received by LPs.

Security findings

  • [info] Hook takes no funds: beforeSwap returns ZERO_DELTA and the hook has no return-delta permission bit set, so it cannot take or move user tokens or pool funds.
  • [info] Immutable configuration and no admin: Fee parameters are fixed in the constructor with validation, and there is no owner, pause, or upgrade path; only the one-time initializer can create the pool.
  • [low] Fee depends on price moves, not on block-level manipulation limits: Fee state updates once per block from the first swap's observed price, so a large move within one block is priced only by the same-block displacement component; this is a design characteristic rather than a privileged-access risk.
  • [info] Pool bound to one token: The token address is immutable and the pool key is fixed to native ETH against that token, so other pools cannot use this hook's fee state.

Contract details

Verified source
Yes (YinYangHook)
Compiler
solc 0.8.26+commit.8a97fa7a
Bytecode size
6,380 bytes
Upgradeable proxy
No
Detected patterns
fee-sharing

Pools using YinYangHook