Source docs:
docs/tasks/jul-28-verex.md(task spec) →docs/tasks/jul-28-verex-design.md(design written today).
All four tasks landed on claude/jul-28-features (11 feature commits, per the approved rev-2
design). Technical summary:
api/src/book.ts, Order table): off-chain book, price-time-priority matching in
one row-locked DB transaction (market-row lock + FOR UPDATE on crossable makers); resting
limit orders are EIP-712-signed at placement (they become makers), IOC taker sub-orders are
signed per fill at the maker’s exact ratio (ceil buys / floor sells) so
CTFExchange.matchOrders’ crossing checks pass and chain state mirrors the DB to 1e-6 dust.api/src/worker.ts): single serial in-process lane (= operator nonce
management), atomic PENDING→RUNNING claim, 5/25/125s backoff, stuck-RUNNING recovery,
per-fill idempotent settlement, terminal-failure compensation (fills reversed, groups
cancelled). FIFO order guarantees redeem never lands before its resolve.api/src/mm.ts): 5-level 1¢ ladders weighted 5:4:3:2:1 (≤2k tokens, asks
bounded by minted inventory). After each user fill, the traded market’s quote center follows
the last price and the group’s centers renormalize to Σ=1 — deterministic coherence, the
clean-room replacement for nostra’s ±5% arb-bot band.MarketGroup + N binary member markets (CTFExchange’s registry is structurally
binary). Seeded HR Derby (7), World Series (8), TIME PotY (6). Group endpoints, group resolve
(N payouts in one job), multi-series chart, selectable outcome rows, depth widget.api/src/group-create.ts, /create): solvency pre-flight, CREATING→OPEN
via CREATE_GROUP job (idempotent resume per member; failure deletes members + cancels the
group), operator funds L USDC/outcome (cap 1,000), Yes/No⇒standalone binary. Found live: the
seed’s exact-amount CTF allowance is exhausted at runtime — the job now tops it up./jobs/:id) on trade/resolve/redeem + activity badges;
/how-to guide with 6 sections and real screenshots (headless Chrome capture), including
faucet + checking results per jay’s request../scripts/reset.sh run — 10 binary markets + 3 groups, wallets #1–5
at 1,000 USDC.Explored verex + the nostra-server reference and wrote the full implementation plan into
docs/tasks/jul-28-verex-design.md (branch claude/jul-28-features). No code changes yet — the
task spec requires jay’s sign-off first.
CTFExchange’s registry (Registry.sol:41-51) stores exactly one complement per token and
enforces it on every fill — a single N-slot CTF condition is untradeable on our exchange. So
“who wins the World Cup” = N binary markets + a DB-only MarketGroup, same shape as Polymarket
grouped markets and the reference project.
nostra-server leaves group outcomes unnormalized (an arb bot merely keeps the sum inside ±5%) and its display price is a lifetime VWAP. Verex instead proportionally rescales the other outcomes after each trade so probabilities always sum to exactly 1 — simpler, always coherent, and a clean-room-different algorithm (also serves the copyright-differentiation requirement).
ChainJob queue; DB is the UX source of truthTrade/resolve/redeem answer instantly from the DB and the chain settles behind a status chip;
serial worker (concurrency 1) doubles as operator-wallet nonce management; atomic job claim
fixes the double-execution flaw observed in the reference’s queue. Supersedes the jul-22 doc’s
“job system would be over-engineering” stance — jay explicitly asked for server-side async.
Caveat for jay: the Cloud Run worker needs --no-cpu-throttling + min-instances 1 (cost).
jay reviewed the design doc inline. Big change: execution model switches from the existing
fillOrder maker/taker flow to a CLOB (order book) — “other platforms use CLOB”. Doc revised:
new Order table + price-time-priority matching engine (fills instant in the DB), on-chain
settlement via CTFExchange.matchOrders through the ChainJob queue, operator becomes a
ladder-posting market maker, and group Σ=1 now holds at the MM’s renormalized quote centers.
Also recorded: option (a) grouped binaries ✅, Cloud Run --no-cpu-throttling+min-instances 1 ✅,
anyone can create markets ✅, fee policy deferred to jay ✅.
(Source: jul-28-verex-design.md, jay’s inline comments.)
returned no data ("0x") — Sepolia addresses leaked into the local backboneseed.ts:51 loads packages/contracts/.env as a fallback, which still held
USDC_ADDR/CTF_ADDR/EXCHANGE_ADDR from the jul-22 Sepolia deploy (identical to the test
manifest in deployments.json). With all three set, the local seed took the “reusing backbone
from env” branch and called Sepolia contracts on a fresh anvil (no code → empty return data).
Fix: commented the three lines out (with a warning comment) — the seed now falls through to a
fresh forge deploy; verified ./scripts/reset.sh end-to-end (10 markets, app renders).
Note: the seed’s code-exists preflight only guards the test/prod manifest path — adding it to
the local env branch is a candidate hardening for the jul-28 branch.
(Source: jay’s failing ./scripts/reset.sh run, no task file.)
Split into first-time setup vs. daily start (anvil is in-memory ⇒ every restart requires
./scripts/reset.sh before using the app) and documented the stale-env-address gotcha above
with its exact error message and fix. (Source: jay’s request in conversation, no task file.)
Per jay: marked tasks 4 and 5 complete — task 4’s leftovers (#3 ResolvePanel optimism, #4 SSE)
are superseded by the jul-28 async-settlement design (Task C); task 5 is satisfied by the
committed deployments.json manifest + VEREX_DEPLOY_TARGET preflight; task 2’s domain gap
closed via Firebase Hosting (5278191, 9921e23).
(Source: jun-19-verex-design.md.)
Replaced the footer “powered by” image with jay’s profile avatar (from the rabbit repo):
old logo kept as jaylabs-old.png, avatar now jaylabs.png, layout.tsx unchanged in the end.
Verified in the browser. (Source: jay’s request in conversation, no task file.)
test → staging (docs first, then the technical id)jay renamed the pre-production environment to “staging”. First pass changed docs prose
only; jay then asked for the technical identifier too, across all scripts: the
deployments.json manifest key, VEREX_DEPLOY_TARGET, scripts/deploy.env,
deploy.sh/setup-chain-secrets.sh, and the api helper scripts (save-deployment,
check-deployment, gen-demo-mnemonic). Every entry point now fails fast on the old
test value with a rename hint, so a stale habit or env file can’t silently misfire.
GCP resource names are unsuffixed and unaffected.
(Source: jay’s requests in conversation, no task file.)
The working tree already had cosmetic hover/probability-bar changes to
packages/web/src/components/MarketCard.tsx from an earlier session; carried on the new branch
unmodified, kept separate from jul-28 work.