Step-by-step breakdown
Use Case 1 — how each payment event updates payment method limits and withdrawal caps.
Select a use case from the sidebar.
Cashier preview
Use Case 2 — what the player sees when opening Cashier (calculated in memory, not saved until withdrawal is confirmed).
How limits are calculated at Cashier open
When the player opens Cashier, STEPs 1–3 and 9 run in memory only — nothing is written until they confirm a withdrawal. 1. Read the last saved payment event (one DB read). 2. game_result = available_balance − prev.wallet_after 3. free_win_before = MAX(0, prev.free_win_after + game_result); apply ledger_burn (STEP 3) if total_burn > 0 4. limitAmount(X) = ledger(X) + free_win_after; remainingLimit(X) = MIN(available_balance, limitAmount(X)) The player sees remainingLimit(X) for each instrument before choosing one.
| instrument | ledger | free_win_after | limitAmount | remainingLimit |
|---|---|---|---|---|
| No ledger history yet. | ||||
game_result: 0 · free_win_before: 0
Calculation steps at Cashier open
- read last journal row
one DB read · no write until WD confirm
no prior events · = 0 · free = 0
No prior payment events — starting from zero.
- STEP 1 · game_result
−
0 − 0 = 0
STEP 1 at Cashier — activity since last payment.
- STEP 2 · free_win
MAX(0, + )
MAX(0, 0 + 0) = 0
STEP 2 at Cashier — free winnings before payment.
- STEP 3 · total_burn
MAX(0, −( + ))
MAX(0, −(0 + 0)) = 0
STEP 3 — total loss to allocate across instrument ledgers.
- remaining_burn
=
= 0
STEP 3 — loss not yet allocated. Reduced as each ledger_burn(j) is applied.
- ledger_burn loop
= 0 → skip
= 0 → skip loss-burn loop
STEP 3 — no loss to allocate. Ledgers unchanged.
- STEP 9 · limits
MIN(, limitAmount(X))
—
STEP 9 — max withdrawal to instrument X = its ledger + shared free_win_after.