Skip to content

feat(contract): support multi-outcome (categorical) markets (#1329) - #1489

Merged
Olowodarey merged 4 commits into
Arena1X:mainfrom
AJ0070:fix/1329
Jul 28, 2026
Merged

feat(contract): support multi-outcome (categorical) markets (#1329)#1489
Olowodarey merged 4 commits into
Arena1X:mainfrom
AJ0070:fix/1329

Conversation

@AJ0070

@AJ0070 AJ0070 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Extends the market model to support multi-outcome (categorical) prediction markets with 2 to N mutually exclusive named outcomes bounded by a configurable maximum cap.

Key Changes

  • Configurable Outcome Ceiling: Added DEFAULT_MAX_OUTCOMES (10) constant and max_outcomes: u32 to global Config. Implemented set_max_outcomes admin setter on the contract.
  • Market Creation Bounds: Enforced in market::create_market that params.outcomes.len() must be between 2 and cfg.max_outcomes. Creation reverts with InsightArenaError::InvalidInput if outcomes exceed the ceiling or fall below 2.
  • Per-Outcome Pool & Staking Tracking: Updated accumulate_outcome_pools to seed all outcome options declared on the market with initial zero stakes, ensuring complete per-outcome visibility in get_outcome_distribution and get_market_stats.
  • Resolution & Pro-Rata Payouts: Guaranteed resolution to exactly one valid outcome symbol from outcome_options and pro-rata distribution of the total market pool to winning stakers while strictly conserving total funds.
  • End-to-End Tests: Added 3-way, 5-way, and max-outcome validation tests to market_tests.rs.

Acceptance Criteria Checklist

  • A market can be created with 2–N outcomes and resolves to exactly one.
  • Payout to winners is pro-rata and conserves the total pool.
  • Creation reverts if outcomes exceed the configured maximum.
  • Tests cover 3-way and N-way markets end to end.

Related Files

  • config.rs
  • market.rs
  • prediction.rs
  • storage_types.rs
  • lib.rs
  • market_tests.rs

Resolves #1329

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
insight-arena-4rll Ready Ready Preview, Comment Jul 28, 2026 4:59pm

@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@AJ0070 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Olowodarey

Copy link
Copy Markdown
Collaborator

@AJ0070 pls fix CI

@AJ0070

AJ0070 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@Olowodarey Can you please trigger the CI tests again?

@Olowodarey
Olowodarey merged commit 6f7a797 into Arena1X:main Jul 28, 2026
4 checks passed
@AJ0070

AJ0070 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@Olowodarey Are there any other issues which I can take up?

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.

[Contract] — Multi-Outcome (Categorical) Markets

2 participants