Skip to main content

Prediction Game Wiring Map

Execution coordinates for the engineering agent. All paths relative to the implementation worktree.

Pages

ScreenRouteFilePattern to Copy
Match List/predictionsBLOCKER — new app, path TBDExisting NX app page structure
Prediction Form/predictions/{matchId}/predictBLOCKER — new app, path TBDForm patterns from CRM deal create
My Predictions/predictions/mineBLOCKER — new app, path TBDList patterns from CRM contact list
Match Detail/predictions/{matchId}BLOCKER — new app, path TBDDetail patterns from CRM deal detail

Components

ComponentFileServes (Screen Contract ref)
FixtureCardBLOCKER — new componentMatch List — fixture card element
OutcomeSelectorBLOCKER — new componentPrediction Form — outcome radiogroup
PoolDistributionBLOCKER — new componentMatch Detail — pool chart, Prediction Form — pool meter
PredictionCardBLOCKER — new componentMy Predictions — prediction card element
StatusBadgeBLOCKER — new componentMy Predictions — status badge element
ZkLoginButtonBLOCKER — new componentPrediction Form — auth prompt

Infrastructure

Move Modules

ModulePurposeKey TypesDependencies
game.moveGame registry, fixture lifecycleGameRegistry (shared), Fixture (shared)sui::clock, sui::event
prediction.movePrediction creation, state machinePrediction (owned), PredictionReceipt (owned, Display)game.move, sui::display
oracle.moveResult submission, hot potatoOracleResult (no abilities), OracleCap (owned)game.move, sui::clock
treasury.movePool accounting, settlement, payoutsTreasury (shared), Pool (owned by fixture)prediction.move, oracle.move
leaderboard.moveSeason tracking, rankingsSeason (shared), LeaderboardEntry (owned)prediction.move
season.moveSeason lifecycle, competition configSeasonConfig (shared)game.move
admin.moveAdmin capabilities, manual overridesAdminCap (owned)All modules

Backend Services

LayerFilePurpose
Gas StationBLOCKER — new serviceSponsor user PTBs, manage SUI balance, enforce daily caps
Oracle AgentBLOCKER — new serviceFetch match results from sports API, submit on-chain with attestation
zkLogin SaltBLOCKER — depends on Sui zkLogin infrastructureManage ZKP salt for OAuth → address derivation

Frontend Integration

LayerFilePurpose
dApp Kit providerBLOCKER — new app rootSui network config, wallet adapter, zkLogin setup
PTB composerBLOCKER — new libCompose multi-step PTBs for predict, settle operations
Sponsored tx signerBLOCKER — new libRequest platform co-signature for gasless transactions

Existing Tests

TypeFileCovers (Story/Build ref)
Move unit testsBLOCKER — within each .move fileS3 (settlement), S5 (oracle safety)
Integration testsBLOCKER — new test directoryS2 (full predict flow), S3 (full settle flow)
E2E testsBLOCKER — Playwright in new appS1 (browse), S2 (predict), S4 (history)

Seeds and Fixtures

Test Data Required

  • 5+ fixture objects in GameRegistry with varying states (upcoming, live, settled)
  • 10+ prediction objects across fixtures for settlement testing
  • Oracle capability object for test oracle agent
  • Admin capability object for override testing
  • SUI balance in gas station wallet for sponsored transactions

Test Accounts

  • Admin: holds AdminCap and OracleCap
  • Oracle agent: holds OracleCap (separate from admin in production)
  • Test users: 3+ zkLogin accounts for prediction testing
  • Gas station: funded account for sponsoring transactions

Implementation Guardrails

  • Use @mysten/dapp-kit for all Sui interactions — do not use raw RPC calls
  • Follow existing Move package structure from packages/ directory
  • All multi-step operations must use PTB composition — never sequential transactions
  • Hot potato pattern for OracleResult — no store, copy, or drop abilities
  • Clock guard on all time-sensitive operations — use sui::clock::timestamp_ms()
  • Dynamic Display for prediction receipts — template resolves from object state
  • Sponsored transactions for all user-facing PTBs — user never pays gas
  • Pool accounting must enforce: sum of payouts <= total pool (no inflation)
  • Error codes: 100s for game.move, 200s for prediction.move, 300s for oracle.move, 400s for treasury.move
  • Do not create alternate domain terminology — use spec naming (fixture, prediction, pool, receipt)