Fee sharing hook on Ethereum
Uniswap v4 Hook Contract 0x40d9d76bb2498d1717bc161bf318952861aaa044 on Ethereum · Fee sharing
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $0
- Pools using this hook
- 1
- Swaps (24h)
- 93 (52 traders)
- Total swaps
- 93
What it does
This hook takes a fee from the output of swaps on its pools, with the rate set by owner-adjustable parameters, so every trader pays the hook fee while liquidity providers are not directly charged by it.
How it works step by step
- Takes a share of the swap output as a hook fee through afterSwap return deltas and sends it to a fee recipient balance
- Records fee parameters in storage at pool initialization via beforeInitialize
- Lets the owner update two uint16 fee parameters (selector 0xfaed84a4) that the afterSwap path reads
- Accumulates collected fees in a uint256 balance that can be withdrawn by the fee recipient or owner via withdrawnFees
- Uses an Ownable two-step ownership pattern (transferOwnership, acceptOwnership, renounceOwnership)
- Swap behaviour
- After each swap the hook reads two uint16 parameters from storage, computes a fee amount, and returns it as an afterSwap return delta that takes currency from the swapper's output. Trades are charged the hook fee on output; the exact rate depends on the stored uint16 parameters, which could not be decoded to concrete values.
- Liquidity behaviour
- No liquidity callbacks.
- Fee behaviour
- Hook fee is taken from swap output via afterSwapReturnDelta and accumulated in the hook; the fee recipient address can be changed by the owner through setFeeRecipient and fees are withdrawn via withdrawnFees. The pool's dynamic-fee flag is set at initialization, but the fee calculation itself is not fully decoded.
- Owner & admin controls
- Owner can set the fee recipient, change the two uint16 fee parameters via the 0xfaed84a4 setter, withdraw accumulated fees, initialize pools, and transfer or renounce ownership through a two-step handover.
Enabled Uniswap v4 callbacks
beforeInitialize, afterSwap, afterSwapReturnDelta
beforeInitialize is used to set up per-pool fee configuration when the pool is initialized. afterSwap is used to compute and record the hook fee after each swap. afterSwapReturnDelta lets the hook take a portion of the swap output as its fee, so it moves user-facing currency.
Security & trust assessment
Risk level: medium, estimated (decoded bytecode, medium confidence).
Who controls it: A single owner key can change the hook fee parameters and fee recipient and can withdraw accumulated fees, which could shift value toward the owner on pools using this hook.
Risk to user funds: The hook can hold accumulated fee balances and takes a portion of swap output via return deltas. It does not appear to block swaps, but a misconfigured fee could reduce user output.
Security findings
- [medium] Owner-tunable fee parameters: The owner can change two uint16 values that feed the afterSwap fee computation, so the hook fee on user swaps can be raised by the owner without users consenting. Bounds on these values could not be verified from bytecode alone.
- [medium] Return delta takes currency from swaps: afterSwapReturnDelta allows the hook to take part of the swap output, so the hook moves user currency on every swap and a faulty fee calculation could reduce user proceeds.
- [info] Unverified source: No verified source is available, so function names, bounds checks and reentrancy protections are inferred from selectors and storage access only.
Contract details
- Verified source
- No
- Bytecode size
- 6,196 bytes
- Upgradeable proxy
- No
- Detected patterns
- dynamic-fee, erc20, fee-sharing, moves-currency, ownable, return-delta
Pools using Fee sharing hook
- ETH / M471 (0.30% fee) — 24h volume $0, TVL $0, 0 swaps today