> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kek.pro/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Treat Solana and Robinhood Chain as separate protocol paths.
> Write for people using the KEK.PRO app.
> Treat displayed fees, limits, and availability as environment-specific unless labeled as protocol constants.

# Onchain events

> Index KEK.PRO launches, V3 swaps, token transfers, TGE checkpoints, fees, and fee rights from canonical logs.

Index the launch factory first. Each valid `TokenLaunched` log identifies the
token, canonical V3 pool, quote token, ordering, fee tier, launch policy, and
locked position.

<figure className="kek-figure kek-figure--robinhood" data-mark="LOGS" aria-labelledby="event-index-title">
  <div className="kek-figure__header">
    <span id="event-index-title">Canonical indexing / discovery sequence</span>
    <small>Manifest-pinned topics · canonical evidence</small>
  </div>

  <div className="kek-figure__body">
    <div className="kek-flow kek-flow--four">
      <div className="kek-flow__node is-live"><span>01 / Discover</span><strong>Factory launch log</strong><small>Start at the deployment block from the matching release.</small></div>
      <div className="kek-flow__node"><span>02 / Reconcile</span><strong>Validate direct reads</strong><small>Confirm token, pool, quote asset, ordering, and tier.</small></div>
      <div className="kek-flow__node"><span>03 / Expand</span><strong>Register emitters</strong><small>Follow canonical Swap, Transfer, lifecycle, and revenue logs.</small></div>
      <div className="kek-flow__node"><span>04 / Confirm</span><strong>Apply chain policy</strong><small>Use only logs that remain canonical under the selected finality policy.</small></div>
    </div>
  </div>

  <figcaption className="kek-figure__caption">Event signatures belong to a specific deployment interface. Never combine current topics with an unverified historical ABI.</figcaption>
</figure>

## Pin the event version

Event signatures are part of the deployment interface. Pin the deployment
manifest and its ABI hashes as one release.

The current source-generated `abi/v2` artifacts use these topics:

| Event                    | Emitter               | `topic0`                                                             |
| ------------------------ | --------------------- | -------------------------------------------------------------------- |
| `TokenLaunched`          | `KekproLaunchFactory` | `0x5e92c3d6ac77ef8bd5056839aa19f382e18918a20b7fce2aebb73966957a63f1` |
| `TokenMetadataPublished` | `KekproLaunchFactory` | `0xfb8e0ad0856c107c1f8e25b8a152d5029d2f7787e1803c2e554280d8f234c603` |
| `GraduationCheckpointed` | `KekproLaunchFactory` | `0x56b254cbc30159619672f7d1c0717bc6dcd78f1a84a2a349abf7c69da826c292` |
| `Swap`                   | Canonical V3 pool     | `0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67` |
| `Transfer`               | Launch token          | `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` |
| `FeesAllocated`          | `KekproLaunchLocker`  | `0x7a7c268fd051f02c2465f8dfbee4d253bce8d72310e3e733257795bf136c3999` |

<Warning>
  The historical testnet deployment manifest records ABI hashes from an older
  source revision. Do not use the topics or tuple shapes above against that
  deployment until the approved release proves they match.
</Warning>

## Read launches with viem

Use the full event shape. Start at the deployment block from the matching
manifest.

```ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
import { parseAbiItem } from "viem";

const tokenLaunched = parseAbiItem(
  "event TokenLaunched(address indexed token, address indexed deployer, address indexed dexFactory, address pairToken, address pool, uint256 dexId, uint256 launchConfigId, uint256 positionId, uint256 restrictionsEndBlock, uint256 initialBuyAmount, uint256 supply, bool isToken0, uint24 poolFee, uint256 graduationThreshold, address creatorFeeRecipient, uint256 launchedAt, uint256 liquidityTokenAmount, uint256 lockedTokenDust)",
);

const launches = await client.getLogs({
  address: launchFactory,
  event: tokenLaunched,
  fromBlock: deploymentBlock,
  toBlock: "latest",
});
```

After decoding a launch:

1. read `getLaunchedToken(token)`;
2. require `exists` and matching token, pool, quote token, ordering, and tier;
3. read the pool's `token0`, `token1`, and `fee`;
4. register that pool for `Swap` logs;
5. register the token for `Transfer` logs when you need holders.

`TokenMetadataPublished` contains the immutable metadata needed for indexing.
Direct token getters remain the canonical fallback.

## Derive trade direction

V3 amounts use the pool's perspective. A positive amount entered the pool.

```ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
const tokenSigned = isToken0 ? amount0 : amount1;
const pairSigned = isToken0 ? amount1 : amount0;

if (
  tokenSigned === 0n ||
  pairSigned === 0n ||
  (tokenSigned > 0n) === (pairSigned > 0n)
) {
  throw new Error("invalid swap deltas");
}

const side = pairSigned > 0n ? "buy" : "sell";
const tokenAmount = tokenSigned < 0n ? -tokenSigned : tokenSigned;
const quoteAmount = pairSigned < 0n ? -pairSigned : pairSigned;
```

A buy sends quote tokens into the pool and launch tokens out. A sell does the
opposite.

## Lifecycle and revenue events

There is no migration event. Use:

* `GraduationCheckpointed` for the irreversible TGE checkpoint;
* `FeesAllocated` for exact team, reserve, fee-right, and compounding amounts;
* `FeesCompounded` for liquidity added to the original locked position;
* `FeeAllocationUpdated` for changes to the global collection policy;
* `AuctionSnapshot` and `FeeRightsPositionSnapshot` for indexer-complete
  fee-right state;
* `OrderFilled` and `OrderNonceCancelled` for terminal limit-order evidence.

Do not infer a fee allocation change from TGE. Read or index the locker policy
separately.

## Canonical event identity

Use this identity for every observation:

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
(chainId, transactionHash, logIndex, blockHash)
```

Treat pre-finality event data as provisional. A removed or replaced log is not
canonical evidence.
