feat(admin): operations console, fees wired into payouts
Fees now flow through settlement. The payout and the deduction are posted as separate ledger transactions rather than netted, so a player's history shows the full win and the charge as itemised lines instead of a quietly smaller win. The admin console shows treasury, liability, revenue, every posting, every round, and risk flags. Auth is a constant-time token compare and the surface is not mounted at all unless ARCADE_ADMIN_TOKEN is set, so a default deployment has no admin endpoint to attack. The token lives in browser memory only. It is read-only over game outcomes by design: seeds show only after settlement and nothing can alter a crash point. A control that could would make the fairness proof a lie. The console immediately found a real bug: 343 unresolved rounds, because the reconciler only considered rounds with bets and abandoned empty ones accumulated forever, burying the signal. Now cleared automatically. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
9
migrations/0005_fees.sql
Normal file
9
migrations/0005_fees.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
-- Fee breakdown per bet, so a settled round records not just what was paid but
|
||||
-- what was deducted and why. The ledger already carries the money; this makes
|
||||
-- the split queryable for reporting without re-deriving it.
|
||||
|
||||
ALTER TABLE bets ADD COLUMN rake_msat BIGINT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE bets ADD COLUMN rounding_msat BIGINT NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE bets ADD CONSTRAINT bet_fees_non_negative
|
||||
CHECK (rake_msat >= 0 AND rounding_msat >= 0);
|
||||
Reference in New Issue
Block a user