Fee sharing hook on Ethereum

Uniswap v4 Hook Contract 0x476013f9ebe04d09e69278a892b55bef143ba044 on Ethereum · Fee sharing

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

What it does

This hook takes an owner-set fee from each swap's output and sends it to a fee recipient, so every trader pays this extra fee on top of the pool fee, while liquidity providers are not charged by the hook itself.

How it works step by step

  • Enables a dynamic fee pool at initialization (beforeInitialize) and rejects pools that do not match the expected configuration.
  • After each swap (afterSwap) it takes a fee share from the swap output via a return delta and accrues it for a fee recipient.
  • Stores two fee parameters in one packed storage slot that the owner can update with setNewFees.
  • Lets the fee recipient be changed by the owner and lets the recipient or owner claim accrued fees with claimFees.
  • Uses an ownable two-step ownership pattern (transferOwnership, acceptOwnership, renounceOwnership) and a reentrancy guard around fee claims.
  • Provides a poolKey view and an initializePool entry point that initializes the pool through the pool manager.
Swap behaviour
After each swap the hook reads its packed fee parameters and, through afterSwapReturnDelta, takes a portion of the swap's output currency as its fee. Trades therefore pay the fee taken by the hook in addition to the pool fee; the exact split depends on the packed fee values, which are not directly readable from the decoded bytecode.
Liquidity behaviour
No liquidity callbacks.
Fee behaviour
The hook takes a fee via return delta in afterSwap, and the fee rate is set by the owner through setNewFees(uint16,uint16) and stored in a packed slot. Accrued fees are sent to feeRecipient and can be withdrawn through claimFees.
Owner & admin controls
The owner can set the two fee parameters with setNewFees, change the fee recipient with setFeeRecipient, transfer or renounce ownership, and call claimFees. Ownership changes use a two-step pending owner process.

Enabled Uniswap v4 callbacks

beforeInitialize, afterSwap, afterSwapReturnDelta

beforeInitialize validates or sets up the pool when it is created. afterSwap computes and takes the fee share from swap output. afterSwapReturnDelta allows the hook to take a return delta in the output currency during afterSwap.

Security & trust assessment

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

Who controls it: A single owner key controls fee rate, fee recipient, fee claims and ownership transfer, so a compromised key could raise fees or redirect accrued fees.

Risk to user funds: The hook can take a share of swap output through return deltas, but it does not appear to block swaps or hold user principal, so exposure is limited to the fee share.

Security findings

  • [medium] Owner-set fee rate: setNewFees(uint16,uint16) lets the owner change the fee parameters stored in the packed slot; the bounds enforced on these values could not be confirmed from decoded bytecode, so a high rate could extract a large share of swap output.
  • [medium] Return-delta fee capture: afterSwapReturnDelta lets the hook take tokens from swap output, so the hook holds a claim on user trade proceeds in the pool accounting.
  • [low] Fee recipient redirection: setFeeRecipient lets the owner redirect all accrued fees to a new address.
  • [info] Reentrancy-guarded claims: The presence of a ReentrancyGuard error selector suggests claimFees is protected against reentrancy.

Contract details

Verified source
No
Bytecode size
6,192 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, erc20, fee-sharing, moves-currency, ownable, return-delta

Pools using Fee sharing hook