Fee sharing hook on Ink
Uniswap v4 Hook Contract 0xaa40c86d338f922547cacd0416143208925e20cc on Ink · Fee sharing
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $0
- Pools using this hook
- 3
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 0
What it does
This hook charges a fee on swaps in the pool that is routed to a registered fee recipient, so traders pay extra on top of the pool fee while the fee is taken from each swap.
How it works step by step
- Registers pools through registerPool, storing a per-pool fee recipient mapping in storage slot 2 and a per-pool stats mapping in slot 3
- Takes a fee in the swap path via beforeSwap and afterSwap, using take(address,address,uint256) to pull currency from the pool manager
- Uses beforeSwapReturnDelta and afterSwapReturnDelta, so the hook can alter the amounts settled for the swap
- Tracks per-pool statistics that can be read through stats(address)
- Exposes feeRecipient(address) and a constant FEE_BPS() to report the fee split
- Gates the registered pool and manager relationship through setFactory and setOperator, with operator() and poolManager() as read-only accessors
- Swap behaviour
- beforeSwap and afterSwap run on every swap; the hook takes a fee (FEE_BPS basis points) via return deltas and forwards it to the recipient registered for the pool, so swappers pay the hook fee on top of the pool fee.
- Liquidity behaviour
- No liquidity callbacks.
- Fee behaviour
- A hook fee of FEE_BPS basis points is taken on swaps through return deltas and routed to feeRecipient for the pool; the pool's own static fee is applied separately.
- Owner & admin controls
- setFactory and setOperator are nonpayable and appear to set privileged addresses in slots 0 and 1; the exact access checks cannot be confirmed from bytecode, so it is unclear whether they are restricted to a current owner or operator.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta
beforeInitialize validates or records pool setup; beforeSwap and afterSwap take the fee and update stats; beforeSwapReturnDelta and afterSwapReturnDelta let the hook settle currency amounts differently from the pool's amounts.
Security & trust assessment
Risk level: medium, estimated (decoded bytecode, low confidence).
Who controls it: The operator and factory addresses set via setOperator and setFactory may control pool registration and related state; if those keys are compromised, pools using this hook could be misconfigured.
Risk to user funds: The hook can take tokens from the pool manager through return deltas and take(), so user swap amounts are directly affected by the fee logic.
Security findings
- [medium] Return deltas move currency: beforeSwapReturnDelta and afterSwapReturnDelta combined with take() let the hook withdraw tokens from the pool manager on swaps, so swap settlement depends on hook logic.
- [medium] Privileged setters: setFactory and setOperator write to storage slots 0 and 1 and are callable externally; if access is not restricted, anyone could redirect pool registration or fee routing.
- [low] Fee recipient is set per pool: registerPool writes the feeRecipient mapping, so the destination of the hook fee is determined at registration and may be changeable depending on the factory logic.
- [info] Bytecode only, no source: Behaviour is inferred from decoded selectors and storage access; access controls and arithmetic were not verified against source.
Contract details
- Verified source
- No
- Bytecode size
- 3,327 bytes
- Upgradeable proxy
- No
- Detected patterns
- fee-sharing, moves-currency, return-delta
Pools using Fee sharing hook
- ETH / IDENTITY (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / INKID (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / TEST (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today