TimberlineHook
BaseTimberlineHook is a Uniswap v4 hook on Base. Brand new: its first pool went live today. Busy: 823 trades in the last week, and 1 new pool this week.
- Contract name
- TimberlineHook
How this hook works
Trading taxA trading tax hook. It changes its fee over time, takes a cut of every trade and charges more right after launch.
Fee changes over time
Instead of a fixed fee, it sets the fee itself and changes it over time, for example starting high at launch and coming down.
The code that does this (beforeSwap):function beforeSwap(address, PoolKey calldata key, IPoolManager.SwapParams calldata params, bytes calldata) external override onlyPoolManager returns (bytes4, BeforeSwapDelta, uint24) { PoolId id = key.toId(); PoolConfig memory cfg = poolConfigs[id]; if (!cfg.initialized) revert PoolNotRegistered(); PoolRuntime storage rt = poolRuntimes[id]; (uint160 spotSqrtPriceX96,,,) = poolManager.getSlot0(id); if (cfg.proLvrEnabled && uint40(block.number) > rt.lastEmaBlock && rt.emaSqrtPriceX96 > 0) { uint256 weightedNew = uint256(spotSqrtPriceX96) * EMA_ALPHA_BPS; uint256 weightedOld = uint256(rt.emaSqrtPriceX96) * (BPS_DENOMINATOR - EMA_ALPHA_BPS); rt.emaSqrtPriceX96 = uint160((weightedNew + weightedOld) / BPS_DENOMINATOR); rt.lastEmaBlock = uint40(block.number); } (uint24 lpFeePips, uint24 hookFeePips) = _computeActiveFees(cfg, rt, spotSqrtPriceX96, params.zeroForOne); bool specifiedIsCurrency0 = (params.amountSpecified < 0) ? params.zeroForOne : !params.zeroForOne; bool quoteIsSpecified = (specifiedIsCurrency0 == cfg.quoteIsCurrency0); BeforeSwapDelta delta = BeforeSwapDeltaLibrary.ZERO_DELTA; if (quoteIsSpecified) { uint256 absSpecified = params.amountSpecified < 0 ? uint256(-params.amountSpecified) // …Takes a cut of every trade
On top of the normal pool fee, it keeps a share of each trade. It can never be above 2.5%. The fee builds up in the hook until it is collected.
The code that does this (beforeSwap):function beforeSwap(address, PoolKey calldata key, IPoolManager.SwapParams calldata params, bytes calldata) external override onlyPoolManager returns (bytes4, BeforeSwapDelta, uint24) { PoolId id = key.toId(); PoolConfig memory cfg = poolConfigs[id]; if (!cfg.initialized) revert PoolNotRegistered(); PoolRuntime storage rt = poolRuntimes[id]; (uint160 spotSqrtPriceX96,,,) = poolManager.getSlot0(id); if (cfg.proLvrEnabled && uint40(block.number) > rt.lastEmaBlock && rt.emaSqrtPriceX96 > 0) { uint256 weightedNew = uint256(spotSqrtPriceX96) * EMA_ALPHA_BPS; uint256 weightedOld = uint256(rt.emaSqrtPriceX96) * (BPS_DENOMINATOR - EMA_ALPHA_BPS); rt.emaSqrtPriceX96 = uint160((weightedNew + weightedOld) / BPS_DENOMINATOR); rt.lastEmaBlock = uint40(block.number); } (uint24 lpFeePips, uint24 hookFeePips) = _computeActiveFees(cfg, rt, spotSqrtPriceX96, params.zeroForOne); bool specifiedIsCurrency0 = (params.amountSpecified < 0) ? params.zeroForOne : !params.zeroForOne; bool quoteIsSpecified = (specifiedIsCurrency0 == cfg.quoteIsCurrency0); BeforeSwapDelta delta = BeforeSwapDeltaLibrary.ZERO_DELTA; if (quoteIsSpecified) { uint256 absSpecified = params.amountSpecified < 0 ? uint256(-params.amountSpecified) // …Higher at launch
The fee starts higher right after launch and comes down over time, which makes it costly for bots to buy first.
The code that does this (computeActiveFees):function _computeActiveFees( PoolConfig memory cfg, PoolRuntime storage rt, uint160 spotSqrtPriceX96, bool zeroForOne ) internal view returns (uint24 lpFeePips, uint24 hookFeePips) { uint40 currentBlock = uint40(block.number); uint40 endSnipeBlock = cfg.launchBlock + cfg.decayBlocks; if (currentBlock < endSnipeBlock) { uint256 remainingBlocks = endSnipeBlock - currentBlock; uint256 floorTotalPips = uint256(BASE_LP_FEE_PIPS) + uint256(BASE_HOOK_FEE_PIPS); uint256 startTotalPips = cfg.startSniperFeePips; uint256 decayedTotalPips = floorTotalPips + ((startTotalPips - floorTotalPips) * remainingBlocks) / cfg.decayBlocks; uint256 hookCut = (decayedTotalPips * SNIPER_HOOK_SHARE_BPS) / BPS_DENOMINATOR; if (hookCut < BASE_HOOK_FEE_PIPS) { hookCut = BASE_HOOK_FEE_PIPS; } hookFeePips = uint24(hookCut); lpFeePips = uint24(decayedTotalPips - hookCut); return (lpFeePips, hookFeePips); } hookFeePips = BASE_HOOK_FEE_PIPS; lpFeePips = BASE_LP_FEE_PIPS; if (cfg.proLvrEnabled && rt.emaSqrtPriceX96 > 0 && spotSqrtPriceX96 != rt.emaSqrtPriceX96) { // …Limits on trading
It limits trading, for example a max buy or wallet size or a wait between trades, to stop bots grabbing the supply before real traders.
The code that does this (registerPoolConfig):function registerPoolConfig( PoolKey calldata key, address creator, bool quoteIsCurrency0, SnipePreset preset, bool proLvrEnabled, uint128 maxBlockQuoteVolume ) external { if (msg.sender != FACTORY) revert OnlyFactory(); if (key.fee != LPFeeLibrary.DYNAMIC_FEE_FLAG) revert InvalidDynamicFeeFlag(); PoolId id = key.toId(); if (poolConfigs[id].initialized) revert PoolAlreadyRegistered(); uint24 startFee = preset == SnipePreset.HIGH_GUARD ? HIGH_GUARD_START_FEE_PIPS : STANDARD_START_FEE_PIPS; uint40 decay = preset == SnipePreset.HIGH_GUARD ? HIGH_GUARD_DECAY_BLOCKS : STANDARD_DECAY_BLOCKS; poolConfigs[id] = PoolConfig({ initialized: true, quoteIsCurrency0: quoteIsCurrency0, proLvrEnabled: proLvrEnabled, startSniperFeePips: startFee, launchBlock: uint40(block.number), decayBlocks: decay, maxBlockQuoteVolume: maxBlockQuoteVolume }); // …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 sqrtPriceX96) external override onlyPoolManager returns (bytes4) { if (sender != FACTORY) revert OnlyFactory(); PoolId id = key.toId(); if (!poolConfigs[id].initialized) revert PoolNotRegistered(); poolRuntimes[id] = PoolRuntime({ activeBlock: uint40(block.number), blockQuoteVolume: 0, emaSqrtPriceX96: sqrtPriceX96, lastEmaBlock: uint40(block.number) }); return BaseHook.beforeInitialize.selector; }
Who controls it: Nobody. The hook has no admin functions, and 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 auditWhat 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.
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: $7.73.
- Took its fee from a trade 823 times, worth $7.73
Latest transactions
- 0xdf073b38…b0ac43 block 61,848,590 · 0.000538 USDC
- 0x6c93e8f3…fee261 block 61,847,658 · 0.00500 USDC
- 0xbd6c3c0c…118595 block 61,847,473 · 0.000497 USDC
- 0x478dbf8a…eb1e24 block 61,847,460 · 0.0361 USDC
- 0x1584394b…20abc9 block 61,847,439 · 0.0361 USDC
- 0x839229c5…b23074 block 61,847,349 · 0.0367 USDC
- 0xbc0c5a6c…85ce57 block 61,847,285 · 0.0367 USDC
- 0xd9975db2…c39090 block 61,846,676 · 0.000100 USDC
- 0xda3b534f…eeb769 block 61,846,527 · 0.000248 USDC
- 0x1e7792c1…a7d92b block 61,845,876 · 0.00147 USDC
- Protected the 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.