Token hook on Ethereum

Uniswap v4 Hook Contract 0x4054c6458a37cae06fd8918ab71cc832f99b60cc on Ethereum · Token

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

What it does

This hook charges a fixed buy tax and sell tax on swaps, sending the collected amount to a tax wallet, and it blocks trading until the owner enables it, while liquidity actions pass through untaxed.

How it works step by step

  • Hook is initialized through beforeInitialize, which records the pool id and marks the hook as initialized, and it is restricted to the deployer
  • Trading is gated by a tradingEnabled flag that the owner turns on once via enableTrading, which also records the enable timestamp
  • beforeSwap and afterSwap read the trading flag and the pool configuration, and the hook uses return deltas to take a buy tax and a sell tax denominated in basis points (BUY_TAX_BPS and SELL_TAX_BPS)
  • Collected tax is sent to a tax wallet using take on the pool manager, and the tax wallet address can be changed by the owner through setTaxWallet
  • Liquidity add and remove and donate callbacks are present in the dispatch table but appear to be pass-through checks rather than custom liquidity logic
  • Ownership is managed with transferOwnership and renounceOwnership, and the token address is exposed through a getter
Swap behaviour
beforeSwap and afterSwap both run and use return deltas to take a tax on swaps; swaps are blocked before trading is enabled, and the tax direction is split into buy and sell rates set by the constants BUY_TAX_BPS and SELL_TAX_BPS, with the exact direction-to-rate mapping inferred from the bytecode rather than verified.
Liquidity behaviour
beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity are present as dispatched selectors with no evident custom accounting, so liquidity operations appear to pass through without tax.
Fee behaviour
Uses the pool's static fee for the LP fee; the hook layers a separate tax in basis points on swaps, taken through return deltas and sent to the tax wallet, with buy and sell rates set by BUY_TAX_BPS and SELL_TAX_BPS.
Owner & admin controls
The owner can enable trading once with enableTrading, change the tax wallet with setTaxWallet, and transfer or renounce ownership; the tax rates are constants, so they cannot be changed after deployment.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize restricts pool setup and records the pool id; beforeSwap applies the trading gate and tax calculation via return delta; afterSwap settles the tax delta via return delta and moves currency to the tax wallet; the liquidity and donate callbacks appear to be pass-through and are enabled only through their selectors.

Security & trust assessment

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

Who controls it: A single owner key can enable trading, redirect the tax wallet to any address, and transfer or renounce ownership; the tax rates themselves are fixed constants.

Risk to user funds: The hook can take a fixed percentage of swap amounts through return deltas and send it to the tax wallet, and it can block swaps entirely before trading is enabled, but it does not appear to hold or lock LP principal.

Security findings

  • [medium] Hook takes tokens via return deltas: beforeSwapReturnDelta and afterSwapReturnDelta let the hook take a share of each swap, and the take call moves currency to the tax wallet, so every swap in the pool pays the tax.
  • [medium] Owner controls the tax recipient: setTaxWallet is callable by the owner and redirects all collected tax to a new address with no timelock visible in the bytecode.
  • [low] Trading can be blocked until owner enables it: Swaps revert with TradingNotOpen until enableTrading is called, so the owner controls whether the pool is tradable at launch.
  • [info] Ownership can be renounced: renounceOwnership and transferOwnership are present, so the owner key can be removed or moved, which affects who can change the tax wallet.

Contract details

Verified source
No
Bytecode size
4,197 bytes
Upgradeable proxy
No
Detected patterns
moves-currency, ownable, return-delta, tax

Pools using Token hook