@@ -44,12 +44,9 @@ cancelling).
4444 the same outcome adds to the existing Bet, so there is exactly one per (outcome, bettor). The
4545 account exists only while the position is open: it closes (rent back to the bettor) via
4646 ` claim_winnings ` , ` claim_refund ` , or ` close_losing_bet ` , which is also what makes a second claim
47- impossible.
48- - ** User** (` seeds = [b"user", wallet] ` ) - a per-wallet index listing the bettor's open Bet
49- addresses, so a client can find someone's positions without scanning every Bet on the program.
50- ` place_bet ` adds an entry and every instruction that closes a Bet removes it, so the cap (see
51- ` MAX_BETS_PER_USER ` ) limits concurrent open positions, not lifetime bets. The fixed cap keeps the
52- account a constant size; the Bet accounts are the authoritative stake record.
47+ impossible. ` bettor ` is the first field after the 8-byte discriminator, so a client lists a
48+ wallet's open positions with ` getProgramAccounts ` and a ` memcmp ` filter on the wallet's address at
49+ offset 8. The program keeps no per-wallet index, so a wallet can hold any number of open bets.
5350
5451### The vault
5552
@@ -91,17 +88,14 @@ division floors each share, leaving at most a few minor units of dust in the vau
9188- ` open_betting ` - admin. Moves a ` Draft ` with at least two outcomes to ` Open ` , which fixes the
9289 outcome list.
9390- ` place_bet ` - bettor. Stakes tokens on one outcome of an ` Open ` event, before
94- ` betting_closes_at ` ; updates the pools and adds the Bet to the user's index (rejected with
95- ` TooManyBets ` if all ` MAX_BETS_PER_USER ` slots hold open positions).
91+ ` betting_closes_at ` ; creates or tops up the Bet and updates the pools.
9692- ` settle_event ` - admin. Once ` betting_closes_at ` has passed, resolves to a winning outcome, takes
9793 the fee, records the payout figures.
9894- ` claim_winnings ` - winning bettor. Withdraws stake plus pro-rata share of the losing pool, then
99- closes the Bet account and removes it from the user's index.
100- - ` close_losing_bet ` - losing bettor. After settlement, closes a worthless Bet to reclaim its rent
101- and free the slot in the user's index.
95+ closes the Bet account.
96+ - ` close_losing_bet ` - losing bettor. After settlement, closes a worthless Bet to reclaim its rent.
10297- ` cancel_event ` - admin. Voids a draft or unresolved market.
103- - ` claim_refund ` - bettor. After a cancellation, reclaims the exact stake; the Bet account closes
104- and leaves the user's index.
98+ - ` claim_refund ` - bettor. After a cancellation, reclaims the exact stake; the Bet account closes.
10599
106100### Lifecycle
107101
@@ -142,8 +136,8 @@ Tests are Rust integration tests running against
142136settle → claim with exact payout and fee assertions), admin authorization, the bet-after-settle and
143137double-claim guards, the outcome list locking when betting opens, the two-outcome minimum, both
144138edges of the betting close time, settling an outcome with no bets, the cancel/refund path, the
145- ` close_losing_bet ` guards, and the User index: claims, refunds, and losing-bet closes remove the
146- Bet's entry, and a wallet whose index is full can bet again after closing a position .
139+ ` close_losing_bet ` guards, and a wallet holding forty open bets at once, which shows there is no
140+ per- wallet cap .
147141
148142``` sh
149143anchor test
0 commit comments