Rule Craft

On-chain module

Snipe Guard

For a fixed number of blocks after the pool opens, each block accepts only a small slice of supply and every buy pays an extra tax to the LPs. Bots that race the first block get little and pay a lot.

Compose with Snipe Guard On-chain module · in RuleCraftHook (unaudited)

Callbacks

3

Swap gas

~150k

estimate

Touches

buy

Pools

--

see Pools page

How it behaves

  1. 1beforeInitialize stores the opening block number for the pool.
  2. 2afterSwap adds each buy's token output to a per-block tally and reverts once the block's cap is full.
  3. 3afterSwap also takes the guard tax from the buyer's token output: royalty and protocol share are set aside, the rest is donated to in-range LPs.
  4. 4After the window both checks switch off for good; the hook keeps no switch to turn them back on.

Parameters

ParameterMinDefaultMaxWhat it does
Guard window5 blocks60 blocks600 blocksHow many blocks after opening the guard stays on.
Max buys per block0.1 %0.5 %5 %Share of total supply all buyers together may take in one block.
Guard tax0 %25 %60 %Extra cut of each buy during the window, paid to in-range LPs.

Bounds are enforced on chain by the registry, the launcher and the hook. Values are frozen when the pool is created.

Permission bits

13BI
12AI
11BA
10AA
9BR
8AR
7BS
6AS
5BD
4AD
3BSΔ
2ASΔ
1AAΔ
0ARΔ

BI beforeInitialize · AS afterSwap · ASΔ afterSwapReturnDelta

mask 0x2044bits 100000010001003/14 on can change amounts
  • beforeInitializeInitRuns before the pool's starting price is set. Can refuse to open the pool or check who opens it.
  • afterSwapSwapRuns after every swap with the final amounts. Reacts to trades: burns, pots, reward accounting.
  • afterSwapReturnDeltaDeltaLets afterSwap take a cut of the output. The hook can change what you receive. Taxes and burns live here.