Repository navigation
fix(contracts): implement market resolution payout value conservation - #2073
Merged
Olowodarey merged 2 commits intoOct 20, 2026
Merged
Conversation
- Add compute_payout_breakdown() helper function with checked arithmetic - Update claim_payout() to use centralized payout calculation - Ensure payouts + fees == pool within documented tolerance (±N stroops) - Add comprehensive test suite with 9 test cases covering: * Value conservation verification * Single winner and multiple winners scenarios * Fully one-sided markets (all on winning side) * Edge cases: large stakes, small stakes, many winners * Batch distribution value conservation - Document implementation details and mathematical proof Resolves value conservation requirement where sum of all payouts plus fees must equal the market's total pool within rounding tolerance. Uses checked arithmetic throughout to prevent overflow. Files changed: - contracts/open-market/src/prediction.rs - contracts/open-market/tests/payout_conservation_tests.rs (new) - contracts/open-market/PAYOUT_CONSERVATION_IMPLEMENTATION.md (new)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@Toromo7 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! 🚀 |
- Removed duplicate function definition that was causing compile error - Added comprehensive documentation to the original function - Kept value conservation logic intact with checked arithmetic - Fixes: duplicate definitions compile error in prediction.rs
This branch had an error being deployed
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.
Resolves value conservation requirement where sum of all payouts plus fees must equal the market's total pool within rounding tolerance. Uses checked arithmetic throughout to prevent overflow.
Files changed:
closes #2029