HartiiLabs
HartiiLabs (hartiilabs.com) is a pump.fun-style token launchpad on Quai Network. Anyone can launch an ERC-20 through a factory contract, trade it against a per-token bonding curve, and — once the curve sells out — have it graduate into an internal liquidity pool. Live in production on Cyprus-1 (chain 9) since 2026-07-05.
This section documents the developer-facing surface: the public HTTP API, how the indexer keeps it fresh, and integration recipes. Contract-level docs (ABIs, the bonding-curve math, how to launch a token from your own code) live in a separate set of pages — see Contracts for those; this section cross-links to them where relevant but does not duplicate them.
What it is
- A launchpad: a
TokenFactorydeploys an EIP-1167 minimal-proxy clone of aLaunchToken(ERC-20) plus aBondingCurvefor every new token. Buys and sells trade against the curve's constant-product (x*y=k) pricing until the curve sells out its allotted supply. - A graduation mechanism: sellout moves the token into an internal pool (never an external
DEX) that continues to emit the same
Buy/Sellevents, so indexing is continuous across the launch → graduate lifecycle. - A read API + frontend: every trade, holder balance, candle, and derived stat (trending score, 24h volume, burns) is indexed off-chain into D1 and served over a public, unauthenticated, CORS-open HTTP API — the same API the hartiilabs.com frontend itself runs on.
Components
| Component | What it does | Where |
|---|---|---|
| Contracts | TokenFactory, LaunchToken, BondingCurve — immutable, non-upgradable | see Contracts |
| Indexer | Scans factory/curve/token logs in 2000-block windows, writes D1 | functions/api/indexer-run.js, workers/indexer-cron/ |
D1 (HARTII_LABS_DB) | Tokens, trades, holders, candles, burns, creator claims, indexer cursor | Cloudflare D1 |
KV (HARTII_LABS_KV) | Hidden-token list, draft metadata, logo bytes, throttle state | Cloudflare KV |
| Pages Functions API | The public HTTP surface documented in API reference | functions/api/** |
| Live push hub | WebSocket fan-out of new trades/burns, LiveHub Durable Object | functions/api/live/** |
| Frontend | The hartiilabs.com SPA — the reference consumer of every endpoint below | src/ |
How data flows
- A wallet calls the factory or a curve directly (launch, buy, sell, graduate, withdraw creator fees) — see Contracts for the on-chain interface.
- The chain emits
TokenLaunched(factory),Buy/Sell/Graduated/CreatorFeesWithdrawn(curve), and standard ERC-20Transfer(token) events. - The indexer (
POST /api/indexer-run, bearer-gated, operator only) scans a bounded window of new blocks, decodes and sanitizes those logs, and writes tokens/trades/holders/candles/burns to D1 — with an advisory lock so overlapping runs can't double-apply holder deltas. Two triggers drive it: a Worker on a one-minute cron, and a traffic-driven fallback throttled to once a minute. See Indexer for the exact mechanics. - Every public API route reads from D1 (and a small KV layer for logos/hide state) — never from the chain directly on the request path. That keeps response times to a handful of milliseconds instead of RPC round-trips, at the cost of indexer lag (typically a few seconds to under a minute; see Indexer for freshness guarantees).
- New trades/burns also fan out over a WebSocket push hub for consumers that want live updates instead of polling.
Pages in this section
- API reference — every public route: tokens, trades, holders, wallet/portfolio, burns, ecosystem stats, media (logos/OG/badges), live push. Admin/indexer routes are documented at the auth-model level only.
- Indexer — what gets scanned, window sizes, the cursor/lock mechanism, how holder
balances are derived from
Transferevents, money-math rules, and what freshness a consumer can rely on. - Integration recipes — build a token list, a token page, a wallet portfolio, embed burn totals, polling/caching etiquette, CORS, rate limits.
Contract-side docs (owned separately): Contracts overview, Token factory, Bonding curve, Launching a token, Integrating the contracts. (Staking is present in the contracts source tree but not yet wired into a live factory — see the note in Contracts — so there is no staking page yet.)