# The receipt: what each coin's launch paid, and to whom

Every Koine coin has a receipt. It says what traders paid in the first 100 seconds, what presale depositors got, what happened after the spike, and what was bought back and burned. The coin page shows it under "Receipt", and `GET /api/launches/<mint>/receipt` returns it as JSON.

It starts with one sentence: "Traders paid <fees> SOL in fees in the first 100 seconds; <amount> SOL of it goes to buying back and burning $<TICKER>."

## Where do the numbers come from?

From three places:

- **The swaps.** Koine's server reads every transaction on each coin's pool and stores every swap (see "How are swaps indexed?" below).
- **The keeper's log and totals.** The spike claim, the hourly claims and their split, and every buyback and burn (see [how-it-works.md](https://docs.koine.markets/launchpad/how-it-works#step-7-what-does-the-keeper-do-after-open)).
- **The vault and the pool,** read live: the presale price and the price now.

Every number links to the transactions or log entries behind it. In the JSON, single transactions are signatures (`sig`), log entries are links to that entry (`/api/launches/<mint>/log?before=<id+1>&limit=1`), and totals over many swaps link to the swap list (`/api/launches/<mint>/swaps?phase=...`).

Source: `app/server/receipt.ts` (`receipt`), `app/server/http.ts`, `app/web/src/Coin.tsx` (`Receipt`).

## What does each part show?

**First 100 seconds** (the spike: from open to open + 100 s, while the fee falls from 99% to 1%):

- the number of swaps and of distinct wallets, and the SOL traded;
- the fees paid, and their parts: the pool position's 80%, Meteora's share, and the referral share (Koine's treasury gets it on swaps made through Koine's site);
- the spike claim from the log, and its split under the rule the keeper applied: buyback and burn, and Koine (25% for claims under the current split, 0% for claims made before it);
- the 5 wallets that spent the most SOL buying in the spike, with the fee each paid.

The spike claim is larger than the position's share of the spike swaps. The keeper claims every fee the position earned before it, so the claim also holds the position's share of the vault buy's ~1% fee, and of any swap between the fee floor and the moment the claim ran. The JSON shows that breakdown (`spike.claim.fromSwaps`) and the difference from the claim.

The lead sentence uses the spike swaps only: the fees they paid, and their position share less Koine's share of the spike claim.

**Presale:** the number of depositors, the price the vault paid (SOL spent ÷ tokens bought, shown as a market cap), the pool price now, and the change in %. Links to the vault buy.

**After the spike:** swaps, SOL traded and fees from open + 100 s on, buybacks included. Then the keeper's hourly claims and their split: the steward's share, buyback (with any steward share forfeited), and Koine's share. Those three come from the keeper's totals, which its `fee-claim` log entries add up to.

**Buyback and burn:** the SOL spent, the tokens burned and their share of the 1B supply, from the log, with each buy and burn transaction. The JSON also gives the same buys as the pool recorded them (`buyback.swapsSol`, `buyback.swapsTokens`).

Before trading opens, the receipt says when it opens and shows only the log.

Source: `app/server/receipt.ts`, `app/server/keeper.ts` (`claimSpike`, `spikeSplit`, `claimFees`, `feeSplit`, `buyback`), `app/server/tx.ts` (`market`).

## What counts as volume?

SOL traded, fee included: on a buy, the SOL the buyer paid; on a sell, the SOL the seller received plus the fee taken from it. The vault's presale buy is not counted as trading volume. The coin list and the Explore screener show the same sum over the last 24 hours (`vol24hSol`) and since open (`volSol`).

Source: `app/server/store.ts` (`VOLUME_SQL`, `volumes`), `app/server/markets.ts` (`marketStats`).

## How are swaps indexed?

The indexer runs in the API process next to the keeper:

1. For each coin, it pages through the pool address's signatures (`getSignaturesForAddress`, 200 at a time), newest first.
2. The first pass reads back to the pool's creation. Later passes stop at the newest signature already indexed, so they read only what's new. Progress is saved after every page, so a restart carries on where it stopped.
3. It fetches each successful transaction and decodes every `EvtSwap2` event the pool program emitted for this pool.
4. Each swap is stored once, keyed by its signature and its place in the transaction, so reading a transaction twice changes nothing.

For each swap it stores the trader (the swap instruction's payer, the wallet that signed for it), the side, the SOL in or out, the tokens, the whole fee and its parts, the slot, the block time and the pool program's own clock.

**Phase**, by the pool's clock (which set the fee): `presale` before open (the vault buy), `spike` from open to open + 100 s, `floor` after.

**Made through Koine's site:** the swap named the treasury's wrapped-SOL account as referral, or the transaction sent SOL to the treasury (the 0.5% site fee). Swaps by the vault and the buyback wallet are marked as such and never as site swaps.

**How often:** at most 5 RPC calls a second (`INDEXER_RPS`). A pool is read on every pass (30 s, `INDEXER_SECONDS`) from an hour before open to a day after, or within an hour of its last swap; every 5 minutes within a day of its last swap or inside the 7-day buyback window; hourly otherwise. So the receipt and the screener trail the chain by up to 30 s while a coin is busy.

**Cost:** one signature call per pass per pool plus one call per new pool transaction (swaps, claims, the vault buy, the pool's creation).

Every swap list is public: `GET /api/launches/<mint>/swaps` returns them in chain order, 200 at a time (up to 1,000 with `limit`), from `offset`, optionally one `phase`. Amounts there are in lamports and raw token units (6 decimals).

Source: `app/server/indexer.ts` (`indexLaunch`, `rowsOf`, `phaseOf`, `interval`), `app/server/damm.ts` (`swapsIn`), `app/server/store.ts` (`swaps`, `swap_index`), `app/server/http.ts`.

## Can I check it against the chain?

Yes. The pool account keeps running totals of the fees its swaps paid (`metrics.totalLpBFee`, `metrics.totalProtocolBFee`). The sums of a coin's indexed swaps (`/api/launches/<mint>/swaps`) can be compared with those totals. The receipt's JSON also gives the position's share of the swaps before the spike claim (`spike.claim.fromSwaps`) next to the claim itself.

`scripts/launch-check.ts` reads the same swap events with the same decoder; see [verify.md](https://docs.koine.markets/launchpad/verify).

Source: `app/server/damm.ts`, `app/server/receipt.ts` (`spike.claim.fromSwaps`), `app/scripts/launch-check.ts`.

## What can't the receipt show?

- **Who is a bot.** It shows wallets and amounts. Nothing on chain says whether a wallet is a bot.
- **Payouts per coin.** The steward and treasury payouts are plain SOL transfers from the buyback wallet, so the steward and platform totals come from the keeper's log, not from the chain. See [verify.md](https://docs.koine.markets/launchpad/verify#what-the-chain-alone-cant-prove).
- **The exact order inside one slot.** Swaps in the same slot as the spike claim are counted as after it.

Source: `app/server/receipt.ts`, `docs/launchpad/verify.md`.
