Skip to content

Main#2

Closed
nzengi wants to merge 31 commits into
nzengi:mainfrom
sirius-labs-dev:main
Closed

Main#2
nzengi wants to merge 31 commits into
nzengi:mainfrom
sirius-labs-dev:main

Conversation

@nzengi

@nzengi nzengi commented Jul 20, 2026

Copy link
Copy Markdown
Owner

No description provided.

Nida and others added 30 commits July 18, 2026 20:57
Turns TornaDEX into an on-chain prediction market that settles trustlessly on
TxLINE's live football data, for the Superteam World Cup "Prediction Markets and
Settlement" track. Reuses the existing parallel CLOB unchanged; adds the
settlement half on top.

On-chain (orderbook/src/lib.rs):
- New instructions INIT_OUTCOME(7), MINT_SET(8), RESOLVE(5), REDEEM(6).
- Complete-set model (YES+NO minted 1:payout against quote collateral) keeps
  redemptions solvent.
- RESOLVE CPIs TxLINE txoracle validate_stat_v3 and reads the returned bool: the
  oracle verifies the Merkle multiproof against its own daily_scores_roots, so
  the outcome comes from TxLINE's published root, not the caller. The predicate
  (stat legs + comparison) is fixed in the res PDA at creation and the caller's
  proof leaves are bound to it — values from the caller, predicate from us.

Off-chain (demo/):
- TxLINE relayer + auth: guest JWT + on-chain subscribe + activation
  (txSig:leagues:jwt, nacl detached base64), REST client, SSE relay, API routes.
- Client ix builders + borsh validate_stat_v3 payload builder + PathPlanner reuse.
- bringup-prediction.ts stands up a settling market; SettlementPanel wires the
  live score strip + Mint/Resolve/Redeem into /trade.

Wire formats verified against txoracle IDL v1.5.6 and two independent community
SDKs. cargo build + tsc both clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- TORNALINE.md: technical documentation (core idea, settlement design, TxLINE
  endpoints used, architecture, build/run) for the Prediction Markets and
  Settlement submission.
- TXLINE_FEEDBACK.md: honest experience report with the TxLINE API.
- Brand the prediction-market surface (trade page hero + SettlementPanel) as
  TornaLine, built on Torna / TornaDEX.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Validated the whole TornaLine flow on devnet with real transactions:
- TxLINE activation (guest JWT + on-chain subscribe + activation) works; the
  reverse-engineered subscribe ix + activation signature are confirmed against the
  live API. (txline-activate: fix activate response is plain text, not JSON.)
- validate_stat_v3 direct simulation: payload accepted, ~187k CU (huge headroom
  under the 1.4M ceiling), correct bool. Binary proof fields are number arrays,
  already handled. (new scripts/txline-derisk.ts)
- Deployed the orderbook program to devnet and brought up a live prediction market
  bound to a real World Cup fixture (bringup-prediction: env overrides for program
  IDs + wallet; fix demo quote funding for BID escrow).
- End-to-end RESOLVE + REDEEM on-chain: resolved "NO won" from the real finalised
  proof (France 4-6 England), winning side redeemed from the vault.
  (new scripts/settle-test.ts)
- market.json now points at the live settling market.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Homepage now leads with TornaLine — the on-chain football prediction market
  settled on TxLINE proofs — and reframes Torna as "the engine underneath".
- SettlementPanel is consumer-facing: real team names (France vs England), a big
  live/final score, "YES = <home> to win", and prices explained as implied
  probability.
- Nav "Trade" -> "Markets"; market.json carries home/away/competition.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- SettlementPanel now shows a "Settlement receipt · verifiable" once resolved: the
  final score, the outcome, and links to the resolve transaction, the resolution
  account, and the txoracle program — the traceable, no-trust receipt the track
  explicitly values.
- Relabel the shared terminal for the prediction market: balances YES/USDC (not
  BASE/QUOTE), header "<home> to win" + "price = implied probability (0–100)".
- Fix the trade-form default price (103 -> 60) so it's inside a probability
  market's 0–100 range.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- New ImpliedOdds strip on the market: the market's own implied probability (the
  CLOB mid) next to TxLINE's demargined consensus odds — live while the match is
  in play, "closed" once it finishes. This is the "Prediction Market Viewer" the
  track calls for (implied probabilities off the real-time feed).
