V4HOOKSCUT SHEET DIRECTORY

Index / SniperTax

pattern · MIT · last updated 2026-08-27

SniperTax

Launch LP fee decays linearly from startFee to baseFee over duration seconds.

First-party teaching hook inspired by Zora ZoraV4CoinHook launch fee decay. afterInitialize records launchTime; beforeSwap returns a fee that linearly decays from startFee (e.g. 99%) to baseFee (e.g. 1%) over duration seconds. Requires a dynamic-fee pool. Contrast anti-snipe.yml which caps buy size in blocks. Experimental. Forge tests in test/SniperTax.t.sol. Listing is not an audit.

Permission bits

These bits must match the deployed address. Confirm on-chain before you route.

Initialize
ba
Liquidity
baba
Swap
ba
Donate
ba
Return delta
baaa

afterInitializebeforeSwap

Solidity

Excerpt from contracts/SniperTax.sol. Copy the full file to implement this. Not an audit.

// SPDX-License-Identifier: MIT
function feeFor(PoolId poolId) public view returns (uint24) {
    uint256 elapsed = block.timestamp - launchTime[poolId];
    if (elapsed >= duration) return baseFee;
    uint256 delta = uint256(startFee) - uint256(baseFee);
    return uint24(uint256(baseFee) + (delta * (duration - elapsed)) / duration);
}

Spec

Kindpattern
Statusexperimental
LicenseMIT
Sourcehttps://github.com/CryptoGnome/v4hooks
CategoriesLaunchpadsDynamic feesMEV protection
PropertiesDynamic feeVanilla swap
ChainsBase

FAQ

Can I paste this into production? The snippet is an excerpt. Use the full file at the source URL, match flags to the address, and treat this page as a map, not a guarantee.

How do I build this safely? Start with secure v4 hooks and the OpenZeppelin hooks guide.