Dynamic fee hook on Base

Uniswap v4 Hook Contract 0x1041c61c34e2aa9f741c08ed76c052105bb60088 on Base · Dynamic fee

Volume (24h)
$0
Value locked (TVL)
$32
All-time volume
$0.02
Pools using this hook
50
Swaps (24h)
0 (0 traders)
Total swaps
41

What it does

A dynamic-fee hook for Uniswap v4 pools that sets swap fees through an owner or executor-controlled configuration and can take a share of swap value via return deltas, with an observable backend price validation step during swaps.

This read was written for the hook 0x72da…0088 on Ink 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

  • Implements beforeSwap and returns a fee override and a return delta, so the hook can adjust the effective swap amount and fee per swap
  • Stores per-pool configuration (fee, enabled flag) keyed by pool identifiers, with setters for enabling pools and changing the pool fee
  • Calls an external backend-price validation routine (validatePool / backendSqrtPriceX96) referenced in the bytecode, suggesting swaps are checked against an off-chain reference price
  • Can move tokens through external calls such as transfer, approve, take and settle, which are used to settle the hook's own currency deltas
  • Exposes a withdrawToken function that lets an authorized address move tokens held by the hook out to a recipient
  • Has beforeAddLiquidity, beforeRemoveLiquidity and related callbacks present as selectors, but their permissions are not enabled in the address flags
Swap behaviour
beforeSwap is called on every swap; it can apply a dynamic fee and, through beforeSwapReturnDelta, take or give back a currency amount, so the effective amounts a trader receives may differ from the pool's plain constant-product result.
Liquidity behaviour
No liquidity callbacks are enabled by the address permissions. The liquidity-related selectors in the bytecode are present in the dispatch table but are not active for this hook.
Fee behaviour
The hook sets or overrides the LP fee dynamically through setPoolFee and related fee updates, bounded by MAX_LP_FEE and MAX_HOOK_FEE_BPS constants, and may take a hook fee in basis points from the swap.
Owner & admin controls
An owner address (owner()) and an executor address (executor()) exist. The owner or privileged caller can enable or disable pools (setPoolEnabled), change pool fees (setPoolFee), withdraw hook-held tokens (withdrawToken) and possibly update the backend reference used for price validation. The exact access checks cannot be confirmed without source.

Enabled Uniswap v4 callbacks

beforeSwap, beforeSwapReturnDelta

beforeSwap: runs the dynamic fee logic and any backend price check before each swap. beforeSwapReturnDelta: allows the hook to return a delta that changes the amounts settled for the swap, which is how it takes or shares value from swaps.

Security & trust assessment

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

Who controls it: The owner and executor roles can change pool fees, enable or disable pools, withdraw hook-held tokens and influence the backend price reference. Users depend on these keys acting honestly.

Risk to user funds: The hook can hold tokens from swap settlement and can move them through withdrawToken and take/settle calls. It can also alter the amounts settled in each swap via return deltas, so it does have direct exposure to user and pool value.

Security findings

  • [high] Privileged token withdrawal: withdrawToken(address,address,uint256) moves tokens the hook holds. If the caller check is weak or the owner key is compromised, accumulated fees or pool-related balances could be drained.
  • [medium] Owner-controlled fee and pool enablement: setPoolFee and setPoolEnabled let a privileged key change the fee charged to swappers or disable a pool. Bounds on fee values rely on MAX_LP_FEE and MAX_HOOK_FEE_BPS constants that cannot be verified without source.
  • [medium] Return-delta value extraction: beforeSwapReturnDelta lets the hook take currency from swaps. The amount taken is determined by logic that cannot be inspected in decoded bytecode, so it is unclear how much of swap value is retained and by whom.
  • [medium] Off-chain price dependency: validatePool and backendSqrtPriceX96 indicate swaps depend on a backend-supplied reference price. If that backend is compromised or stale, swaps may be blocked or priced unfairly.
  • [info] Unverified source: No verified source is available, so function behaviour is inferred from selectors, storage reads and writes, and external call patterns only.

Contract details

Verified source
No
Bytecode size
13,698 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, moves-currency, return-delta

Pools using Dynamic fee hook