Dynamic fee hook on Ink
Uniswap v4 Hook Contract 0x6652d9dfd33df8a1beaf3652c722a6595db2eacc on Ink · Dynamic fee
- Volume (24h)
- $1.30K
- Value locked (TVL)
- $0.05
- All-time volume
- $1.30K
- Pools using this hook
- 1
- Swaps (24h)
- 5 (3 traders)
- Total swaps
- 5
What it does
This hook charges a configurable tax on swaps in one direction per pool, so trades in the taxed direction pay more than the base pool fee while trades in the other direction pay only the base fee.
How it works step by step
- Registers pools with a per-pool tax configuration when they are initialized through the owner-restricted registration path (selector 0x0b146566 writes a pool registry flag)
- Applies a tax in basis points to swaps, stored per pool and per swap direction (taxBps keyed by pool id and a boolean)
- Caps configurable taxes at a maximum tax basis points constant and reverts with InvalidTax when a set value exceeds it
- Uses the before-swap and after-swap callbacks together with return deltas to take the tax from the swap amount and move the currency through the pool manager
- Uses an unlock callback so the hook can call the pool manager's take function while settling the tax
- Restricts setFactory and pool registration to a deployer address (NotDeployer error)
- Swap behaviour
- beforeSwap and afterSwap are both implemented and both have return-delta permissions, so the hook can take a portion of swap amounts as a tax. The tax rate is read from storage per pool and per swap direction, and the taxed currency is moved to the hook via take. Trades in the taxed direction pay more and trades in the other direction pay the base pool fee only, as far as the decoded bytecode indicates.
- Liquidity behaviour
- beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity are present as selectors. The decoded bytecode does not clearly show them charging or moving funds, so their effect is unclear from the input.
- Fee behaviour
- Uses a per-pool, per-direction tax in basis points read from storage, capped by MAX_TAX_BPS and applied through return deltas in the swap callbacks, on top of the pool's fee.
- Owner & admin controls
- A deployer address, set in the contract, can change the factory via setFactory and is the only caller allowed to register pools (NotDeployer). The bytecode shows a storage slot for an address that is written by setFactory, so the deployer can reconfigure the factory. Tax values appear to be set through a function that reverts on invalid tax, so the deployer may be able to change tax rates per pool; the exact setter could not be identified by name.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeAddLiquidity, beforeRemoveLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta
beforeInitialize registers or validates pools. beforeAddLiquidity and beforeRemoveLiquidity gate liquidity actions. beforeSwap sets up the tax for the swap. afterSwap applies the tax and takes the currency. beforeSwapReturnDelta and afterSwapReturnDelta let the hook alter swap amounts. afterAddLiquidity, afterRemoveLiquidity, afterInitialize and beforeDonate/afterDonate selectors exist in the dispatcher but their use cannot be confirmed from the decoded input.
Security & trust assessment
Risk level: high, estimated (decoded bytecode, medium confidence).
Who controls it: The deployer key can change the factory and register pools, and may be able to set per-pool taxes up to the cap, which would redirect value from swappers to the hook.
Risk to user funds: The hook can take a tax from swap amounts through return deltas and can move currency via the pool manager, so user swap proceeds are exposed to the configured tax rate.
Security findings
- [high] Owner-set swap tax: Swap callbacks take a configurable tax in basis points using return deltas, so an administrator can raise the tax on a pool up to the MAX_TAX_BPS cap and extract value from swappers.
- [medium] Return-delta currency movement: The hook calls take through the pool manager during swap callbacks, so it moves pool currency and can affect the amounts users receive.
- [medium] Privileged deployer role: NotDeployer gates factory changes and pool registration, so a single key controls which pools are configured.
- [low] Liquidity callbacks unclear: Liquidity hook selectors are present but their behaviour cannot be verified from decoded bytecode, which limits assurance about LP funds.
Contract details
- Verified source
- No
- Bytecode size
- 5,189 bytes
- Upgradeable proxy
- No
- Detected patterns
- moves-currency, return-delta, self-unlock, tax
Pools using Dynamic fee hook
- ETH / AC (1.00% fee) — 24h volume $1.30K, TVL $0.05, 5 swaps today