PumperTaxHook
BasePumperTaxHook is a Uniswap v4 hook on Base. Runs code on every swap. Can take tokens from swaps. Sets its own swap fee.
- Contract name
- PumperTaxHook
How this hook works
Trading taxA trading tax hook. It sets its own trading fee and takes a tax on trades.
Sets its own trading fee
Instead of a fixed fee chosen by the pool creator, it decides the fee itself on each trade.
The code that does this (beforeSwap):function beforeSwap(address, PoolKey calldata key, SwapParams calldata params, bytes calldata) external returns (bytes4, BeforeSwapDelta, uint24) { if (msg.sender != address(poolManager)) revert NotPoolManager(); if (params.amountSpecified > 0) revert ExactOutputNotSupported(); bool isBuy = _isBuy(key, params); if (!isBuy) { return (this.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, LPFeeLibrary.OVERRIDE_FEE_FLAG); } uint256 gross = uint256(-params.amountSpecified); (uint256 fee,) = PumperFeeMath.quoteFeeFromGross(gross, uint256(buyTaxBps + BASE_FEE_BPS) * 100); BeforeSwapDelta delta = toBeforeSwapDelta(int128(int256(fee)), 0); return (this.beforeSwap.selector, delta, LPFeeLibrary.OVERRIDE_FEE_FLAG); }Takes a tax on trades
On top of the normal pool fee, it keeps part of each trade as a tax. Buys and sells can be taxed differently.
The code that does this (beforeSwap):function beforeSwap(address, PoolKey calldata key, SwapParams calldata params, bytes calldata) external returns (bytes4, BeforeSwapDelta, uint24) { if (msg.sender != address(poolManager)) revert NotPoolManager(); if (params.amountSpecified > 0) revert ExactOutputNotSupported(); bool isBuy = _isBuy(key, params); if (!isBuy) { return (this.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, LPFeeLibrary.OVERRIDE_FEE_FLAG); } uint256 gross = uint256(-params.amountSpecified); (uint256 fee,) = PumperFeeMath.quoteFeeFromGross(gross, uint256(buyTaxBps + BASE_FEE_BPS) * 100); BeforeSwapDelta delta = toBeforeSwapDelta(int128(int256(fee)), 0); return (this.beforeSwap.selector, delta, LPFeeLibrary.OVERRIDE_FEE_FLAG); }
Who controls it: No admin functions: nobody can change its rules after deployment.
Based on the hook’s published code.
What it can do
Its code executes inside each trade in pools that use it.
It can take or add tokens during a swap. Fees, burns and custom curves work this way, and so do scams.
Pools using it let the hook choose the swap fee instead of a fixed tier.
Hook history
- Took tax 1 time
Counted from what the hook recorded on-chain across all its pools, for every action in its published code, plus token transfers in and out of it.