KeelHook
BaseKeelHook is a Uniswap v4 hook on Base. Live for 2 days. Still in use: 33 trades in the last week, and 1 new pool this week.
- Contract name
- KeelHook
How this hook works
Buyback and burnA buyback and burn hook. It takes a tax on trades, charges more right after launch and buys back the token.
Takes a tax on trades
On top of the normal pool fee, it keeps part of each trade as a tax. The tax can be changed. The tax builds up in the hook until it is collected.
The code that does this (beforeSwap):function beforeSwap(address, PoolKey calldata key, SwapParams calldata params, bytes calldata) external onlyPoolManager returns (bytes4, BeforeSwapDelta, uint24) { int128 fee = _beforeSwapFee(key.toId(), params.zeroForOne, params.amountSpecified); return (IHooks.beforeSwap.selector, toBeforeSwapDelta(fee, 0), 0); }Higher at launch
The tax starts higher right after launch and comes down over time, which makes it costly for bots to buy first.
The code that does this (chargeBps):function _chargeBps(PoolId id, bool isBuy) private view returns (uint256 totalBps, uint256 taxBps, uint256 snipeBps) { PoolRecord storage r = _pools[id]; uint256 snipe; if (isBuy) { if (_tload(T_CREATOR_BUY, id) == 1) { snipe = 0; // the one exempt buy; the cap is checked in afterSwap } else { snipe = KeelSnipe.snipeBps( SnipeTerms({startBps: r.snipeStartBps, window: r.snipeWindow, launchAt: r.launchAt}), block.timestamp ); } } (totalBps, taxBps, snipeBps) = KeelFeeMath.chargeBps(_params.feeBps, r.tax, snipe, isBuy, block.timestamp); }Buys back the token
It uses what it collects to buy the token back.
The code that does this (venueBuybackSwap):function _venueBuybackSwap(bytes memory keyData, uint256 amountIn, uint160 limit) internal override returns (uint256 spent, uint256 bought) { PoolKey memory key = abi.decode(keyData, (PoolKey)); BalanceDelta d = poolManager.swap( key, // forge-lint: disable-next-line(unsafe-typecast) SwapParams({zeroForOne: true, amountSpecified: -int256(amountIn), sqrtPriceLimitX96: limit}), "" ); spent = _positive(-d.amount0()); bought = _positive(d.amount1()); if (spent != 0) poolManager.burn(address(this), NATIVE_ID, spent); if (bought != 0) poolManager.take(key.currency1, address(this), bought); }Burns tokens
It destroys some tokens (or sends them to an address nobody controls), so there are fewer of them.
The code that does this (buyback):function _buyback(PoolId id, bytes memory key, uint256 maxIn, uint256 minOut) internal returns (uint256 spent, uint256 burned) { PoolRecord storage r = _pools[id]; if (r.token == address(0)) revert PoolNotRegistered(); if (!r.initialized) revert PoolNotInitialized(); uint256 accrued = buybackAccrued[id]; if (accrued == 0) revert NothingToPay(); uint256 last = lastBuybackAt[id]; // A block producer can shift the timestamp by seconds at most; the interval only limits how often // a buyback runs (sandwich frequency, B1), it guards no funds. // forge-lint: disable-next-line(block-timestamp) if (last != 0 && block.timestamp < last + KeelConstants.BUYBACK_INTERVAL) { revert BuybackTooSoon(last + KeelConstants.BUYBACK_INTERVAL); } lastBuybackAt[id] = block.timestamp; uint256 amountIn = accrued > uint256(uint128(type(int128).max)) ? uint256(uint128(type(int128).max)) : accrued; (uint160 sqrtP,) = _venuePriceAndTick(id); bytes memory res = _venueLock(abi.encode(ACTION_BUYBACK, key, amountIn, _buybackLimit(sqrtP))); (spent, burned) = abi.decode(res, (uint256, uint256)); if (spent > maxIn) revert BuybackAboveMax(spent, maxIn); if (burned == 0 || burned < minOut) revert BuybackBelowMin(burned, minOut); buybackAccrued[id] = accrued - spent; IKeelToken(r.token).burn(burned); emit KeelBuybackBurn(r.token, spent, burned); }Rewards to claim
It keeps track of what people have earned, and they claim it themselves.
The code that does this (transferClaimable):function transferClaimable(address to, uint256 amount) external { if (to == address(0)) revert ZeroAddress(); uint256 bal = claimable[msg.sender]; if (amount > bal) revert InsufficientClaimable(bal, amount); claimable[msg.sender] = bal - amount; claimable[to] += amount; emit KeelClaimTransferred(msg.sender, to, amount); }Only approved callers create pools
New pools with this hook can only be created by approved callers, for example its own factory or launcher.
The code that does this (beforeInitialize):function beforeInitialize(address sender, PoolKey calldata key, uint160) external onlyPoolManager returns (bytes4) { _initializeGuard(sender, key.toId()); return IHooks.beforeInitialize.selector; }Anyone can trigger payouts
Anyone can trigger a buyback and pay out what it has collected, so nobody has to wait on the hook developer.
The code that does this (buyback):function _buyback(PoolId id, bytes memory key, uint256 maxIn, uint256 minOut) internal returns (uint256 spent, uint256 burned) { PoolRecord storage r = _pools[id]; if (r.token == address(0)) revert PoolNotRegistered(); if (!r.initialized) revert PoolNotInitialized(); uint256 accrued = buybackAccrued[id]; if (accrued == 0) revert NothingToPay(); uint256 last = lastBuybackAt[id]; // A block producer can shift the timestamp by seconds at most; the interval only limits how often // a buyback runs (sandwich frequency, B1), it guards no funds. // forge-lint: disable-next-line(block-timestamp) if (last != 0 && block.timestamp < last + KeelConstants.BUYBACK_INTERVAL) { revert BuybackTooSoon(last + KeelConstants.BUYBACK_INTERVAL); } lastBuybackAt[id] = block.timestamp; uint256 amountIn = accrued > uint256(uint128(type(int128).max)) ? uint256(uint128(type(int128).max)) : accrued; (uint160 sqrtP,) = _venuePriceAndTick(id); bytes memory res = _venueLock(abi.encode(ACTION_BUYBACK, key, amountIn, _buybackLimit(sqrtP))); (spent, burned) = abi.decode(res, (uint256, uint256)); if (spent > maxIn) revert BuybackAboveMax(spent, maxIn); if (burned == 0 || burned < minOut) revert BuybackBelowMin(burned, minOut); buybackAccrued[id] = accrued - spent; IKeelToken(r.token).burn(burned); emit KeelBuybackBurn(r.token, spent, burned); }
Who controls it: The hook developer can change the fee and the tax. The hook developer can also call: lower snipe terms, schedule, cancel. The pool creator can change the wallets that receive its fees and the tax. Control can be passed on but not given up. The code cannot be changed.
Based on the hook’s published code.What do these labels mean?
Safety report
Before you build on it. Automated checks, not an auditlowerTax lowerFeeBpslowerTaxlowerTaxProtocolBpsWhat 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
Across all its pools, the hook took its fee from a trade: $1.10.
- Took its fee from a trade 33 times, worth $1.10
Latest transactions
- 0x69017a34…b4a97a block 61,550,633
- 0xd519e675…d71895 block 61,544,183
- 0xeb5ad7ac…eec5fa block 61,108,730
- 0x3dfde2f4…ccd122 block 61,108,699
- 0x1e698530…09fbb5 block 60,463,041
- 0x99ff6f76…80ab28 block 60,463,027
- 0xe2e89c8c…391e2a block 60,462,768
- 0xcfa23da0…66d0f4 block 60,462,755
- 0xcabf1274…2c1ad2 block 60,462,565
- 0x373ec1bc…142c03 block 60,462,552
- Transferred the keel claim 49 times
Latest transactions
- 0x69017a34…b4a97a block 61,550,633
- 0xd519e675…d71895 block 61,544,183
- 0xeb5ad7ac…eec5fa block 61,108,730
- 0x3dfde2f4…ccd122 block 61,108,699
- 0x1e698530…09fbb5 block 60,463,041 · 3 times in this transaction
- 0x99ff6f76…80ab28 block 60,463,027
- Keel trade 33 times
Latest transactions
- 0x69017a34…b4a97a block 61,550,633 · 239.7k MEM
- 0xd519e675…d71895 block 61,544,183 · 477.3k MEM
- 0xeb5ad7ac…eec5fa block 61,108,730 · 471.9k MEM
- 0x3dfde2f4…ccd122 block 61,108,699 · 471.9k MEM
- 0x1e698530…09fbb5 block 60,463,041 · 971.2k MEM
- 0x99ff6f76…80ab28 block 60,463,027 · 971.2k MEM
- 0xe2e89c8c…391e2a block 60,462,768 · 971.2k MEM
- 0xcfa23da0…66d0f4 block 60,462,755 · 971.2k MEM
- 0xcabf1274…2c1ad2 block 60,462,565 · 1.21M MEM
- 0x373ec1bc…142c03 block 60,462,552 · 1.21M MEM
- Returned the keel remainder 25 times
Latest transactions
- 0x69017a34…b4a97a block 61,550,633
- 0xd519e675…d71895 block 61,544,183
- 0xeb5ad7ac…eec5fa block 61,108,730
- 0x3dfde2f4…ccd122 block 61,108,699
- 0x584fbce4…b72750 block 60,453,780
- 0x00fd89a5…d8c4d3 block 60,437,975
- 0x59a59d21…036171 block 60,437,957
- 0xf6feee4d…fecae7 block 60,436,570
- 0xe36f953f…a80355 block 60,436,553
- 0x3117ce66…382f65 block 60,436,538
- Registered a keel pool 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. Dollar values count the amounts paid in ETH, stablecoins, BNB and BTC, at today’s prices.