feat: implement market comment API with pagination, thumbs-up, and ad…#644
Merged
Hahfyeex merged 2 commits intoHahfyeex:Defaultfrom Mar 30, 2026
Merged
Conversation
|
@Grace-CODE-D 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.
…min moderation
Automated Market Settlement Logic (#11)
Description
Implements the automated market settlement logic that processes an Oracle's "Result" and calculates winning shares with precise fixed-point arithmetic.
Changes
New Files
contracts/prediction_market/src/settlement_math.rs- Settlement math module with fixed-point arithmeticdocs/math_spec.md- Mathematical specification and payout formula documentationModified Files
contracts/prediction_market/src/lib.rs- Addeddistribute_rewards()andget_settlement_info()functionsKey Features
Fixed-Point Arithmetic
Payout Formula
Dust Handling
The implementation ensures 100% conservation by redistributing dust (remainder from integer division):
dust = payout_pool - sum(payouts)Market State Transition
resolve_market()transitions market from Locked → Resolveddistribute_rewards()executes payout calculation and transfersTesting
All 15 tests passing:
test_platform_fee- 3% fee calculationtest_payout_pool- 97% payout pool calculationtest_basic_payout- Single and multiple bettor scenariostest_exact_division- Cases with no dusttest_dust_redistribution- Dust handling verificationtest_zero_winning_stake- Edge case handlingtest_large_amounts- Real XLM amount simulationtest_conservation_property- All payouts sum to payout_poolDocumentation
See
docs/math_spec.mdfor:Related Issues
Closes #635