RevFramework: Currency & Economy¶
RevFramework: Currency & Economy delivers a complete, production-grade financial and gameplay economy layer for Unity:
- Currency System — balances, policies, audit, authority, escrow, idempotency, batch events
- Economy Layer — shops, crafting costs, rewards, atomic rollbacks
- Adapters — inventory-backed money, item-store abstraction, exchange, awaiters
Every system is fully SOLID, adapter-friendly, prefab-free, and designed for C# developers who want correctness, clarity, and predictable behaviour — not monobehaviour soup.
If you can't code, don’t buy this
This SKU is a developer toolkit, not a drag-and-drop template.
Economy requires Currency
- Currency is the foundational system and can be used on its own.
- Economy is built on top of Currency and requires it.
- If you don’t need high-level economy flows, you may safely remove the Economy system.
- Using Economy without Currency is not supported.
Multiplayer & netcode
Currency & Economy are authority-aware and netcode-agnostic systems. They do not include networking, replication, or transport layers.
You are expected to integrate your own netcode (NGO, Mirror, Fusion, custom).
What’s Included¶
Currency System¶
A robust, extensible financial engine with:
- Credit / Debit / Set / Transfer
- Overflow-safe operations
- Min/max Policy Caps (Clamp or Fail)
- Authority layers (SP/MP)
- Escrow with TTL expiry pump
- Idempotency (RID-based replay protection)
- Audit trail (per-owner ring buffers)
- BatchEvents (single callback per commit)
- Async Awaiters & coroutine versions
- CurrencyTxn: staged atomic transactions
- Exchange engine (rates, fees, rounding)
- UI Bars for UGUI/TMP/UITK
- Persistence helpers (capture/restore by StableId)
Economy Layer (Built on Currency)¶
High-level gameplay flows built on top of the currency engine:
- ShopService — Buy/Sell with full rollback
- CraftingService — cost → ingredients → result
- RewardService — money + item bundles
IValueLedger— policy-aware money abstractionIItemStore— inventory-agnostic item interfaceEcoOpResult/EcoOpCode— clean domain resultsEcoSource— canonical vendor|rid tracking
All operations are atomic, policy-aware, and rollback-safe.
Adapters & Bridges¶
Modular integration layers including:
- InventoryItemStore — wrap any inventory into an item store
- Inventory-backed currency (“coins as items”)
- Currency ↔ Inventory ↔ Crafting compatibility
- Prefab-free, adapter-safe architecture
Everything plugs in cleanly — no hidden singletons, no cyclic dependencies.
Teachable Panels (Interactive Learning)¶
This SKU includes Teachable Panels — live, Editor-side tools that run the real API:
- Currency Basics
- Policy Caps
- Escrow
- Idempotency
- Exchange
- Batch Events & Transactions
- UI Bars + Nudger
- Awaiters
- Persistence + Audit
- Economy Quickstart (currency-only)
- Economy + Inventory (rollback visualiser)
These act as a live debugger for your currency and economy setup.
👉 Full breakdown in the companion Teachable Panels document.
Why This SKU Matters¶
- Financial correctness — no double spending, no phantom items
- Atomic operations — consistent buy/sell/craft/reward flows
- Robust rollbacks — reverse-order fixups + refunds
- Audit-ready — sourceId + reason + deltas for every operation
- Policy-aware — caps, clamping, fail rules
- Idempotent — safe for retries, networking, backend calls
- Extensible — adapters for items, inventory, crafting, pickups
This is not a toy store system
This is a real economy foundation.
Documentation & Learning¶
This SKU ships with:
- 📄 Folder-level
README.mdfiles (auto-generated into MkDocs) - 🎓 Teachable Panels (editor-driven debugging)
- 🎮 Sample scenes
- 🎥 Matching YouTube tutorials — Currency and Economy
- 🔧 Fully commented runtime code
- 🔌 Inventory & Crafting adapters
Everything uses the same naming, structure, and terminology.
Who This Is For¶
- Developers comfortable with C#
- Teams needing a reliable currency/economy layer
- Games with shops, crafting, rewards, item flows
- Projects requiring correctness & rollback safety
- Programmers who want clarity and control
Not a visual scripting kit.
Not a UI template.
Getting Started¶
- Add a SceneCurrencyService
- (Optional) Add a CurrencyServiceBootstrap for caps/audit/idempotency/escrow
- Open the Currency or Economy Teachable Panels
- Test real API behaviour live
- Integrate the systems you need
- Expand with inventory, crafting, or pickups if desired
Tests¶
This SKU is covered by adversarial and behaviour-pinning tests — there is more test code in RevFramework than runtime code.
The suite is not bundled in the package (your Test Runner shouldn't fill with framework tests you didn't ask for), but it is a free download for owners. Useful if you extend the framework or want a regression net around your own changes.
See Testing for what it covers and how to get it.
Related Modules¶
This SKU works standalone or alongside:
- RevFramework: Inventory, Pickups & Crafting
- RevFramework: Health & Status Effects
- RevFramework Complete
All built with consistent architecture and workflows.