Feature/bet placement#214
Merged
greatest0fallt1me merged 3 commits intoJan 23, 2026
Merged
Conversation
- Add Bet, BetStatus, and BetStats types - Implement BetManager for bet placement and management - Add BetStorage for persistent bet data - Implement BetValidator for comprehensive validation - Add BetUtils for fund locking/unlocking - Implement BetAnalytics for probability calculations - Add bet placement and status update events - Prevent double betting on same market - Add comprehensive test suite (28 tests, 4 unit tests passing) - Add extensive inline documentation Security features: - User authentication via require_auth() - Atomic fund locking with bet creation - Double betting prevention - Comprehensive validation (market state, amounts, outcomes) - Reentrancy protection via Soroban design Validation rules: - Market must be active and not ended - Bet amount: 0.1 XLM (min) to 10,000 XLM (max) - Valid outcome selection required - One bet per user per market Implementation details: - 893 lines of production code in bets.rs - 822 lines of test code in bet_tests.rs - Full NatSpec-style documentation - Modular architecture with clear separation of concerns Note: Integration tests require token transfer configuration in test environment. Core bet logic verified via unit tests.
- Introduce BetRegistryKey to prevent collision with Market storage - Fixes ConversionError in bet placement tests - All 28 bet placement tests now passing
Contributor
Author
|
@greatest0fallt1me please review |
greatest0fallt1me
self-requested a review
January 23, 2026 05:28
Martinsandre007
pushed a commit
to Martinsandre007/predictify-contracts
that referenced
this pull request
Mar 27, 2026
…-initialization fix: pre-initialize outcome stake map during market creation.
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.
Add full bet lifecycle support with secure placement, validation, storage, and fund handling.
Closes #198
Changes
Add Bet, BetStatus, and BetStats types
Add BetManager for bet placement and double-betting prevention
Add BetStorage with BetRegistryKey to prevent key collisions
Add BetValidator for market, outcome, and balance validation
Add BetUtils for atomic token transfers and fund locking
Implement place_bet() with require_auth()
Add AlreadyBet error and BetPlaced event
Add comprehensive test suite (28 tests)