Fee sharing hook on Unichain
Uniswap v4 Hook Contract 0x3476b53425a786e57aa246839c1837a62fc21acc on Unichain · Fee sharing
- Volume (24h)
- $1.00
- Value locked (TVL)
- $206
- All-time volume
- $427
- Pools using this hook
- 2
- Swaps (24h)
- 2 (2 traders)
- Total swaps
- 787
What it does
A fee-sharing hook that takes a per-pool hook fee on swaps, accrues it, and lets the owner withdraw it, with pause and liquidity callbacks.
How it works step by step
- Stores a per-pool hook fee in parts per million, settable by the owner.
- Takes a fee from swaps through return-delta callbacks and records it as pending fees.
- Exposes pendingFees and hookFeePpm views for fee accounting.
- Gates liquidity additions and removals through before-liquidity callbacks.
- Lets the owner withdraw accumulated market shares per pool.
- Supports owner pause that can halt callbacks.
- Swap behaviour
- beforeSwap and afterSwap run on each swap; beforeSwapReturnDelta and afterSwapReturnDelta let the hook take a fee from swap amounts using the per-pool hook fee.
- Liquidity behaviour
- beforeAddLiquidity and beforeRemoveLiquidity callbacks are enabled; afterAddLiquidity and afterRemoveLiquidity selectors are present in the dispatcher. Reinvest-related constants (MIN_REINVEST_LIQUIDITY, REINVEST_COOLDOWN) suggest the hook may reinvest accrued fees as liquidity, but the exact logic cannot be confirmed from bytecode alone.
- Fee behaviour
- A per-pool hook fee in parts per million is stored in a mapping (slot 2) and set by the owner through setHookFeePpm. Fees are accrued as pending fees (slot 1 mapping, read by pendingFees) and can be withdrawn by the owner via withdrawMarketShares. The beforeSwap and afterSwap paths read the hook fee mapping, indicating a fee is taken from swap flows and recorded for later withdrawal.
- Owner & admin controls
- Owner (set via Ownable, slot 0) can pause and unpause the hook via pause(bool), set the hook fee per pool via setHookFeePpm(bytes32,uint24), withdraw accumulated market shares via withdrawMarketShares(bytes32,address,uint256), and transfer or renounce ownership. Owner can also reach pending fee state through these functions.
Enabled Uniswap v4 callbacks
afterInitialize, beforeAddLiquidity, beforeRemoveLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta
afterInitialize records pool setup; beforeAddLiquidity and beforeRemoveLiquidity gate or prepare liquidity changes; beforeSwap and afterSwap handle fee logic and accounting; beforeSwapReturnDelta and afterSwapReturnDelta allow the hook to take or give currency deltas during swaps, which is how it moves funds from swaps.
Security & trust assessment
Risk level: medium, estimated (decoded bytecode, low confidence).
Who controls it: The owner can pause the hook, change the hook fee per pool, withdraw accrued market shares, and transfer or renounce ownership. A malicious or compromised owner could raise fees and drain accumulated fee balances.
Risk to user funds: The hook can take and hold currency via return deltas and accrues fee balances that the owner can withdraw. It can pause swaps and liquidity operations. Funds are exposed to owner actions and to the hook's accounting logic, which is unverified.
Security findings
- [medium] Hook moves currency during swaps: Return-delta permissions let the hook take currency from swaps, and the bytecode includes take and settle calls, so the hook holds or routes user swap value.
- [medium] Owner-settable fee with unknown cap: setHookFeePpm is owner-controlled with no visible cap in the selector set; an owner can set the fee to a very high value, taxing swappers.
- [medium] Owner pause can block activity: pause(bool) lets the owner halt hook logic; when paused, callbacks that check the paused flag may revert and block swaps or liquidity actions.
- [medium] Owner can withdraw accrued shares: withdrawMarketShares lets the owner pull accumulated fee balances; recipient and amount limits cannot be verified without source.
- [info] Single-key ownership: Ownable with transferOwnership and renounceOwnership; the owner is a single key with no timelock visible.
Contract details
- Verified source
- No
- Bytecode size
- 11,804 bytes
- Upgradeable proxy
- No
- Detected patterns
- moves-currency, ownable, pausable, return-delta
Pools using Fee sharing hook
- WBTC / USDC (Dynamic fee) — 24h volume $1.00, TVL $206, 2 swaps today
- ETH / 0x2754…5af7 (Dynamic fee) — 24h volume $0, TVL $0, 0 swaps today