Developers
Integration guide
A Kairo token is an ordinary Uniswap v4 pool on Elysium with Kairo's hook attached. Your bot, wallet or app can read it, quote it, trade it and launch new ones with plain contract calls. No SDK, no API key, no sign-up.
Start here: addresses and ABIs#
Store one address, the v4 factory, and ask it for the rest. Nothing else in the system acts as a registry.
| Call | Returns | Changes |
|---|---|---|
factory.hook() · poolManager() | KairoLaunchHook and Uniswap's PoolManager | Fixed at deployment |
factory.quoteRegistry() | KairoQuoteRegistry, the list of assets a token can be paired with | Fixed at deployment |
factory.tokenImplementation() · splitterImplementation() | The two masters that launches and fee splits are cloned from | Fixed at deployment |
factory.protocolFeeVault() | Where the hook sends Kairo's share of each fee | Owner can change |
factory.guardian() | The one address allowed to pause new launches (it can do nothing else) | Owner can change |
factory.poolIdOf(address token) · tokenOf(bytes32) | Token → pool id and back; zero for anything Kairo didn't launch | Written once, at launch |
factory.allTokens(uint256 i) | Launches by index, oldest first; allTokensLength() gives the count | Grows with each launch |
hook.poolKey(bytes32 poolId) | The complete v4 PoolKey to hand any router | Written once, at launch |
vault.platformPool() · platformToken() | KAIRO and the KairoV4BuybackPool adapter for its pool | Owner can change |
Two addresses aren't stored in the factory: the router and the lens. Take them from Contract addresses or web/src/contracts/addresses.ts, then check each with factory.isProtocolContract(addr). Uniswap's PoolManager on Elysium lives at 0xE2e105d3F7209A9DA11f83cCf3E7398a753823F1.
ABIs come out of the contracts build: run npm run abis inside contracts/ and they land in web/src/contracts/abis.ts.
| Export | Use it for |
|---|---|
kairoV4FactoryAbi | KairoV4Factory: launching, fee rows, line settings, address getters |
kairoLaunchHookAbi | KairoLaunchHook: per-pool terms, fees, stages and claims |
kairoV4RouterAbi | KairoV4Router: buy, sell and multi-pool routes |
kairoV4LensAbi | KairoV4Lens: read-only views and exact quotes |
kairoV4TokenAbi | KairoV4Token: the launch token, holder rewards included |
kairoFeeSplitterAbi | KairoFeeSplitter: fee splits between 2–4 recipients |
kairoV4BuybackPoolAbi | KairoV4BuybackPool: the vault's view of KAIRO's pool |
kairoQuoteRegistryAbi · protocolFeeVaultAbi · kairoAirdropAbi · erc20Abi | Pair assets, Kairo's fee share, the airdrop, and a generic ERC-20 |
Trading a pool#
Examples below use viem. client is a public client, wallet a wallet client signing as account, and the ABIs come from abis.ts. All lens functions are view, so they cost nothing to call.
Step 1 · Load the pool
import { kairoV4FactoryAbi, kairoV4LensAbi, kairoV4RouterAbi, erc20Abi } from "./abis";
const known = await client.readContract({ address: factory, abi: kairoV4FactoryAbi, functionName: "isKnownToken", args: [token] });
const v = await client.readContract({ address: lens, abi: kairoV4LensAbi, functionName: "tokenView", args: [token] });
v.poolId; // bytes32
v.config.stage; // 0 Below · 1 Crossed · 2 Graduated · 3 past the LP line · 4 LP fee on
v.totalFee; v.buyFee; // pips right now; buyFee includes any anti-snipe surcharge
v.effectiveTotalFee; // all-in, LP fee compounded
v.graduationProgressBps; // 0..10,000
v.marketCap; // quote units, 18-decimal fixed point
const quote = v.config.quoteIsCurrency0 ? v.currency0 : v.currency1; // 0x0 = native HYPEStep 2 · Price the trade
lens.quoteBuy(token, amountIn) and lens.quoteSell(token, tokensIn) give the exact output in this block, with price impact and every fee already applied, plus the hook's fee on its own. Uniswap's V4Quoter and the router's quoteExactIn return the same figure to the last wei.
const [tokensOut, fee] = await client.readContract({ address: lens, abi: kairoV4LensAbi, functionName: "quoteBuy", args: [token, parseEther("0.4")] });
const minOut = (tokensOut * 995n) / 1000n; // allow 0.5% slippage
const { timestamp } = await client.getBlock(); // use the chain's clock for the deadline
const deadline = timestamp + 90n;Step 3 · Send it
ERC-20 inputs are pulled by the router with transferFrom, so approve the router itself (Permit2 isn't used here): the quote asset before buying on an ERC-20 pair, the token before selling. For a native HYPE buy, attach the amount as value.
// buy, paying native HYPE
await wallet.writeContract({ address: router, abi: kairoV4RouterAbi, functionName: "buy",
args: [token, amountIn, minOut, account.address, deadline], value: amountIn });
// sell: the router needs an allowance on the token
await wallet.writeContract({ address: token, abi: erc20Abi, functionName: "approve", args: [router, tokensIn] });
const [quoteOut] = await client.readContract({ address: lens, abi: kairoV4LensAbi, functionName: "quoteSell", args: [token, tokensIn] });
await wallet.writeContract({ address: router, abi: kairoV4RouterAbi, functionName: "sell",
args: [token, tokensIn, (quoteOut * 995n) / 1000n, account.address, deadline] });Prefer Uniswap's Universal Router 2.2.0 (0x1B341FDD55d56F8E08409A2C25DDFad93Eb03C1a)? Encode a V4_SWAP with the key from hook.poolKey(poolId) and approve through Permit2. A swap that can't fill completely reverts, so leave the price limit wide open and protect yourself with the minimum output instead.
Launching from your product#
factory.launch(params) takes a struct of sixteen fields, all listed in the Function reference. Before signing you can work out the token's address from your salt and get an exact preview of the first buy. Kairo's own form sets firstBuyMinOut to 99% of that preview; do the same or tighter.
const salt = keccak256(toHex(crypto.randomUUID()));
const token = await client.readContract({ address: factory, abi: kairoV4FactoryAbi, functionName: "predictTokenAddress", args: [account.address, salt] });
const firstBuy = parseEther("2.5");
const [preview] = await client.readContract({ address: lens, abi: kairoV4LensAbi, functionName: "previewFirstBuy",
args: [account.address, salt, zeroAddress, 1n /* row 1 = 2% tier */, 0n /* default 1B supply */, firstBuy] });
const creationFee = await client.readContract({ address: factory, abi: kairoV4FactoryAbi, functionName: "launchFee" }); // 0 today
const params = {
name: "Night Heron", symbol: "HERON", metadataURI: "ipfs://…/heron.json", rowId: 1n, quote: zeroAddress, supply: 0n, salt,
feeRecipients: [], feeShares: [], // [] = the sender; [HOLDERS]/[10000] = holders; 2–4 entries = a split
earlyBuyFeeWindow: 0, earlyBuyFeeStartPips: 0, // no anti-snipe fee
firstBuyAmount: firstBuy, firstBuyMinOut: (preview * 99n) / 100n, firstBuyRecipient: zeroAddress,
builderCode: zeroHash, acknowledgeRisk: false,
};
const txHash = await wallet.writeContract({ address: factory, abi: kairoV4FactoryAbi, functionName: "launch", args: [params], value: creationFee + firstBuy });
const receipt = await client.waitForTransactionReceipt({ hash: txHash });
const [ev] = parseEventLogs({ abi: kairoV4FactoryAbi, eventName: "TokenLaunched", logs: receipt.logs });
ev.args.poolId; ev.args.record.firstBuyOut;Is it a Kairo token?#
You'll see new launches as TokenLaunched events from the factory, or through the HTTP API. Before trusting one, check factory.isKnownToken(token), and get its pool only from factory.poolIdOf(token). Anyone can open a v4 pool for the same pair; if its hook, fee or tick spacing differs, it isn't Kairo's. Every Kairo PoolKey has fee = 0x800000 (the dynamic-fee flag), tickSpacing = 200 and hooks = factory.hook(), and the hook rejects pools the factory never registered.
Checking bytecode as well? A launch token is an EIP-1167 clone of factory.tokenImplementation(). Clones can only be initialized by the factory, so isKnownToken already settles it. The one real KAIRO is whatever ProtocolFeeVault.platformToken() returns.
0x363d3d373d3d3d363d73 <implementation, 20 bytes> 5af43d82803e903d91602b57fd5bf3Stages, graduation and the LP line#
The pool created at launch is the token's only pool, permanently. There is no bonding-curve phase and no migration, so the pool id you index on day one stays valid. At launch the full supply goes into a single position that begins at the opening price; Kairo's launch hook owns that position and has no code path to withdraw it.
Graduation is a label at 16.77× the opening price (roughly $58.7k market cap, starting from $3.5k). The swap that pushes the price over it sets the stage to Crossed; a swap in any later transaction makes it final, and the hook emits Graduated(poolId, timestamp) exactly once. Fees and liquidity don't change; the label exists so boards can split launches into columns.
| Column | Pools in it | API stage | On-chain test |
|---|---|---|---|
| New | Under 50% of the way to graduation | new | stage 0 or 1 and lens.graduationProgress below 5,000 bps |
| Near graduation | 50% of the way or further, not graduated yet | graduating | stage 0 or 1 and progress at 5,000 bps or above |
| Graduated | Graduated (permanent), or launched without a line | graduated | hook.poolConfig(poolId).stage is 2, 3 or 4 |
- Progress bar. Use
graduation.progressBpsfrom the API (0–10,000), orlens.graduationProgress(poolId)on chain; they match. It measures how much of the quote needed to reach the line the seed has already taken in, and reads 10,000 from the moment the line is crossed. - Building the column.
GET /api/v1/tokens?stage=graduating&sort=progressreturns pools ordered by how close they are to graduating;sort=graduatedputs the newest graduates first. Details in the HTTP API. - Catching the moment. Listen for the hook's
Graduatedevent (or anyStageChanged), or pollgraduation.graduatedAt. It happens inside an ordinary swap; nobody needs to trigger it. - The LP line. Set at 142.56× the opening price. When the price has been above it for 600 seconds in total (not necessarily in one stretch), the pool's Uniswap LP fee turns on permanently (
LpFeeActivated) and the pool accepts outside liquidity.lens.lpLineHeld(poolId)returns seconds held and seconds required.
Which fee numbers to display#
| Call | Use |
|---|---|
lens.feeBreakdown(poolId) | Pips for total, lp, protocol and creator, plus the effective all-in. Display total as the pool's fee; it never goes up. |
hook.currentBuyFeeRate(poolId) | The rate a buy pays at this moment: the total, or higher during an anti-snipe window. lens.buyFeeSchedule returns the whole decay curve. |
poolConfig(poolId).totalFeeMinPips · feeLocked | The lowest total the recipient is still allowed to set, and whether the fee is frozen. |
token.buyTaxRate() · sellTaxRate() | For scanners that only look at the token contract: buy rate now (anti-snipe included) and sell rate, in bps, rounded up. |
token.taxBps() | Same value as sellTaxRate. Not a transfer tax: sending tokens between wallets is free; the fee is charged in the quote asset inside the swap. |
lens.quoteBuy · quoteSell | Exact output for a given input, net of fee and price impact. |
Invariants you can rely on#
| Topic | Behaviour |
|---|---|
| Fills | All or nothing: a swap that can't fill reverts with PartialFillRejected. Router buys either return at least the minimum or revert with TooLittleReceived. |
| Launch liquidity | Deposited once at launch, held by the hook, never withdrawn. Its LP fee is paid to the creator side in the quote asset; the token half is burned. |
| Outside liquidity | Closed until the LP line: beforeAddLiquidity reverts PoolNotReady while the stage is below LpActive (4). Withdrawing is never blocked. After the line, LPs earn the pool's LP fee. |
| Current fee | Always read it from feeBreakdown / poolConfig; never hard-code tiers. A pool's fee row is fixed at launch and can only be cut later, by its recipient or by the owner. |
| Anti-snipe | Optional per pool. Buys pay a surcharge that declines linearly to the normal total over the window; sales never pay it. See Anti-snipe window. |
| Third-party routers | The fee is settled inside the swap deltas, so every v4 router and quoter sees identical numbers. |
| Gas | Roughly 167k for a router buy, 173k for a sale, 186k when the pool pays holders, and 0.83–1.16M for a launch. |
Deep links#
Token page: /token/<address>. Builder page: /builders/<code>. The connected wallet's holdings: /portfolio.
