Engineering
Why casino software needs more than a balance column
Cash, bonuses and pending withdrawals behave differently. The wallet model should preserve those differences.

A single number hides too much
A player sees a balance, but the operator needs to know where the funds came from and what they can do next. A deposit, an active bonus and a pending withdrawal should not be interchangeable. If every event only changes a single total, reconstructing a dispute becomes difficult and cancellation logic can become fragile.
Model the state of the money
Racko separates cash available, locked cash, bonus, bonus winnings, withdrawal holds and compliance holds. Playable stakes use cash before bonus. A withdrawal is requested from cash; bonus balances do not become withdrawable merely because the interface can display them. Keeping these categories explicit gives support a better explanation for what a player is seeing.
Move value instead of rewriting history
The supplied implementation uses an append-only double-entry ledger in integer minor units. Each posting must balance, and a tenant-scoped idempotency key prevents the same event from being posted twice. Integer arithmetic avoids representing wallet amounts as approximate floating-point values. The readable balance is a view of those movements, not the only record of them.
A pending withdrawal is still a state to account for
When a withdrawal request is created, its amount and fee move into a hold. Approval, payment and cancellation are distinct actions. Cancellation releases held funds; marking a payout paid requires a separate permission. This model lets an operator investigate a queue without confusing money awaiting review with money already sent.
Confirmation comes from the payment flow
For NOWPayments, Racko credits a deposit from the payment notification rather than trusting a browser redirect. A success page is useful feedback, but a player opening a URL is not evidence of funds arriving. The same reasoning applies throughout the product: reconcile payment intents, ledger entries and provider events. A balanced ledger is a strong accounting foundation, but monitoring and operational reconciliation still need attention.