PAR-286
[chestshop] Collapse the internal currency event bus into an EconomyService (TreasuryApi boundary)
Replace ChestShop's internal "Bukkit events as middleware" economy layer (the Currency*Event fan-out routed through TreasuryListener) with a direct EconomyService — ChestShop's single TreasuryApi boundary, the treasury-api-style internal API. Genuine cross-plugin event integration points (AccountQuery/AccountAccess) stay as events.
Staged, money-path-critical — each step ships independently and is smoke-tested:
- Step 1 (done): Stood up EconomyService (@Singleton, bound the live TreasuryApi in TreasuryListener.prepareListener, reached via ChestShop.economy()). Collapsed CurrencyFormatEvent — the zero-money display-formatting event — fully: Economy.formatBalance + ShopInfoListener call economy.format() directly; removed the TreasuryListener handler, the EconomyAdapter abstract method, and deleted the event.
- Step 2 (next): deposit()/withdraw() — collapse CurrencyAdd/SubtractEvent (ShopService fee/refund), moving resolveAccountId + idempotency + the ServerAccountCorrector admin→server normalization into the service.
- Step 3: the validators' CurrencyCheck/Amount/Hold (MoneyChecker, AmountAndPriceChecker, PartialTransactionModule).
- Step 4: the big one — CurrencyTransferEvent settle + tax (TransactionService), then retire ServerAccountCorrector/EconomyAdapter and the dead events.
Resources
- commitdfd7531 Collapse AccountCheckEvent; the economy event bus is fully gone (PAR-286)ParadauxIO/hibernia-economy
- commit910505e Settle trades via a direct EconomyService transfer; kill CurrencyTransferEvent (PAR-286)ParadauxIO/hibernia-economy
- commitf5cdad7 Collapse the currency query events into EconomyService (PAR-286)ParadauxIO/hibernia-economy
- commit2981d67 Collapse CurrencyAdd/SubtractEvent into EconomyService.deposit/withdraw (PAR-286)ParadauxIO/hibernia-economy
- commit314682b Stand up EconomyService; collapse CurrencyFormatEvent (PAR-286)ParadauxIO/hibernia-economy
Comments
tesks · Jun 26, 2026, 9:01 PM
Steps 1–3 done + pushed to develop:
- Step 1 (314682b): EconomyService stood up; CurrencyFormatEvent collapsed.
- Step 2 (2981d67): deposit/withdraw — CurrencyAdd/SubtractEvent collapsed (ShopService fee/refund), with idempotency + admin-shop normalisation folded in.
- Step 3 (f5cdad7): hasFunds/getBalance/canHold — CurrencyCheck/Amount/HoldEvent collapsed (MoneyChecker, AmountAndPriceChecker, PartialTransactionModule). ServerAccountCorrector now only normalises the transfer; EconomyAdapter down to onAccountCheck + onCurrencyTransfer.
Net so far across steps 2+3: ~-1000 lines. Five internal currency events deleted.
Remaining — Step 4 (the core trade money path, highest risk): collapse CurrencyTransferEvent (TransactionService settle + tax) into EconomyService.settle(...), reproducing TreasuryListener.onCurrencyTransfer (2–3 TreasuryApi transfers + rollback + TaxApi rate tax) and the ServerAccountCorrector partner normalisation; collapse AccountCheckEvent. Then retire ServerAccountCorrector + the EconomyAdapter base + TaxModule, and the TreasuryListener resolution-helper duplication. Recommend a smoke test of steps 2–3 (creation fees, refunds, affordability, partial fills) before doing the settlement core.
tesks · Jun 26, 2026, 9:22 PM
Done — internal currency event bus fully removed. Steps 1–4 + final AccountCheck collapse, all on develop:
- 314682b format, 2981d67 deposit/withdraw, f5cdad7 check/amount/hold, 910505e settle (direct buyer→seller transfer) + kill CurrencyTransferEvent, dfd7531 hasAccount + delete the events/economy package.
EconomyService is now ChestShop's single TreasuryApi boundary: format / deposit / withdraw / hasFunds / getBalance / canHold / hasAccount / settle. Seven internal events deleted (CurrencyTransfer/Add/Subtract/Check/Amount/Hold/Format + AccountCheck) plus EconomicEvent; deleted ServerAccountCorrector and TaxModule; TreasuryListener reduced to the genuine Business/Treasury integration (AccountQuery/AccountAccess/sign-migration). Trade settlement is now one direct buyer→seller transfer (atomic, no SYSTEM hop) — admin shops still use SYSTEM as money sink/source. AccountQuery/AccountAccess stay as events (real cross-plugin integration points).
Smoke test recommended across the money path (create/break shops, fees, refunds, buy/sell incl. can't-afford + partial fills, admin shops, business shops, tax) before release.
Activity
- tesks commented
- tesks changed status to Status → Pending Release
- ParadauxIO linked a commit — Commit dfd7531 — Collapse AccountCheckEvent; the economy event bus is fully gone (PAR-286)
- ParadauxIO linked a commit — Commit 910505e — Settle trades via a direct EconomyService transfer; kill CurrencyTransferEvent (PAR-286)
- tesks commented
- ParadauxIO linked a commit — Commit f5cdad7 — Collapse the currency query events into EconomyService (PAR-286)
- ParadauxIO linked a commit — Commit 2981d67 — Collapse CurrencyAdd/SubtractEvent into EconomyService.deposit/withdraw (PAR-286)
- ParadauxIO linked a commit — Commit 314682b — Stand up EconomyService; collapse CurrencyFormatEvent (PAR-286)
- tesks created the issue