Tokens
Anti-snipe window
Optional, and set by the creator at launch: for up to 30 minutes, buys pay a surcharge that starts as high as 99% and shrinks every second until only the normal fee is left. The surcharge goes to the creator side; sells are never charged it.
How the early-buy fee works#
| Trade | Pays |
|---|---|
| A buy inside the window | The falling rate. At 99%, 100 spent puts 1 into the pool. |
| A buy after the window, and every sell | The base fee only. A window never restarts. |
| The creator's buy in the launch transaction | The base fee, never the surcharge. |
Below, “base fee” means the tier fee a pool charges when no window is running: totalFeePips in hook.poolConfig(poolId), in pips (1,000,000 = 100%), 10% at most, taken in the quote asset (HYPE for most pools).
Switched on at launch (it is off by default), the surcharge applies to buys from the launch block onward: the full start rate in the first second, then one equal step lower every second until it meets the base fee at the window's end. Grabbing the supply in the opening seconds is costly; patience is cheap.
The surcharge (rate minus base fee) is credited in full to the creator side, wherever that side points: a wallet, a split, or holders. Kairo's take doesn't grow; it stays the tier's usual share (0.3% (0.4% on 3%+ tiers)). If the token pays holders, the surcharge streams out over the next hour like any other fee, so an early whale that keeps its bag recovers a slice in proportion to its stake, and stops recovering it once it sells.
The clock starts at the launch block's timestamp (launchedAt). A launch that came through the parent chain's delayed inbox can be stamped earlier than it actually executes, which eats into a short window before anyone else can trade.
Below: a 2% pool whose 99% start runs down over 15 minutes. The last column is 1 / (1 − rate): how many times the pool's own price a buyer effectively pays.
| Time | Buy rate | Price paid vs the pool's |
|---|---|---|
| Launch second | 99% | 100× |
| Minute 3 | 79.6% | 4.9× |
| Minute 6 | 60.2% | 2.5× |
| Minute 9 | 40.8% | 1.69× |
| Minute 12 | 21.4% | 1.27× |
| Minute 15 | 2% | 1.02× |
Limits the hook enforces#
Start rate and window are written into the pool at launch (V4LaunchParams.earlyBuyFeeStartPips and earlyBuyFeeWindow) and never change; both zero means no window. The contracts cap them:
| Term | Allowed | Detail |
|---|---|---|
| Start rate | Above the base fee, up to 99% | At most 990,000 pips (MAX_EARLY_START_PIPS on the factory). |
| Window | 5 s, 10 s, 30 s, 1 min, 5 min, 15 min or 30 min | Exactly one of these, or 0 for none (the hook's MAX_EARLY_BUY_FEE_WINDOW is 1,800 s). Anything else reverts with InvalidAntiSnipe. |
| Direction | Only down | No second costs more than the one before. If the recipient cuts the base fee mid-window, the rest of the slope ends at the new, lower fee. |
| Sells | Never surcharged | They pay the base fee whether a window is open or not. |
The launch form always starts at 99% and lets the creator pick one of the seven windows. The buy rate at fixed checkpoints for each, on a 2% pool, plus two other tiers:
| Schedule | 3 s in | 20 s in | 45 s in | 2 min in | 10 min in | 25 min in |
|---|---|---|---|---|---|---|
| 99% → 2% over 5 s | 40.8% | 2% | 2% | 2% | 2% | 2% |
| 99% → 2% over 10 s | 69.9% | 2% | 2% | 2% | 2% | 2% |
| 99% → 2% over 30 s | 89.3% | 34.33% | 2% | 2% | 2% | 2% |
| 99% → 2% over 1 min | 94.15% | 66.67% | 26.25% | 2% | 2% | 2% |
| 99% → 2% over 5 min | 98.03% | 92.53% | 84.45% | 60.2% | 2% | 2% |
| 99% → 2% over 15 min | 98.68% | 96.84% | 94.15% | 86.07% | 34.33% | 2% |
| 99% → 2% over 30 min | 98.84% | 97.92% | 96.58% | 92.53% | 66.67% | 18.17% |
| 99% → 5% over 1 min | 94.3% | 67.67% | 28.5% | 5% | 5% | 5% |
| 99% → 10% over 30 min | 98.85% | 98.01% | 96.78% | 93.07% | 69.33% | 24.83% |
Formally: rate(t) = S − ⌊(S − T)·(t − t₀) / W⌋ while t < t₀ + W, otherwise T. Here S is the start rate, T the current base fee, W the window in seconds and t₀ the launch timestamp; a block stamped before t₀ pays S. Rounding down keeps the rate on or above the straight line. The full arithmetic is in the Function reference.
Reading a pool's schedule#
| Value | On chain | API (/api/v1/tokens/{token}) |
|---|---|---|
| Window start | poolConfig(poolId).launchedAt, Unix seconds | launchedAt on the card, milliseconds |
| Start rate | poolConfig(poolId).earlyBuyFeeStartPips; 0 for none | pool.earlyStartPips |
| Window length | poolConfig(poolId).earlyBuyFeeWindow, seconds; 0 for none | pool.earlyWindow |
| Window end | poolConfig(poolId).earlyBuyFeeUntil, or endsAt from lens.buyFeeSchedule | launchedAt + earlyWindow × 1000 |
| Buy rate now | hook.currentBuyFeeRate(poolId) in pips; token.buyTaxRate() in bps, rounded up | live.buyFeePips |
| Sell rate | hook.totalFee(poolId); token.sellTaxRate() in bps | live.sellFeePips, totalFeePips |
| All in one read | lens.buyFeeSchedule(poolId): start rate, end rate, start time, end time, current rate | — |
Compare earlyBuyFeeUntil with the latest block's timestamp, not your server's clock: the window is open while the block is earlier. The end of a window emits no event.
On chain
const read = (address, abi, functionName, args) => client.readContract({ address, abi, functionName, args });
const poolId = await read(factory, kairoV4FactoryAbi, "poolIdOf", [token]);
const cfg = await read(hook, kairoLaunchHookAbi, "poolConfig", [poolId]);
const now = (await client.getBlock()).timestamp; // chain time, not Date.now()
const open = cfg.earlyBuyFeeWindow > 0 && now < BigInt(cfg.earlyBuyFeeUntil);
const remaining = open ? BigInt(cfg.earlyBuyFeeUntil) - now : 0n; // seconds
const start = cfg.earlyBuyFeeStartPips; // pips charged in the launch secondCurrent buy rate
const buyPips = await read(hook, kairoLaunchHookAbi, "currentBuyFeeRate", [poolId]);
const sellPips = await read(hook, kairoLaunchHookAbi, "totalFee", [poolId]);
const [startPips, endPips, startsAt, endsAt, nowPips] = await read(lens, kairoV4LensAbi, "buyFeeSchedule", [poolId]);
const multiple = 1e6 / (1e6 - Number(buyPips)); // 100 at a 99% rateThrough /api/v1
curl -s "$KAIRO/api/v1/tokens/$TOKEN" | jq '{
start: .pool.earlyStartPips, # pips; 0 for none
window: .pool.earlyWindow, # seconds; 0 for none
buyNow: .live.buyFeePips, # pips, read from the chain
sellNow: .live.sellFeePips,
fee: .totalFeePips
}'live is read from chain on request (cached for 2 seconds) and is null if that read failed. A cached rate overstates the fee, since it only ever drops; still, price the actual transaction from a fresh read. All fields are listed under HTTP API.
Quoting and sending buys#
A quote uses the rate of the block it runs in. lens.quoteBuy(token, amountIn) returns tokens out and the fee; lens.quoteExactIn(poolId, true, amountIn) itemises the fee.
const { timestamp } = await client.getBlock();
const [tokensOut] = await read(lens, kairoV4LensAbi, "quoteBuy", [token, amountIn]);
await wallet.writeContract({
address: router, abi: kairoV4RouterAbi, functionName: "buy",
// minimum 2% under the quote, deadline 10 s after the quoted block
args: [token, amountIn, (tokensOut * 98n) / 100n, account.address, timestamp + 10n],
value: amountIn,
});If the pool is otherwise idle, a buy that lands later than quoted pays less fee and receives more, so a falling rate on its own can't trip the minimum. For a pool paired with an ERC-20, approve the router for that asset first and send no value.
Minimums while the rate falls#
- Why it matters
- Each second lets more of an exact-in buy through, most of all early on, so a minimum from a stale quote is really a much looser bound than its percentage.
- What's at risk
- Only output tokens; the input is fixed. If someone else lifts the price first, the buy receives fewer tokens, down to its minimum.
- What to do
- Quote at the latest block, submit immediately with a short deadline, and never reuse a quote from an earlier second. A quote from a clock running ahead of the chain promises too many tokens, and the buy reverts on its minimum.
How far below the delivered amount a minimum set 2% under the quote really sits when the buy lands late, and how much more of the input reaches the pool by then. A 2% pool with 99% falling over 30 minutes, and a buy too small to move the price:
| Quote taken at | Lands 2 s after | Lands 6 s after | Lands 20 s after |
|---|---|---|---|
| Launch second | 11.5% (+10.8% in) | 25.9% (+32.3% in) | 52.8% (+107.8% in) |
| 2 min | 3.4% (+1.4% in) | 6.1% (+4.3% in) | 14.4% (+14.4% in) |
| 10 min | 2.3% (+0.3% in) | 2.9% (+1.0% in) | 5.1% (+3.2% in) |
For routers and aggregators#
- Quotes already include it. The hook applies the surcharge inside the swap, so the lens, Uniswap's V4Quoter and every router see the same rate for the block they run in.
- Cache the terms.
launchedAtandearlyBuyFeeWindownever change for a pool. Read them once and keep time from the chain. - Model it in integers. An off-chain model must use the integer formula and the split rounding (fee up, protocol and LP down, creator side the remainder). Curve-fitting quotes taken during a window misprices it, and everything after it.
- No special cases. No allowlist, per-wallet logic or
tx.origincheck: at the same second and state, every buyer except the creator's launch buy is charged alike. - After the window. Buys and sells both pay the base fee, which can only be lowered. The router's
buy,sellandswapExactIntake a minimum and a deadline and revert withTooLittleReceivedbelow it; any swap that can't use its whole input reverts withPartialFillRejected, whichever router sent it.
Indexing it#
| Event | Meaning |
|---|---|
TokenLaunched | Its record carries earlyBuyFeeStartPips and earlyBuyFeeWindow (both 0 when off). The window opens at that block's timestamp. |
Swap · FeeAccrued | One of each per trade. A buyer spent the Swap's quote amount plus fee; fee is the hook's whole take, surcharge included, and protocolPart is Kairo's share of it. |
TotalFeeUpdated | The base fee was cut, and the remaining slope now lands on the lower value. |
LpFeeActivated | The LP fee is on. Buyers pay the same rate; only its split changes. |
| Window end | No event. Schedule a re-read for earlyBuyFeeUntil. |
For volume, decide whether you report pool-side input (the Swap's quote amount) or trader spend (that plus FeeAccrued's fee), and label it: at 99% the two differ by a factor of 100. Kairo's API reports the pool side and lists each trade's fee parts beside it.
Displaying it to traders#
- Show the buy rate and refresh it every block, labelled as a buy rate. Better still, show the price multiple it implies, 1 / (1 − rate): 100× at 99%.
- Count down to
earlyBuyFeeUntilby block time. At zero, read the rate again; from then on buys pay the base fee. - Confirm before an expensive buy. Put a confirm step, with the tokens out and the price multiple, in front of any buy above the base fee. Snipers, copy-trading and limit orders fire exactly when the rate peaks, so have them check
currentBuyFeeRate(poolId)first and skip or cap. - Keep the sell rate separate.
sellTaxRate()andtaxBps()never include the surcharge. A wallet-to-wallet transfer is never charged anything. - Show both while they differ. A scanner showing one rate understates what buyers pay in a window; list buy and sell side by side until they match.
- Re-read on events. After
TotalFeeUpdatedthe slope ends lower;LpFeeActivatedchanges the split, not the rate.
Example: one buy, second by second#
10 HYPE, spent at seven moments in a 15-minute window on a 3% pool that hasn't reached its LP line, so there is no LP fee. The rate is deducted from the input first; Kairo's 0.4% comes out of that fee, the creator side keeps what is left of it, and the remainder buys tokens.
| Second | Rate | Fee taken | Kairo (0.4%) | Creator side | Into the pool | Price paid vs the pool's |
|---|---|---|---|---|---|---|
| 0 (launch) | 99% | 9.9 | 0.04 | 9.86 | 0.1 | 100× |
| 2 | 98.79% | 9.87867 | 0.04 | 9.83867 | 0.12133 | 82× |
| 30 | 95.8% | 9.58 | 0.04 | 9.54 | 0.42 | 24× |
| 180 | 79.8% | 7.98 | 0.04 | 7.94 | 2.02 | 5.0× |
| 450 | 51% | 5.1 | 0.04 | 5.06 | 4.9 | 2.0× |
| 899 | 3.11% | 0.31067 | 0.04 | 0.27067 | 9.68933 | 1.03× |
| 900 (window over) | 3% | 0.3 | 0.04 | 0.26 | 9.7 | 1.03× |
FAQ#
- Are sells ever surcharged?
- No. A sell pays the base fee at any time.
- Is the creator exempt?
- Only for the buy inside the launch transaction. Any later buy from the creator pays the current rate.
- Can the schedule be extended or raised?
- No. Start and window are fixed at launch; cutting the base fee only lowers what remains.
- How do I know a pool has no window?
- Start and window both read 0 (pool.earlyStartPips and pool.earlyWindow in the API), and buy and sell rates match. One code path handles both kinds of pool.
- Who gets the surcharge?
- The creator side, in full: the creator's wallet, the split, or the holders' stream, depending on the token's route.
