Fee sharing hook on Ink
Uniswap v4 Hook Contract 0xa8241ea4288265791eac802212c8fe69d86f20cc on Ink · Fee sharing
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $0
- Pools using this hook
- 5
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 0
What it does
This hook takes a fixed basis-point fee from swaps in pools it manages and sends it to a registered fee recipient, so traders on those pools pay the extra fee and liquidity providers are not affected by it.
How it works step by step
- Registers pools through registerPool, storing a fee recipient address per pool in a mapping keyed by address
- Initializes pool state via beforeInitialize and afterInitialize callbacks
- On beforeSwap, reads a per-pool accumulated amount and can take currency from the pool using the PoolManager take call
- On afterSwap, updates a per-pool uint128 counter and can return a delta, so the hook can take a share of swap output
- Exposes stats(address) and feeRecipient(address) views, and FEE_BPS, indicating a fixed basis-point fee split
- Gates callers through stored operator and factory addresses set by setOperator and setFactory
- Swap behaviour
- beforeSwap and afterSwap run on every swap; the hook uses return deltas and a take call to skim a basis-point fee from swap flows and route it to the pool's fee recipient. Trades pay the hook fee on top of the pool fee; the exact direction and token depend on the unverified logic.
- Liquidity behaviour
- Before and after add and remove liquidity callbacks exist as view functions; they appear to be pass-through checks without state changes. Donate callbacks are also view-only.
- Fee behaviour
- A fixed FEE_BPS is taken from swaps and credited to a per-pool fee recipient stored in the feeRecipient mapping; the hook fee is extracted via return deltas.
- Owner & admin controls
- setOperator and setFactory are callable without a visible access check in the decoded bytecode, which must be confirmed; the operator and factory addresses gate pool registration. No pause or upgrade function was identified.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta
beforeInitialize and afterInitialize record pool setup; beforeSwap and afterSwap run fee accounting; beforeSwapReturnDelta and afterSwapReturnDelta allow the hook to take currency from swaps.
Security & trust assessment
Risk level: high, estimated (decoded bytecode, low confidence).
Who controls it: The operator and factory keys can register pools and influence fee recipients; if setter access control is absent, a single caller could take control of fee routing for all pools.
Risk to user funds: The hook can take currency from swaps via return deltas and transfer it to fee recipients, so swappers and pool reserves are exposed to whatever fee logic is in place.
Security findings
- [medium] Return deltas take user swap value: beforeSwapReturnDelta and afterSwapReturnDelta let the hook alter the amounts swapped, and the take selector moves currency out of the pool to the fee path.
- [high] Setters may lack access control: setOperator and setFactory are nonpayable with no visible owner check in the decoded bytecode; if unguarded, anyone could replace the operator or factory and redirect registration or fees.
- [medium] Fee recipient set at registration: registerPool writes the per-pool fee recipient; a malicious or compromised registrar could direct fees to an arbitrary address.
Contract details
- Verified source
- No
- Bytecode size
- 3,568 bytes
- Upgradeable proxy
- No
- Detected patterns
- fee-sharing, moves-currency, return-delta