Wallet and ledger
The wallet is the single source of truth for money. Every bet, win, deposit, withdrawal and bonus movement is an append-only, double-entry ledger row. Balances are derived from the ledger, never stored beside it and hoped to agree.
- Integer money in minor units, in every service and every message
- Real-money and bonus-money balances kept separate, with per-bet settlement across both
- Idempotent settlement: a duplicate delivery of the same bet or win is a no-op, enforced by the database, not by application code
- Wagering progress updated on the same settlement path as the balance