game: admin /treasury — list and top up Bali place treasuries - #317
Merged
Conversation
Since #315 the engines never mint: a window pays out at most what its visitors staked plus what the place treasury already held. That closes the faucet, but it also means a place that has paid out its seed stays poor forever with no way to refill it. This is the budget line. /treasury lists every playable place, its pool and the total, marking places with no PlaceState document yet as unseeded so an operator does not top up a place that has simply never been played. /treasury <place> <amount> moves one pool. Capped at 1,000,000 per call because a fat finger here mints $CUBE into the game with no undo; negative drains and is floored at 0. This is now the only faucet into Bali and the only place $CUBE is created there, which is why it is admin-only, capped, and echoes the resulting pool. addToPool uses $inc so concurrent top-ups compose; the resolver still writes the pool with an absolute $set at a window boundary, so a top-up landing in that microsecond is lost — noted in the code, and the command echoing the pool is how an operator notices.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the second of the three open items in
docs/BALI_SPEC.md§4.Since #315 the Bali engines never mint — a window pays out at most
staked + pool. That closes the faucet, but it also means a place that has paid out its seed stays poor forever with no way to refill it. This PR is the budget line.The command
/treasury— every playable place, its pool, and the total. A place with noPlaceStatedocument yet is marked(unseeded)and reported at its seed, so an operator doesn't top up a place that has simply never been played./treasury <place> <amount>— moves one pool and echoes the result. Negative drains and is floored at 0.Admin-only, and capped at 1,000,000 per call: this is now the only faucet into Bali and the only place $CUBE is created there, so a fat finger has no undo. Larger budgets are several deliberate calls.
Notes
addToPooluses$inc, so concurrent top-ups compose. The resolver still writes the pool with an absolute$setat a window boundary, so a top-up landing in that microsecond is lost — flagged in the code, and the command echoing the resulting pool is how an operator notices. Not worth a transaction for a manual admin action that runs a few times a year.buildAdminChatCommandsso it shows up in the admin command menu.treasury-handler.test.tscovers the listing, top-up, drain-to-floor, unseeded fallback, the cap, and that no bad input ever reaches the database (6 tests).npm run lint && npm run typecheck && npm run test:backend && npm run smoke:api→ clean, 650/650.Still open after this: whether the minority places should get a real move — they currently have no move at all, so the name describes turnout, not strategy.