V4HOOKSCUT SHEET DIRECTORY

Index / Buyback

pattern · MIT · last updated 2026-08-27

Buyback

Treasury-funded market buy when pool tick is at or below thresholdTick.

First-party rewrite inspired by atj3097/buyback-hook. Native-pair pool; fund the hook with ETH. setThreshold stores a tick floor; buyback() unlocks a zeroForOne swap when current tick <= threshold. Fixed ungated-callback issues from the legacy repo. Experimental. 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

afterInitialize

Solidity

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

function getHookPermissions() public pure override returns (Hooks.Permissions memory) {
    return Hooks.Permissions({
        beforeInitialize: false,
        afterInitialize: true,
        beforeAddLiquidity: false,
        afterAddLiquidity: false,
        beforeRemoveLiquidity: false,
        afterRemoveLiquidity: false,
        beforeSwap: false,
        afterSwap: false,
        beforeDonate: false,
        afterDonate: false,
        beforeSwapReturnDelta: false,
        afterSwapReturnDelta: false,
        afterAddLiquidityReturnDelta: false,
        afterRemoveLiquidityReturnDelta: false
    });
}

Spec

Kindpattern
Statusexperimental
LicenseMIT
Sourcehttps://github.com/CryptoGnome/v4hooks
CategoriesLaunchpads
PropertiesVanilla swap
ChainsEthereum
Docshttps://github.com/atj3097/buyback-hook

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.