Dynamic fee hook on Ethereum

Uniswap v4 Hook Contract 0x8dd9789cf7dd951164e2c6bebb3e726f60b3afdc on Ethereum · Dynamic fee

Volume (24h)
$0
Value locked (TVL)
$0
All-time volume
$0
Pools using this hook
1
Swaps (24h)
127 (58 traders)
Total swaps
127

What it does

This hook charges a decaying dynamic fee that starts high after pool opening and falls toward a lower end fee, and it takes an extra tax on swaps that is split between a dev wallet and a burner, so early trades pay more and later trades pay less.

How it works step by step

  • Sets a pool fee that starts at a high start fee and decays toward an end fee over time after the pool is opened, as indicated by decay, startFee, endFee, currentFee and openedAt selectors
  • Records the block in which the pool was opened and the sqrt price at that block (blockOpenSqrtPrice mapping) to detect early or launch-block trading
  • Accrues a tax on swaps and holds the collected amounts, which are later split between a dev wallet (devShareBps, claimDevFees) and a burner (burnShareBps, burner) through unlockCallback and collectTax
  • Uses before-swap return delta and after-swap return delta to take a portion of swap amounts as tax, moving currency through the pool manager (take and creditPoolManager calls)
  • Gates liquidity additions and swaps through a gate contract (setGate, gate selector) and tracks an owner with two-step ownership transfer
Swap behaviour
Swaps run a beforeSwap hook that reads the current decayed fee and can take a tax via return delta; afterSwap records the trade and can take a further tax. Trades in the early decay period pay the higher start fee, and later trades pay progressively less, down to the end fee; the exact tax split between fee and tax cannot be fully determined from bytecode alone.
Liquidity behaviour
beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity callbacks are present; the add path appears gated by the gate contract and the remove path has a view-level check, and no fee is clearly taken from liquidity moves from decoded bytecode.
Fee behaviour
Fee decays from startFee to endFee over time from the open block, with currentFee exposing the live value. A tax portion is additionally taken on swaps via return deltas and split between devShareBps to the dev wallet and burnShareBps to the burner.
Owner & admin controls
Owner (two-step transfer with pendingOwner, acceptOwnership, renounceOwnership) can set the dev wallet (setDevWallet), set the gate contract (setGate), and adjust tax parameters through the uint16 storage slot (bps values). Owner can renounce ownership. No pause or upgrade mechanism was identified from decoded bytecode.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity, afterRemoveLiquidity, beforeSwap, afterSwap, afterDonate, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize records pool setup; beforeAddLiquidity and afterAddLiquidity gate and track liquidity additions; beforeRemoveLiquidity and afterRemoveLiquidity handle removals; beforeSwap sets the dynamic fee and gating; afterSwap records swap results and takes tax; afterDonate is enabled but its handler does nothing notable in decoded form; beforeSwapReturnDelta and afterSwapReturnDelta allow the hook to take currency from swaps.

Security & trust assessment

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

Who controls it: The owner controls the dev wallet, the gate contract and tax parameters, so a compromised owner key could redirect tax proceeds or gate trading.

Risk to user funds: The hook can take a portion of swap amounts via return deltas and move them to the dev wallet and burner, and the gate can restrict trades; it does not appear to hold open-ended custody of LP principal from decoded bytecode.

Security findings

  • [medium] Hook takes tokens via return deltas: beforeSwapReturnDelta and afterSwapReturnDelta are enabled and the contract calls take and creditPoolManager, so it moves user swap currency to the dev wallet and burner as tax.
  • [medium] Owner can change tax split and recipients: The owner can call setDevWallet and modify bps parameters stored in the uint16 slot, redirecting tax revenue or changing the share sent to the burner.
  • [medium] Gate contract can block liquidity and swaps: A gate contract address is stored and read in beforeAddLiquidity and beforeSwap paths; the owner can swap in a different gate that may block trading.
  • [low] Unlock callback path with external calls: unlockCallback and self-unlock pattern execute pool manager operations with token transfers; correctness depends on caller checks which were not fully visible.

Contract details

Verified source
No
Bytecode size
9,835 bytes
Upgradeable proxy
No
Detected patterns
moves-currency, ownable, return-delta, self-unlock, tax

Pools using Dynamic fee hook