Feat/issues 1035 1036 1037 1038 - #1168
Merged
Ehonrie merged 3 commits intoJul 28, 2026
Merged
Conversation
…fee_recipient validation - Store admin, fee_bps, and fee_recipient addresses - Validate fee_bps does not exceed 1000 basis points (10%) - Prevent re-initialization after initial setup - Add helper functions to retrieve fee_bps and fee_recipient - Add comprehensive tests for initialization scenarios
…ayout calculation and read-only views Issue Netwalls#1035: Verify Market::claim_winnings implementation - Already properly implemented with auth verification - Status validation for Resolved markets - Duplicate claim prevention - Payout calculation with fee deduction - Re-entrancy guard via claimed flag before transfer - Event emission for winnings_claimed Issue Netwalls#1036: Implement Market::calculate_payout - Pure view function for payout estimation - Handles zero losing pool without division-by-zero - Uses checked arithmetic throughout - Returns stake if no one bet on the side - Properly calculates proportional share of net pool Issue Netwalls#1037: Implement Market read-only views - get_market_data: Returns complete Market struct - get_user_bet: Returns specific bet for address or None - get_pool_totals: Returns pool_a, pool_b, total_pool tuple Fixes: - Remove duplicate code from get_bets_by_address function
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.
Summary
Implement Market payout functionality and Treasury initialization for the Stellar betting protocol.
Changes
Treasury Contract
Treasury::initialize()with fee configuration validationMarket Contract
Market::calculate_payout()pure view function for payout estimationget_market_data(),get_user_bet(),get_pool_totals()claim_winnings()implementation completenessTesting
All implementations include comprehensive test coverage for normal paths and edge cases.
Closes