Build real-time betting and casino game platforms with PubNub
Does it follow best practices?
Evaluation — 93%
↑ 1.52xAgent success when using this tile
Validation for skill structure
A sportsbook needs to build the post-placement lifecycle for bets: settling winning, losing, and voided bets, managing user balances, and offering live cash-out on in-play bets. When a match result is confirmed, the settlement engine must process all affected bets, update user balances, and notify each user in real time.
The platform supports single bets and accumulator bets with multiple selections. Accumulators are especially complex because a single voided leg changes the combined odds rather than voiding the entire bet. The settlement engine must handle this correctly.
For live bets, the platform also offers a cash-out feature that gives players the option to lock in a profit or minimize a loss before the event concludes. Cash-out values fluctuate with current odds and must be offered with a short validity window to avoid stale prices being accepted.
The balance system must reserve funds when a bet is placed and release or adjust them upon settlement, ensuring that the user's available and reserved balances remain consistent throughout the lifecycle.
Produce the following files:
settlement-engine.js -- A module that:
cashout-service.js -- A module that:
balance-manager.js -- A module that:
wager-lifecycle.js -- A module or set of constants/types that: