⚡ Circleswap Live reads
The Quai DeFi dashboard: real-time pool analytics, constant-product swap math,
liquidity provision, and a chain-driven Farms & Pools page with an owner admin dashboard.
Source: q0/ · Route: /q0/
What it does
- Real-time stat tracking — on-chain metadata (
name,symbol,decimals,totalSupply) and live Cyprus-1 block numbers read directly over RPC. - Liquidity pool analytics — reserve ratios, token rates and balances
for the monitored pairs, including Q0 / WQUAI (
0x003B4b96...eEef8) and Q0 / BOSS (0x0036c1A5...7787). - Swap simulation & execution — output rates, slippage thresholds
and price impact from constant-product math (x · y = k) with a 0.3% pool fee. Execution
is direct-to-contract: a token
transfer()to the pair followed byswap()on the LP pair — no hardcoded router. - Explorer ledger — the latest token transfer events from Quaiscan, with top holder distribution.
Architecture
| Package | What it is |
|---|---|
apps/stats-app/ | React + TypeScript single-page dashboard on Vite; dark glassmorphism theme in vanilla CSS |
packages/quai-service/ | Shared ESModule service client wrapping Quai JSON-RPC, AMM swap formulas and explorer REST APIs |
Configuration: RPC https://rpc.quai.network/cyprus1, explorer
https://quaiscan.io/api/v2, target shard Cyprus-1 (Region 0, Zone 0; byte prefix
0x00).
Build and run
cd q0
pnpm install
pnpm build # compile the workspace
pnpm dev # local dashboard on http://localhost:4100/
Wallet and signing
Transactions are signed by your own wallet extension (Pelagus, MetaMask). Every app in the suite treats an injected wallet as untrusted input: a provider that throws or lacks events is reported as absent rather than allowed to break the page, and Circleswap shows a crash screen with details instead of a blank page.
Static-hosting behaviour
Neither the explorer's indexed stats nor Quainance's launchpad catalog send a CORS header,
so the hosted page does not request them: USD values come from pool reserves, and Hartii / POOP /
curve launches come from a snapshot taken at deploy time and labelled with its date. Token
metadata is unaffected: it uses the CORS-open /api/token/<address> endpoint
and the RPC.
Token metadata decoding is chain-first: decimals never come from the explorer and are never
defaulted to 0; icon URLs are resolved, TTLed and negative-cached. The gate is
node --test q0/packages/quai-service/test/tokenMetadata.test.ts.
q0/SECURITY_AUDIT.md is an internal, AI-assisted review —
not an external audit.