Fee sharing hook on Ethereum
Uniswap v4 Hook Contract 0xf5122dc8bfb2cc91b5eba37a6eeeef86f4e8e0cc on Ethereum · Fee sharing
- Volume (24h)
- $1.98
- Value locked (TVL)
- $1.98
- All-time volume
- $1.98
- Pools using this hook
- 1
- Swaps (24h)
- 1 (1 traders)
- Total swaps
- 1
What it does
A fee-sharing hook that charges separate creator buy and sell fees on swaps and routes a share of fees through an extensible module system.
How it works step by step
- Applies creator buy and sell fee rates (creatorBuyFeeBps, creatorSellFeeBps) to swaps in each direction
- Computes gross and net fees through previewGrossFees and previewNetFees and tracks any rounding carry with feeCarry
- Uses beforeSwap and afterSwap to take fees by adjusting the swap delta via return-delta permissions
- Maintains an ordered list of modules (moduleCount, moduleAt, isModuleAction) that can be invoked through executeModuleAction
- Records pool and initialization metadata (poolKey, poolId, initialTick, compositionHash) at pool creation
- Swap behaviour
- beforeSwap and afterSwap run on every swap, computing fees on the swap amount and adjusting the balance delta through return-delta permissions, with creator buy and sell fee rates applied by direction.
- Liquidity behaviour
- beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity are present as selectors and may be used for accounting or gating, but their implementation cannot be determined from the input.
- Fee behaviour
- beforeSwap and afterSwap read two uint16 values per direction from slots 0 and a keyed storage area, and previewGrossFees, previewNetFees and feeCarry suggest the hook computes gross fees, nets them and carries a remainder. creatorBuyFeeBps and creatorSellFeeBps indicate a creator fee split applied on buys and sells respectively. Exact fee formulas cannot be confirmed.
- Owner & admin controls
- Storage slot 1 holds an address (likely an owner or admin) and a uint8 flag used in executeModuleAction and beforeSwap; the module list at slot 2 is managed through executeModuleAction and isModuleAction. Exact admin functions cannot be confirmed without source, so the precise privilege set is unknown.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta
beforeInitialize: runs a setup check when the pool is created, likely validating the pool key and initial tick. beforeSwap: computes fee and possibly a return delta on each swap. afterSwap: updates accounting and may return a delta after the swap. beforeSwapReturnDelta: lets the hook take or give tokens during a swap, so it can alter amounts. afterSwapReturnDelta: lets the hook adjust the post-swap delta, also affecting amounts settled.
Security & trust assessment
Risk level: high (decoded bytecode, low confidence).
Who controls it: A privileged key may be able to change module configuration through executeModuleAction, alter fee-related parameters, and control the module list. The exact power is not determined from the bytecode.
Risk to user funds: Because the hook can alter swap deltas and executes calls to registered modules, it can influence the tokens exchanged in swaps and potentially the fees collected. Liquidity callbacks are present but their effect on pool funds is unknown.
Security findings
- [high] Return-delta permissions allow the hook to modify swap settlement: The hook enables beforeSwapReturnDelta and afterSwapReturnDelta, so it can take or redirect tokens from swaps. Any bug in fee accounting or a malicious module could divert value from traders or LPs.
- [high] Arbitrary module execution: executeModuleAction(uint256,bytes) is nonpayable and dispatches arbitrary calldata to registered modules, with a ModuleFailure error for failures. A compromised or malicious module, or a module added by an admin, could affect pool state or funds.
- [medium] Admin-controlled module registry and configuration: The hook stores a module list (address[] at slot 2) and a single address and flag at slot 1. Changes to these values are controlled by privileged logic that cannot be verified without source.
- [info] Unverified source: Without verified source, the exact fee formula, access control checks and upgrade mechanisms cannot be confirmed, so the risk assessment is partly unverified.
Contract details
- Verified source
- No
- Bytecode size
- 10,028 bytes
- Upgradeable proxy
- No
- Detected patterns
- return-delta
Pools using Fee sharing hook
- WETH / KIRA (0.00% fee) — 24h volume $1.98, TVL $1.98, 1 swaps today