feat(economy): add /bank vault (rob-proof storage) + net-worth leaderboard

A strategic counterpart to /rob: coins moved to the bank are safe from /rob and
/heist (which only touch liquid balance) but earn no Bot Farm interest and can't
be spent, gambled or given until withdrawn - the deliberate trade-off against
keeping coins liquid.

- New bank.py (do_deposit/do_withdraw), bank_balance schema field.
- /bank (view), /deposit, /withdraw commands ('all' supported), with db_error
  handling; /balance shows the vault when non-zero.
- Coins leaderboard and /status money-supply now count net worth
  (balance + bank_balance), so banking never hides you from the board or the
  supply metric.
- Season reset wipes bank_balance too (no cross-season wealth hiding).

10 tests: deposit/withdraw math, guards, coin conservation, rob cannot touch the
vault, and net-worth accounting on the leaderboard + stats.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VbAVsrZuYesea99mPMmPT
This commit is contained in:
Rene Arumetsa
2026-09-04 02:53:14 +03:00
parent 417617175e
commit 42bbdbd93d
12 changed files with 264 additions and 10 deletions

View File

@@ -114,7 +114,8 @@ HEIST_JAIL = timedelta(hours=1, minutes=30)
# User schema
# ---------------------------------------------------------------------------
class UserData(TypedDict, total=False):
balance: int
balance: int # liquid coins - spendable, gamblable, robbable
bank_balance: int # vaulted coins - safe from /rob and /heist, not spendable until withdrawn
exp: int # lifetime EXP (resets each season)
last_daily: str | None
last_work: str | None
@@ -177,6 +178,7 @@ class UserData(TypedDict, total=False):
def _default_user() -> UserData:
return {
"balance": 0,
"bank_balance": 0,
"exp": 0,
"last_daily": None,
"last_work": None,