UniswapV4SwapFeeHookV1 on Base

Uniswap v4 Hook Contract 0x1efa69bdabe1c0281771b3439d7b6f5b3b4c40cc on Base · Dynamic fee · Verified contract

Volume (24h)
$0
Value locked (TVL)
$0
All-time volume
$0
Pools using this hook
2
Swaps (24h)
0 (0 traders)
Total swaps
23,437

What it does

Charges a configurable buy and sell fee on swaps involving one designated fee token and forwards the collected fees to a fee recipient contract.

How it works step by step

  • Designates a fee token and a fee recipient contract via FeeConfig, with separate buy and sell fee bps
  • Charges buy fees when the fee token is spent and sell fees when the fee token is received
  • Takes the fee from the PoolManager with take() and calls FeeCollector.submitFee to account for it
  • Uses beforeSwap for exact-out sells and exact-in buys, and afterSwap for exact-in sells and exact-out buys
  • Grants the fee recipient unlimited allowance over the fee token on configuration
  • Gates configuration behind ROLE_FEE_MANAGER and feature flags behind an access-manager RBAC
Swap behaviour
On swaps where the fee token is the input or output, beforeSwap or afterSwap takes the fee from the pool and returns a delta reducing the swapper's amount. Fees are computed in basis points and rounded down.
Liquidity behaviour
No liquidity callbacks.
Fee behaviour
Charges a configurable fee (buy and sell schedules, each capped below 50%, default 0.5%) denominated in a designated fee token. Buy fees (fee token spent) are taken in beforeSwap for exact-in and afterSwap for exact-out; sell fees (fee token received) are taken in beforeSwap for exact-out and afterSwap for exact-in. Fees are taken from the pool via poolManager.take and forwarded to an external FeeCollector via submitFee. LP fee override is always zero.
Owner & admin controls
Owner (full privileges) and holders of ROLE_ACCESS_MANAGER can grant or revoke roles and toggle features via updateRole and updateFeatures. ROLE_FEE_MANAGER holders can call updateFeeConfiguration (change fee token, fee recipient, buy and sell fee bps up to just under 50%) and deleteFeeConfiguration. Features flags enable or disable buy fee, sell fee, beforeSwap and afterSwap logic. No upgrade proxy or pause function found; contract is non-upgradeable.

Enabled Uniswap v4 callbacks

beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeSwap: charges fees on swaps where the fee token is known up front and returns a BeforeSwapDelta. afterSwap: charges fees once the actual swap amounts are known and returns an int128 delta. beforeSwapReturnDelta and afterSwapReturnDelta: allow the hook to adjust the swapper's specified or unspecified amounts, taking fee tokens from the pool.

Security & trust assessment

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

Who controls it: A ROLE_FEE_MANAGER holder can set buy and sell fees up to just under 50% on any swap involving the fee token and redirect fees to any recipient contract. An access manager can grant themselves or others fee manager roles and toggle fee features, so a compromised owner key could extract large fees from swappers.

Risk to user funds: The hook takes fee-token amounts from the pool via poolManager.take during swaps and holds them transiently before forwarding to the recipient. Swappers in pools containing the fee token pay the configured fee, and the hook can return deltas that change the amounts users receive or pay. It does not hold persistent user liquidity.

Security findings

  • [medium] Admin can raise fees to near 50%: updateFeeConfiguration allows buy and sell fees up to 4999 bps (~50%) with no timelock or per-swap cap, so a privileged key can impose heavy fees on swappers instantly.
  • [medium] Unlimited approval granted to fee recipient: updateFeeConfiguration can point the fee recipient to any contract, and the hook gives that contract an unlimited ERC20 approval over the fee token; a malicious or compromised recipient could drain all fee-token balances held by the recipient allowance path.
  • [low] External fee collector can block swaps: The hook takes fee tokens from the PoolManager via take() and calls the external submitFee; a reverting or malicious FeeCollector would block affected swaps for the pool.
  • [info] Rounding and gross-up logic: Swap-path arithmetic rounds fees down and uses (10000 - sellFeeBps) gross-up for exact-out sells; the logic is consistent with the documented design and no direct loss path was identified.
  • [info] Fee applies to any pool with the fee token: Fee token is resolved by checking currency0 first and falling back to currency1, so any pool containing a configured fee token is affected by the hook's fees.

Contract details

Verified source
Yes (UniswapV4SwapFeeHookV1)
Compiler
solc 0.8.26+commit.8a97fa7a
Bytecode size
7,811 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, moves-currency, return-delta

Pools using UniswapV4SwapFeeHookV1