fix: implement real parimutuel payout calculation in claim_winnings#339
Merged
hman38705 merged 2 commits intosolutions-plug:mainfrom Mar 27, 2026
Merged
Conversation
- Deduct protocol fee (calculate_tiered_fee) at bet placement time - Store net (post-fee) amount in bet.amount, total_staked, outcome_stakes - Parimutuel formula: winnings = (bet.amount * total_staked) / winning_outcome_stake - Fees are collected via collect_fee and withdrawable by admin - Referral rewards computed from actual fee charged - Resolve OracleConfig duplicate fields in types.rs - Add winner_counts and total_claimed fields to Market struct - Fix lib.rs: remove duplicate/broken function definitions, simplify initialize signature - Fix merge-conflict artifacts in bets_test.rs, test.rs, common/mod.rs - Fix integration_test.rs and lifecycle_test.rs call signatures - Update all affected test assertions to reflect net amounts Fixes solutions-plug#91 winners now receive proportional share of the net pool. Example: 10 users bet 100 XLM each, 2 win -> each receives 500 XLM (0% fee).
|
@oncleweynom 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #194
Fixes #91 winners now receive proportional share of the net pool. Example: 10 users bet 100 XLM each, 2 win -> each receives 500 XLM (0% fee).
Pull Request
📋 Description
Brief description of the changes in this PR.
🎯 Type of Change
🔗 Related Issues
Closes #(issue number)
Relates to #(issue number)
📝 Changes Made
🧪 Testing
Test Coverage
Manual Testing
Test Results:
📸 Screenshots (if applicable)
[Add screenshots for UI changes]
✅ Checklist
Code Quality
Documentation
Testing & Quality
cargo test)cargo clippy)cargo fmt)Security
Git
🔍 Reviewer Notes
[Any specific areas you'd like reviewers to focus on]
📊 Performance Impact
Details:
[Describe any performance implications]
🚀 Deployment Notes
[Any special deployment considerations, migration steps, or configuration changes needed]
📚 Additional Context
[Add any other context about the PR here]
By submitting this PR, I confirm that: