Hartii developer docs

HartiiLabs

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 TokenFactory deploys an EIP-1167 minimal-proxy clone of a LaunchToken (ERC-20) plus a BondingCurve for 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/Sell events, 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

ComponentWhat it doesWhere
ContractsTokenFactory, LaunchToken, BondingCurve — immutable, non-upgradablesee Contracts
IndexerScans factory/curve/token logs in 2000-block windows, writes D1functions/api/indexer-run.js, workers/indexer-cron/
D1 (HARTII_LABS_DB)Tokens, trades, holders, candles, burns, creator claims, indexer cursorCloudflare D1
KV (HARTII_LABS_KV)Hidden-token list, draft metadata, logo bytes, throttle stateCloudflare KV
Pages Functions APIThe public HTTP surface documented in API referencefunctions/api/**
Live push hubWebSocket fan-out of new trades/burns, LiveHub Durable Objectfunctions/api/live/**
FrontendThe hartiilabs.com SPA — the reference consumer of every endpoint belowsrc/

How data flows

  1. A wallet calls the factory or a curve directly (launch, buy, sell, graduate, withdraw creator fees) — see Contracts for the on-chain interface.
  2. The chain emits TokenLaunched (factory), Buy/Sell/Graduated/CreatorFeesWithdrawn (curve), and standard ERC-20 Transfer (token) events.
  3. 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.
  4. 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).
  5. 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 Transfer events, 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.)

Quai Network mainnet · chain 9 · Cyprus-1. Figures marked "read on" a date were read from the chain that day; re-read before relying on them.