Dynamic fee hook on Avalanche

Uniswap v4 Hook Contract 0x62d177abac637d301c41b7a6627518017440d088 on Avalanche · Dynamic fee

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

What it does

A Uniswap v4 hook that sets dynamic swap fees per pool, can disable trading globally, and lets the owner claim accumulated fees and forward admin calls, with its fee logic reading from a pool config mapping and a default fee rate.

This read was written for the hook 0x3ee1…d088 on Ethereum and reused here: the two share a code shape, so constants such as fees, owners and addresses can differ.

How it works step by step

  • Stores a default fee rate in storage and lets the owner change it via setDefaultFeeRate.
  • Stores a per-pool fee rate in a mapping keyed by pool id, set through setPoolFeeRate, and exposes getEffectiveFeeRate to resolve the pool rate or fall back to the default.
  • Runs beforeSwap with a boolean trading-enabled flag and a per-pool flag, and can return a fee override and a return delta that changes how swap amounts are settled.
  • Initialises pool-specific state in afterInitialize when a pool is created.
  • Tracks fees and claims them through claimFees(address[],uint256[]), which can move tokens held by the hook to recipients.
  • Includes a generic adminCall(address,bytes,uint256) that lets the owner make arbitrary external calls on behalf of the hook.
Swap behaviour
beforeSwap checks the global trading-enabled flag and per-pool configuration, then applies the effective fee rate and may return a return delta that alters swap accounting. It reverts with TradingDisabled when trading is off.
Liquidity behaviour
Liquidity add and remove callbacks are present in the dispatch table as view stubs and the hook does not request liquidity-related permissions, so no liquidity callbacks are active.
Fee behaviour
Fees are dynamic: an effective rate is computed from the per-pool rate or the default rate and applied during beforeSwap. Fees collected via the return delta are later claimable through claimFees.
Owner & admin controls
Owner-only functions include setDefaultFeeRate, setPoolFeeRate, setTradingEnabled (global kill switch), claimFees, adminCall (arbitrary external call), and transferOwnership. Ownership is a single address with no visible timelock.

Enabled Uniswap v4 callbacks

afterInitialize, beforeSwap, beforeSwapReturnDelta

afterInitialize runs setup when a pool is created. beforeSwap enforces trading gates and sets the dynamic fee. beforeSwapReturnDelta lets the hook take or alter currency during swaps, which is the source of its ability to hold and redistribute user value.

Security & trust assessment

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

Who controls it: A single owner key can change fees, halt all swaps, drain hook-held balances via claimFees, and execute arbitrary calls through adminCall.

Risk to user funds: The hook can take and hold currency through return deltas and fee collection, and the owner can withdraw those balances or block swaps. Users' funds are exposed to owner discretion rather than to a fixed protocol rule.

Security findings

  • [high] Owner can set arbitrary fees: setDefaultFeeRate and setPoolFeeRate accept any uint256 with no visible bound in the dispatch; the owner could set a fee high enough to make swaps effectively confiscatory for traders.
  • [high] Global trading kill switch: setTradingEnabled(bool) lets the owner block all swaps across pools using this hook, and beforeSwap reverts with TradingDisabled when the flag is false.
  • [high] Generic adminCall escape hatch: adminCall(address,bytes,uint256) lets the owner execute arbitrary calls from the hook's context, which could move tokens the hook holds or interact with the pool manager, and this path is not restricted to a specific function set.
  • [medium] Fee and token custody by hook: The hook has beforeSwapReturnDelta and moves currency (take/settle/mint/burn selectors present), so it holds balances and claimFees can transfer them to recipients chosen by the owner.
  • [medium] Single-owner centralization: Ownership is held by one address that can transfer ownership at once, with no visible timelock or multisig requirement in the decoded surface.

Contract details

Verified source
No
Bytecode size
18,618 bytes
Upgradeable proxy
No
Detected patterns
erc6909-claims, moves-currency, ownable, return-delta, self-unlock

Pools using Dynamic fee hook