Skip to content

feat: unified oracle debate with ore betting#18

Open
keanji-x wants to merge 1 commit intomainfrom
feat/unified-oracle-debate
Open

feat: unified oracle debate with ore betting#18
keanji-x wants to merge 1 commit intomainfrom
feat/unified-oracle-debate

Conversation

@keanji-x
Copy link
Copy Markdown
Collaborator

Summary

  • Unified debate system: Oracle-created debates and normal debates share one set of contract functions, MCP tools, and agent prompts — no separate prediction market
  • Ore betting on any debate: vote_debate now accepts optional ore_amount (0 = free vote, 10-500 = ore stake). Winners split losers' pool proportionally
  • Oracle agent: Ancient seer persona that creates prophecy debates about real-world events (web search) and in-game predictions (chain state), wrapped in fantasy narrative
  • Web search tool: Tavily API integration for Oracle to verify real-world outcomes

How it works

Feature Normal Debate Oracle Debate
Created by Any agent Oracle agent (auto-detected)
Duration 1 hour 4 hours
Voting Free or with ore Ore required (min 10)
Resolution Anyone, by vote count Operator only, Oracle verifies outcome
Happiness effect ✅ +10/-15 ✅ +10/-15
Ore settlement ✅ winners split losers ✅ winners split losers, 10% tax to Oracle
Expiry safety N/A 24hr grace → full refund

Files changed

  • contracts/src/GameEngine.sol — extended Debate struct + 8 new storage mappings + unified functions
  • contracts/test/GameEngine.t.sol — 7 new tests (normal free/ore, oracle lifecycle, limits, expiry)
  • mcp-server/src/chain.ts — updated debate ABI + methods with ore/oracle params
  • mcp-server/src/tools.ts — extended debate tools + web_search tool
  • mcp-server/src/web.ts — new Tavily API web search module
  • agent-runner/accounts.json — Oracle agent with seer persona + system prompt
  • agent-runner/src/orchestrator.ts — prediction timer (4hr nudge cycle)
  • agent-runner/src/llm.ts — updated prompts for ore betting + oracle debates

Test plan

  • forge test — 28/28 unit tests pass (including 7 new debate tests)
  • Contract size: 23,169 bytes (under 24,576 limit)
  • E2E on anvil: normal debate (free vote) ✅
  • E2E on anvil: normal debate (ore bet + refund) ✅
  • E2E on anvil: oracle debate (50 vs 100 ore → settlement + 10% tax) ✅
  • E2E on anvil: inbox notifications (debate_notice + prediction_notice) ✅
  • TypeScript compilation: mcp-server ✅, agent-runner ✅
  • Deploy to Gravity testnet: just gravity-upgrade + setOracleAgent

Deploy steps

just gravity-upgrade
# Start agent runner, then set oracle:
cast send 0x3e46E447c0a6088039CCa9b178748014bB6871CC \
  "setOracleAgent(uint256)" <ORACLE_AGENT_ID> \
  --private-key <KEY> --rpc-url https://rpc-testnet.gravity.xyz

🤖 Generated with Claude Code

Extend the debate system to support oracle-created prediction debates with ore
stakes, replacing the need for a separate prediction market. The Oracle agent
creates prophecy debates about real-world events (verified via web search) and
in-game predictions (verified via chain state). Agents vote with optional ore
bets; winners split the loser pool proportionally.

Key changes:
- GameEngine: extend Debate with ore betting fields, oracle flag, 4hr duration,
  10% tax, 24hr expire safety valve, proportional ore settlement
- MCP: add web_search tool (Tavily API), extend vote_debate with ore_amount,
  resolve_debate with outcome_override, unified inbox notifications
- Agent runner: add Oracle agent with seer persona, prediction timer in
  orchestrator, updated prompts for all agents
- Tests: 28 forge unit tests + anvil E2E covering normal debate, ore betting,
  oracle debate lifecycle, expiry refunds

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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