Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
07. Pick leaderboard, streaks and rewards
Read docs/prompts/event-markets/README.md first.
The problem
People return to a market game for status and for a reason to keep calling. Without a leaderboard and a streak, a pick is a one-off and there is no reputation to build.
Build
Check for the contract in api/_lib/event-markets/. If absent, create the minimal seam from the README first.
- Scoring:
api/_lib/event-markets/scoring.js. A correct call earns points that grow with how unlikely the pick was at the time (use the odds at pick time from the picks log), so calling the favourite pays little and calling the upset pays more. Wrong calls cost the points staked, never below zero. Document the formula on the page and keep its constants in onedata/config. - Stats per account: calls made, hit rate, average odds at pick, best call, current streak, longest streak, season rank. Compute in the lifecycle cron or a rollup cron, idempotently, following
api/cron/leaderboard-rollup.js. GET /api/event-markets/leaderboard(season, all-time, per source kind) and/event-markets/leaderboardpage. Pin the viewer's own row likeapi/play/event-leaderboard.jsdoes. Accounts can show a wallet-derived name or their profile name, never a raw email.- Streaks and badges: award visible badges (first correct call, upset call, 5 in a row, season top 10) through the existing achievements system (
api/_lib/agent-achievements.jsand the account equivalent). Show them on profiles. - Rewards: seasons end with a published reward list. Rewards are denominated in
$THREEand platform perks. Computing the list is automatic; paying it is owner-gated (gate 1): produce the payout table (recipient, amount, token, chain) and stop for the owner's yes, using the existing payout rails. - Fairness: one account, one pick per market; block obvious multi-account farming with the account-age and linked-wallet signals already in the platform. Document what is checked.
Docs and wiring
docs/event-markets.md section "Scoring and seasons", data/pages.json, STRUCTURE.md, changelog entry tagged feature.
Acceptance
- Resolve a real market and see scores, streaks and badges update once, correctly, in the leaderboard.
- The season payout table is generated and the run stops at the confirmation gate.
- Tests cover the scoring formula edges (heavy favourite, upset, zero prior), streak reset and idempotent rollup.
npm testgreen.