Hartii developer docs

HartiiLabs

Arbitrage scanner

Every 20 minutes (started by the market maker's one-minute schedule) a Cloudflare Worker (hartii-labs-arb-scanner) prices every token that trades on two or more vetted Quai venues and records which price gaps would pay after fees and gas. When a gap clears the profit gate, a gated executor can trade it from Hartii's market-making signer. Every evaluation is public.

The Dapp Book

The scanner only reads venues listed in the Dapp Book (src/data/dappBook.json), built from a read-only scan of the Quai ecosystem on 2026-10-06: 19 venues, 9 AMM factories, 84 pairs, 94 Hartii curves and 176 tokens, each venue rated:

RatingMeaningExamples
AHartii-owned or verified, simple AMMHartiiSwap, Hartii curves, Hartii NFT markets, OTC Link
BThird-party AMM, behaviour-checked (not audited)Quainance, QuaiSwap, Reserved, WQUAI
CSmall or opaquefour small AMMs, Bazarr, a launcher
XDo not touchWQI (no proven redeem path), Quasdaq contracts

Only A/B AMMs and Hartii curves can be executed. WQI and tokens whose owner can mint (bridged USDT, SOON) are excluded. New pairs in a factory are only reported until the book is reviewed.

How a route is priced

For each token, the scanner tries every ordered pair of venues: buy with QUAI on one, sell everything on the other back to QUAI (two legs, QUAI-anchored; no 3-leg routes). It reads live reserves in one batched request and uses each venue's exact integer maths — AMM x·y=k with its fee, Hartii graduated curves' pool, and pre-graduation bonding curves (limited by remaining and sold supply). The size is the exact profit-maximising amount under every cap.

net = proceeds − input − gas, where gas covers every leg (plus an approval if needed) at the live gas price × 1.2.

The profit gate

A route trades only when net ≥ max(2 × gas, 10 QUAI). Venues shallower than 100 QUAI, price gaps over 100% and unreadable quotes are blocked outright. At ~50k gwei one swap leg costs ~10–15 QUAI, so most gaps on Quai today are too small to pay — the scanner records them and waits.

Worked example (6 Oct 2026). QISM traded about 70% cheaper on HartiiSwap than on its Hartii bonding curve. Buying 320 QUAI of QISM on HartiiSwap and selling it into the curve returned 422.3 QUAI; after gas the treasury signer made +87.8 QUAI. The next scan showed the gap closed.

Limits

  • One route per run, at most 6 executions a day.
  • 800 QUAI per trade and 1,500 QUAI per day (buy-leg spend), shared with the QAXE market maker.
  • The two bots share one signer claim, so they can never sign at the same time.
  • A 2% daily-loss stop counts every mined transaction's gas, failed legs included.
  • Right before each leg it re-reads and re-quotes, and aborts if the edge disappeared; slippage floor is the exact quote minus 0.5%.
  • The signer is a hot key that holds the trading funds directly (no vault).

Public API

EndpointReturns
GET /api/arb/latestThe latest scan (block, gas price, counts) and its top 10 routes
GET /api/arb/opportunities?limit=&passing=1Routes with an edge (up to 200); passing=1 only those that cleared the gate

Both are read-only and cached for 60 seconds. Amounts are in QUAI.

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.