- Order book now renders prices as a percent (chance) in a prediction market.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nal to an 'Order book & live trading' section, trim the hero

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ok section around TornaLine

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e line

Replace the Torna 'engine underneath' + parallelism-benchmark sections with a
'Settled by proof, not by trust' 3-step how-it-works; fold the parallel-writes
point into a single football-framed line on the order-book section.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ion after the order book

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…l.app

Nav -> Home/Markets/Explorer + external 'Torna' link; homepage 'Go deeper' -> a
product-focused 'Explore & verify' (Explorer + link out to the Torna engine);
'built on Torna' mentions link to torna.vercel.app; repo link -> sirius-labs-dev.
Build/Docs/Research pages stay but are no longer surfaced in nav.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
On-chain (orderbook/src/lib.rs): INIT_GAME, INIT_PLAYER, PLACE_PICK, RESOLVE_ROUND,
SCORE_ONE. A game calls binary Hi-Lo on one TxLINE stat; RESOLVE_ROUND verifies
the stat via a TxLINE proof (trustless, reuses validate_stat_v3) and stamps
Higher/Lower; SCORE_ONE scores one player and mirrors their score to a Torna
leaderboard tree keyed by player, so N players commit to N different leaves in
parallel. Ranking is a cheap off-chain re-sort of the tree.

Client: gamePda/lbPda/playerPda/pickPda + ix builders + leaderboard decoder.
Scripts: bringup-fan (tree + game + players + picks) and fan-test (resolve +
score + scan). Proven end-to-end on devnet: 3 HIGHER pickers score 1, the LOWER
picker scores 0, off France's proven full-time goals.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- /fan page + FanGame: tap Higher/Lower on the next match stat, play as a demo
  fan, and watch a live leaderboard read straight from the on-chain Torna tree.
- /api/leaderboard scans the leaderboard tree and returns ranked players;
  /api/fan/round reads the game PDA for the open round + last outcome.
- fan.ts config + fan-actions (place a pick). Provably-fair framing throughout.

Live and working on devnet: the board shows the real scored players (3 HIGHER
pickers at 1pt, 1 LOWER at 0) from the on-chain game.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…scoring

fan-keeper watches the game's TxLINE stat; when it moves it RESOLVE_ROUNDs (with
a proof) and scores every player via parallel SCORE_ONE (Promise.all) — the loop
that keeps the leaderboard live during a match. bringup-fan takes GAME_ID/LB_TREE
env for fresh games. resolve_round no longer pins the stat period (a live game's
period varies round to round; the proof still binds the value). Proven end-to-end:
keeper resolved 0->4 HIGHER and scored 4/4 in one pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…cel.app/ keeps the market

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…it visibly moves

fan-replay places varied picks for the demo players each round, RESOLVE_ROUNDs with
a real TxLINE proof, and parallel-scores everyone — with one proof (value V) round 1
resolves HIGHER and later rounds LOWER, so varied picks reshuffle the board every
round. Proven: 5 rounds, the board reshuffled and streaks built/broke, all real
on-chain. Run it while recording /fan to demonstrate real-time responsiveness.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ent receipt

- Nav is now brand-aware: tornafan.vercel.app shows "TornaFan · live fan game" with a
  cross-link to the prediction market, tornaline keeps its market nav. Detected server-side
  from the host header (layout) plus the /fan pathname, so no client flash.
- /api/fan/round returns lastTx (the most recent RESOLVE_ROUND on the game PDA); FanGame
  renders it as a "verify round N on-chain ↗" link to the explorer — the fan-side analogue
  of TornaLine's settlement receipt, making the provably-fair claim clickable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… market

