SweepHook
EthereumSweepHook is a Uniswap v4 hook on Ethereum. Runs code on every swap. Can take tokens from swaps. Runs at pool creation.
- Contract name
- SweepHook
How this hook works
Trading taxA trading tax hook. It takes a cut of every trade, keeps rewards to claim and only works with its own launcher.
Takes a cut of every trade
On top of the normal pool fee, it keeps a share of every trade for itself.
The code that does this (beforeSwap):function beforeSwap(address, PoolKey calldata key, SwapParams calldata params, bytes calldata) external onlyPoolManager returns (bytes4, BeforeSwapDelta, uint24) { PoolId id = key.toId(); PoolInfo storage info = pools[id]; if (!info.registered) revert PoolNotRegistered(); bool specifiedIsZero = (params.amountSpecified < 0) == params.zeroForOne; if (!specifiedIsZero) return (IHooks.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, 0); uint256 base = params.amountSpecified < 0 ? uint256(-params.amountSpecified) : uint256(params.amountSpecified); uint256 side = (base * info.feeBps) / BPS; if (side == 0) return (IHooks.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, 0); uint256 total = side * 2; // exact-in: the swap proceeds with (input - fee); exact-out: the swap produces (output + fee) and we keep the fee poolManager.take(key.currency0, address(this), total); _credit(id, info, side); return (IHooks.beforeSwap.selector, toBeforeSwapDelta(int128(uint128(total)), 0), 0); }Rewards to claim
It keeps track of rewards to be claimed later.
Only its own launcher can use it
New pools with this hook can only be created by its own factory or launcher.
The code that does this (beforeInitialize):function beforeInitialize(address sender, PoolKey calldata key, uint160) external view onlyPoolManager returns (bytes4) { if (sender != factory) revert NotFactory(); if (!pools[key.toId()].registered) revert PoolNotRegistered(); return IHooks.beforeInitialize.selector; }Anyone can trigger payouts
Anyone can claim what they’re owed, so nobody has to wait on the hook developer.
The code that does this (claim):function claim() external returns (uint256 amount) { amount = pending[msg.sender]; if (amount == 0) return 0; pending[msg.sender] = 0; totalPending -= amount; _payEth(msg.sender, amount); emit FeesClaimed(msg.sender, amount); }
Who controls it: The code itself can’t be changed. The hook developer can change: factory, treasury, rescue excess.
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.
It runs when a pool is created, often to lock in that pool’s settings.
Hook history
- Collected fees 93 times
Latest transactions
- 0x64973e89…d2f8a2 block 26,379,231
- 0xf845bb47…f6dfb9 block 26,379,230
- 0x164b34f8…3d1aeb block 26,379,230
- 0x91de1883…f8bab9 block 26,379,230
- 0xdc377ba8…d3fcf8 block 26,379,230
- 0xfc0ea4ae…cad004 block 26,379,227
- 0x15536e30…0f0658 block 26,379,225
- 0xb26d5bcc…7c59eb block 26,379,225
- 0xa645dcfb…f3f192 block 26,379,225
- 0x94608fde…f9971c block 26,379,225
- Claimed fees 16 times
Latest transactions
- 0xcb0129cd…7c73a9 block 26,379,265
- 0xa0be6c62…f0a599 block 26,379,229
- 0x9e8639fe…5737c3 block 26,379,223
- 0xe0d0e7c8…ca7e90 block 26,379,217
- 0x412705ec…52fb16 block 26,379,208
- 0x3156fd64…fe7769 block 26,379,177
- 0x4b568dde…2e305d block 26,379,171
- 0x49155d66…dcf42f block 26,379,150
- 0xd4b8afde…0c9adb block 26,379,149
- 0x7ea274a9…d1352a block 26,379,140
- Registered pool 2 times
Latest transactions
- 0x30a8725c…31a41b block 26,379,133
- 0xc3ad5c86…cda27a block 26,379,088
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.