Repository navigation
betting-market: describe the Draft state and the betting close time - #165
Merged
Merged
Conversation
added 2 commits
September 22, 2026 23:35
The companion program now starts every event as a Draft, fixes the outcome list with open_betting() before any bet can land, and stops bets at a betting_closes_at fixed at creation, with settlement allowed only after it. The chapter, the offchain-truth and operating chapters, and the fundamentals intro now describe that design and why a status beats locking the list at the first bet. The figures gain open_betting() in the program box, the event's close time, and a Draft state in the state machine. They also stop naming create_event() and default_fee_bps, which never existed: the handler is initialize_event() and the config field is fee_bps. Claude-Session: https://claude.ai/code/session_01F8Wo5zNLqZ2NQqSjGD7WpK
Main moved the betting chapter's account descriptions to the steps that create them and restored default_fee_bps, which the companion repository now ships as the config's field name. The Draft state, open_betting() and betting_closes_at are carried into that structure, and the figures' config boxes say default_fee_bps again. Claude-Session: https://claude.ai/code/session_01F8Wo5zNLqZ2NQqSjGD7WpK
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.
Merge after quicknode/solana-program-examples#154. This PR names
open_betting(),betting_closes_at,EventNotDraft,NotEnoughOutcomes,CloseTimeInPast,BettingClosedandBettingStillOpen, which exist only on that PR's branch until it merges.Summary
The companion program now starts every event as a Draft.
open_betting()fixes the outcome list before any bet can land, bets stop at abetting_closes_atfixed at creation, and settlement is allowed only at or after that time. Before this, the outcome list was locked implicitly by an empty-pool check. That let anyone freeze a half-built market with a one-minor-unit bet, and bets were accepted until settlement ran, even after the result was public.Changes
initialize_event()(with a close time),add_outcome()twice, thenopen_betting(). New text explains why an explicit Draft status beats locking the list at the first bet. The chapter coversBettingClosedandBettingStillOpenand the four states, adds an invariant and a "betting on a known result" failure mode, and lists the new tests.open_betting()transition.open_betting()to the program box, and the right column shifts down 10 units to make room.betting_closes_at.create_event()handler that doesn't exist; it now saysinitialize_event().check-figure-geometry.mjsexception for the place-bets arrowhead moves with that arrowhead (470,601 to 470,611).Verification
npm run lint,node scripts/check-figure-geometry.mjs(99 figures) andnpm run build-pdfall pass on the merged head.🤖 Generated with Claude Code
https://claude.ai/code/session_01F8Wo5zNLqZ2NQqSjGD7WpK