The shared footer leaked TornaLine's market config address onto the TornaFan page, where
"market" has no meaning. Footer now takes fanMode (from the host, like the nav) and shows
the game + leaderboard PDAs on the fan product; the market keeps book + market config. The
Torna engine address is shared by both.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- fan-live.ts: the kickoff tool. Drives the leaderboard during a REAL match with sequential
  live TxLINE proofs — each round places blind demo picks, waits for the next processed v3
  proof (a seq newer than the last), RESOLVE_ROUNDs with it, and parallel-scores. Nothing is
  faked: if TxLINE hasn't processed a proof for a new seq, it waits. (fan-replay stays the
  proven fallback for a finished fixture.)
- bringup-fan writes statLabel/home/away; FanGame shows "Spain vs Argentina" + the stat name
  when set, falling back to the fixture id. Backward-compatible with the existing game.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Tapping Higher/Lower a second time (or after a prior call) tried to re-create the
pick PDA, which reverts as custom program error 0x0 ("already picked") and surfaced a
raw "Simulation failed…" string. /api/fan/round now returns pickedBy (the demo players
with a pick for the open round, via getMultipleAccounts); FanGame disables the buttons
and shows "✓ You called round N — waiting for the next update" instead of firing a
reverting tx. The tap handler also friendly-catches the 0x0/already case as defense.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…s on Torna)

The root README now leads with the two hackathon products so a judge landing here
sees them immediately: TornaLine (Prediction Markets & Settlement) and TornaFan
(Consumer & Fan Experiences), with live links and one-liners, plus a pointer to
demo/README.md. demo/README.md is rewritten from the create-next-app boilerplate
into a full two-product writeup — what each is, how settlement works (the shared
TxLINE-proof core), the routes, the on-chain artifacts, and the TxLINE endpoints.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bringup-prediction is now env-configurable (MARKET_ID/ASK_TREE/BID_TREE/HOME_TEAM/
AWAY_TEAM/COMPETITION) and writes home/away/competition into the market config.
TornaLine now trades market 4 on fixture 18257739 — Spain vs Argentina, "OPEN ·
AWAITING FULL-TIME", Resolve-ready; it settles from the TxLINE proof at full time.
TornaFan runs a fresh game on the same fixture (Spain goals). The France v England
settled market stays proven on-chain and backed up as a fallback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The live market now trades the World Cup final (Spain vs Argentina), which settles
at full time. Below it, a "Settlement, already proven" card shows the France v
England market permanently settled on-chain (NO won 4-6) with resolve-transaction,
resolution-account and txoracle links — so a judge can verify the settlement
mechanism right now, without waiting for the final to end. Marquee match + the
track's differentiator (trustless settlement), both on one page.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The live game is on the World Cup final (Spain vs Argentina) and fills as it
plays. Below it, a "See it in action" panel shows the France v England game that
already ran to completion on-chain — its final standings, scored round by round
against TxLINE proofs, with a verify-on-chain link. /api/fan/proven reads that
game's leaderboard (fan.france.json) and it polls, so replaying it re-ranks the
board live. fan-replay takes FAN_CONFIG to drive that game. Marquee final + the
game demonstrably working (real-time, provably fair), both on one page.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ect)

Per the hackathon rule that each track needs a completely separate, distinct
project, this repo is now TornaLine only (Prediction Markets & Settlement). The
READMEs focus on the market + trustless settlement; TornaFan lives in its own
repo. Both build on the shared Torna engine, but are separate projects.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
TornaFan (Consumer & Fan Experiences) as its own separate, distinct project per
the hackathon's one-project-per-track rule. READMEs focus on the fan game + live
on-chain leaderboard. Built on the shared Torna engine; TornaLine is a separate
repo/project.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tornaline.vercel.app serves the market; tornafan.vercel.app serves the game. The
other product's route redirects to its own domain, so neither site exposes the
other — keeping the two hackathon entries visibly separate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… prob as a 0-1 fraction

The odds snapshot returns multiple market rows, but the route treated it as one object
(o.PriceNames.map -> 'undefined.map'), so the TxLINE-consensus number showed as 'closed'.
Now it selects the 1X2 participant-result market and returns the home-win probability as a
fraction, so the market card shows the live TxLINE consensus.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add TornaLine: TxLINE prediction-market settlement layer
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@nzengi is attempting to deploy a commit to the Asim's projects Team on Vercel.

A member of the Team first needs to authorize it.

@nzengi nzengi closed this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant