feat(rust): Economics — pay coins, balances, staff adjust, the richest (PLAN_REDESIGNS §11.2) #40
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/protocol-14-economics"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What & why
The site half of
PLAN_REDESIGNS.md§11.2.2 on protocol 14 (spec:docs/rust-link/PROTOCOL.md§20.3).The step:
rust.coins.pay("Pay coins").risk: 'irreversible',reversible: 'none'(D335), likeuo.item.grant.rust.kit.entitle, includinglinked, with one payment per website user (D103's rule).{amount}and goes by chat or popup.rust.coinsbudget: the amount times the count, or times the recipient bound.repeatand pays nobody twice.Balances.
rust_player_wipe_stats.balanceisDECIMAL(14,2) NULLand is written as a value, never summed.nameis an offline player's. Its balance is written without moving anybody's last-seen.economics.wipedclears the wipe's balances afterecowipe, and leaves them alone at a new save.The richest.
sort=balance.richesttitle category, Magnate, is added.Routes.
GET /player/rust/economicsreads live, falls back to the last known balance, and lists servers without Economics with the reason.GET/POST /admin/users/:id/rust/economicslets staff deposit, withdraw or set.Client.
How it was tested
npm test --prefix server: 535/535, 14 of them new intest/economics.test.js. They cover the value write, the offline frame, the wipe rule, the D336 SQL, the step's payee rules, repeat and retry, the price, and the staff refusals. Three inventory tests were updated.check:imports,check:bundle,check:swagger(fragment regenerated, 77 paths) andcheck:engagementall pass.npm test74/74 (acoinsformatter test is new),check:externalsclean.ca7ec53):routes.manifest.jsonregenerated (87 routes, all documented) and--checkpasses. The real core registered the module with 8 actions and 6 budgets, so it acceptedrust.coins.payandrust.coins.Six points the design left open were settled here. They are listed in docs PLAN_REDESIGNS §11.2.4 so they can be overruled:
newSave, the nameless-frame rule, the Coins column being per wipe, thefailedreasons, separate key namespaces, and therust.coinsbudget.Checklist
AI-assisted contributions (required)
Claude Code (Claude Opus 5.5). I have reviewed and understandevery change, and take responsibility for it. AI-authored commits are
marked with a
Co-Authored-By/Assisted-Bytrailer.License
(GNU GPL v3.0 or later), and I have the right to contribute it.
🤖 Generated with Claude Code
https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
The site half of §11.2.2, on protocol 14: - `rust.coins.pay` ("Pay coins"): irreversible, reversible none (D335). The recipient modes of rust.kit.entitle including `linked`, one payment per website user (D103's rule), an optional message with {amount}, a new `rust.coins` budget. Refused with "Economics is not installed on this server" in the dry run too (D199). Core's key goes to the plugin, so a retried step answers `repeat` and pays nobody twice. - `rust_player_wipe_stats.balance`: the tally's balance, written as a value. A nameless balance frame (an offline player) moves nobody's last-seen. `economics.wiped` clears the wipe's balances, except at a new save. - The richest: a Coins leaderboard column on one wipe of a server that reports Economics, `sort=balance`, and a `richest` title category (Magnate); both rank only above the starting balance (D336). - GET /player/rust/economics (live, falling back to the last known), and GET/POST /admin/users/:id/rust/economics for staff — scoped to the user's own links, keyed per submission, an activity row with before and after. - Client: the account page's Coins, the admin user page's Coins panel with its form, the leaderboard column, and Economics in the server's mod line (saying when its config could not be read). Server 535/535 (14 new in test/economics.test.js), client 74/74, routes.manifest regenerated against the pinned core (87 routes), swagger fragment regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY