issues : 2
Great issue: Correct Non-Parimutuel Payout Logic
Description
The implementation in claim_winnings contains let winnings = bet.amount;, which only returns the user's original stake upon winning. The core value proposition of a prediction market—where winners split the pool of losers—is broken, leading to "trapped" capital (losers' stakes) that can never be claimed and removing all financial incentive for participation.
Requirements and context
- Implement pool-ratio based payout math:
winnings = (bet.amount * total_staked) / winning_outcome_stake.
- Ensure rounding favors the protocol (e.g., truncate down).
- Must be efficient and easy to review.
Suggested execution
- Fork the repo and create a branch:
git checkout -b fix/issue-2-payout-math
- Implement the parimutuel formula in the winnings calculation.
Implementation changes
- Update
bets.rs (around line 140) to calculate proportional winnings instead of returning the stake.
Test and commit
- Run tests with varied stake amounts to ensure correct distribution.
- Validate that the total balance of the contract remains consistent after all claims.
Example commit message
fix: implement parimutuel payout logic in claim_winnings
Guidelines
- Clear documentation for mathematical assumptions.
- Timeframe: 72 hours.
issues : 2
Great issue: Correct Non-Parimutuel Payout Logic
Description
The implementation in
claim_winningscontainslet winnings = bet.amount;, which only returns the user's original stake upon winning. The core value proposition of a prediction market—where winners split the pool of losers—is broken, leading to "trapped" capital (losers' stakes) that can never be claimed and removing all financial incentive for participation.Requirements and context
winnings = (bet.amount * total_staked) / winning_outcome_stake.Suggested execution
git checkout -b fix/issue-2-payout-mathImplementation changes
bets.rs(around line 140) to calculate proportional winnings instead of returning the stake.Test and commit
Example commit message
fix: implement parimutuel payout logic in claim_winnings
Guidelines