Skip to content

Hardcoded Payout Ratio in claim_winnings #194

@hman38705

Description

@hman38705

Description
claim_winnings (Line 140) contains a simplified placeholder: let winnings = bet.amount;. This completely breaks the parimutuel nature of the platform, as winners only receive their initial stake back rather than a share of the total pool. It also results in the contract accumulating stuck funds from losing bets with no way to distribute them.

Requirements and context

  • Implement the parimutuel payout formula: (bet_amount / winning_outcome_stake) * total_net_pool.
  • Ensure all funds from losing bets are correctly distributed to winners.

Suggested execution

  • Fork the repo and create a branch: git checkout -b fix/issue-91-parimutuel-distribution
  • Implement the weighted payout logic.

Implementation changes

  • Modify bets.rs (Line 140) to calculate the proportional share of the market pool.

Test and commit

  • Verify that if 10 users bet 100 XLM each and 2 win, each winner receives 500 XLM.

Example commit message
fix: implement real parimutuel payout calculation in claim_winnings

Guidelines

  • Economic model correctness.
  • Timeframe: 48 hours.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions