Fee sharing hook on Ink

Uniswap v4 Hook Contract 0xbfda1efa520d3aff7729b0ec461051f878e280cc on Ink · Fee sharing

Volume (24h)
$0
Value locked (TVL)
$0
All-time volume
$0
Pools using this hook
1
Swaps (24h)
0 (0 traders)
Total swaps
0

What it does

A Uniswap v4 hook that charges a buy or sell tax on swaps in the pool and accumulates it for a configured tax recipient to claim.

How it works step by step

  • Reads separate buy and sell tax rates in basis points from storage, bounded by MAX_TAX_BPS.
  • Applies the tax to swaps in beforeSwap via return delta and finalises accounting in afterSwap.
  • Accumulates taxed tokens as accrued fees, exposed through accruedFees().
  • Transfers accrued fees to taxRecipient through the permissionless claim() function.
  • Uses unlockCallback to settle currency movements with the pool manager.
Swap behaviour
beforeSwap and afterSwap run on every swap; the hook applies a directional buy or sell tax by taking a share of the swap amount through return deltas and records the accrued amount.
Liquidity behaviour
beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity selectors are present but the hook does not request liquidity permissions, so liquidity operations are passed through unchanged.
Fee behaviour
Charges directional tax on swaps via beforeSwap/afterSwap return deltas, with buy and sell tax rates read from storage and capped by MAX_TAX_BPS; accrued fees are tracked and collected to taxRecipient via claim().
Owner & admin controls
No owner or admin selectors found; getters for buyTaxBps, sellTaxBps, MAX_TAX_BPS, taxRecipient and token are exposed, but no setter selectors were decoded, so tax parameters appear fixed at deployment.

Enabled Uniswap v4 callbacks

beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeSwap: computes and applies the tax before the swap executes. afterSwap: finalises tax accounting after execution. beforeSwapReturnDelta: lets the hook take a share of the swap input or output as a return delta. afterSwapReturnDelta: lets the hook take a share of the post-swap amounts as a return delta.

Security & trust assessment

Risk level: medium (decoded bytecode, medium confidence).

Who controls it: Tax recipient address and tax rates are read from state; no setter was decoded, so the main privileged risk is limited to whatever the deployer configured at construction. Owner-level control could not be confirmed from the bytecode.

Risk to user funds: The hook can take a percentage of swap input or output via return deltas and accrue it in its own balance until claimed to taxRecipient. Users trading through the pool pay the tax; liquidity providers are not directly affected by the hook's liquidity callbacks.

Security findings

  • [medium] Hook redirects swap value: The hook takes swap tokens via before/after swap return deltas and moves currency through the pool manager (take and unlock selectors present), so it holds and redirects a portion of trader flow.
  • [low] Permissionless fee claim: claim() is callable by anyone and transfers accrued fees to taxRecipient; accounting relies on storage slot 0 which is read and written by several functions.
  • [medium] Self-unlock callback surface: unlockCallback is externally callable and the hook calls unlock on the pool manager itself (self-unlock), so correct access checks on the callback are important; this could not be verified without source.
  • [info] Unverified source: No verified source is available, so the exact tax math, rounding and access checks cannot be confirmed.

Contract details

Verified source
No
Bytecode size
5,332 bytes
Upgradeable proxy
No
Detected patterns
moves-currency, return-delta, self-unlock

Pools using Fee sharing hook