Pushed 1 commit to main
- 52d85e1 AI_USAGE.md: full workflow, division of labour, verification, and where the agent was wrong · Oluwatimothy

Quantum Pass
Every native AMM pool diagnosed, certified on chain with ML-DSA-87, and treated in one quantum-signed transaction.
Pool Doctor is a clinic for QoreChain's markets. It examines every pool in the chain's built-in exchange (the native AMM), works out what each token is really worth, and shows which pools are lying. On diana today it finds one critical patient: pool 1 (fETH/QOR) prices fETH about 1.3 million times above what the rest of the market says, because a dust amount of fETH sits against millions of QOR. What you can do with it: - Open the ward: all pools, live, each with a heartbeat trace that is its diagnosis (Stable, Watch, Fever, Critical, Flatline, or No second opinion). - Open a pool's chart: pool price, consensus price, deviation, depth, and its on-chain certificate. - Treat a sick pool: the Doctor prescribes a QOR → fUSD → fETH → QOR loop through healthy pools, every leg under the chain's 5% impact rule and re-checked with the chain's own quote engine. QoreX signs all legs as ONE hybrid ML-DSA-87 transaction. The last leg must return more QOR than went in or the chain cancels everything, so the healer cannot lose; the arbitrage profit is their fee. That is how markets correct themselves. - Verify certificates: every round the Doctor signs all diagnoses with one ML-DSA-87 signature, and the PoolDoctorLedger contract verifies it on chain with the pqcKeyStatus and pqcVerify precompiles. Any contract can ask isHealthy(pool, maxAge) before it trades. "Verify here" re-checks a round entirely in your browser. Live: https://pool-doctor-three.vercel.app Code: https://github.com/Oluwatimothy/pool-doctor (MIT)
Scaffolded with create-qorechain-dapp 0.14.0: web/ from the fullstack-web template (Vite + React + TypeScript) and contracts/ from the foundry template. Diagnosis engine (web/src/lib/engine.ts, shared by the app and the doctor's rounds): each pool is an observation log P(a) − log P(b) = log(rate). The engine fits one log-price per token, anchored at QOR, by weighted least ABSOLUTE deviations, weighted by each pool's depth in QOR. L1 is robust: a broken pool cannot drag the consensus, it just stands out. The optimum of an L1 fit on a graph sits on a spanning tree, and the pool graph is small, so the engine enumerates every spanning tree and keeps the best: exact, deterministic, no solver. Dust pools are Flatline; pools that are a bridge in the graph of deep pools get "No second opinion" instead of a guess. Treatment: constant-product math with the 0.30% fee, impact capped at 4.5% (chain rule: 5%), route as a QOR→…→QOR cycle through healthy pools, each leg's minOut chained into the next leg's input, the final minOut ≥ the QOR input. Every leg is re-checked with GET /qorechain/amm/v1/quote/exact_in. Sent with QoreX signAndBroadcast as 3 × MsgSwapExactIn in one hybrid-signed transaction (verified: 0C74A3C18A16060633EB6604C20A0C91280E209FA5441ADAFBE45844B3E05974). Certificates: PoolDoctorLedger (0xFeD2f625B8a24f70BD9C96BfAaefAF98aAbacb70) rebuilds the exact signed text on chain ("qorechain-msg-v1|qorechain-diana|" + round text, QoreSign message-signing-v1), reads the doctor's key with pqcKeyStatus (requires registered, ML-DSA-87, possessionProven), verifies with pqcVerify, and rejects replays and other chain ids. No owner, no upgrade. rounds.ts signs one round with pqcSign, checks its bytes against the contract's signedBytes(), dry-runs certify against the live precompiles, opens an EVM window by a hybrid-signed message scoped to the ledger only (1 tx, ~100 blocks), then relays. Kits and features: @qorechain/sdk (hybrid signing, pqcSign/pqcVerify, AMM message types, EVM window and key registration messages), @qorechain/evm, QoreX, pqcKeyStatus and pqcVerify precompiles, native AMM, fUSD/fETH test tokens, Foundry, viem. Tests: 25 Foundry tests (golden signed text shared with TypeScript, tampering, replay, chain id, key registry failures, inactive precompiles, fuzzing) and 19 vitest engine tests (robust fit, thresholds, no-loss prescriptions, impact cap). CI on GitHub. What was hard: the REST API sends no CORS headers (Vercel rewrite /lcd → REST); keeping signed bytes identical across TypeScript and Solidity; QoreX refuses messages it cannot display, so we confirmed it decodes MsgSwapExactIn before building; sizing multi-leg treatments under the 5% impact rule. AI use is documented in AI_USAGE.md.
Pushed 1 commit to main
Pushed 1 commit to main
Pushed 1 commit to main
Pushed 1 commit to main
Pushed 1 commit to main
Pushed 1 commit to main
Pushed 1 commit to main
Pushed 1 commit to main
Pushed 1 commit to main
Pushed 1 commit to main
Earned a Ship Weeks badge.
Earned a Ship Weeks badge.
Earned a Ship Weeks badge.
New project.