Skip to content

RevFramework – Sample Scene: 00_Currency_Basics

Goal

Teach the core currency interaction loop:

Resolve ICurrencyService → mutate balances → inspect CurOpResult → optionally inspect audit.


What This Scene Demonstrates

This scene shows how to interact with the currency system through the public API.

The flow is:

Owner → ICurrencyService → Credit / Debit / Set → CurOpResult

  • All mutations go through the resolved service
  • The service defines behaviour (including policy and authority)
  • Results are returned explicitly via CurOpResult
  • Optional capabilities (audit, batching, escrow) depend on the composed service stack

The service result is truth.


What To Look For

Use the CurrencyBasicsPanel as a direct view into the service.

  • Setup tab

  • Owner selection defines which wallet is being mutated

  • Service binding shows whether ICurrencyService is resolved
  • Capabilities reflect what the current service stack actually supports

  • Balances tab

  • Each row maps: CurrencyDefinition → CurrencyId → service call

  • Credit / Debit / Set call the service directly
  • Result feedback shows Success, Code, and Message

  • Audit tab

  • Shows recent entries only if the service supports audit reading

  • Confirms whether Reason / SourceId metadata is preserved

Sample Scope

This scene covers:

  • Basic wallet mutations (Credit / Debit / Set)
  • Service resolution and owner binding
  • Result inspection via CurOpResult
  • Capability detection from the active service

This scene does NOT cover:

  • Policy/cap preview or deep validation behaviour
  • Exchange, escrow, batching, or idempotency flows
  • Persistence or replay systems

Those are taught in dedicated scenes.


Authority Note

This scene may include a permissive sample authority setup so it runs without additional configuration.


Networking Reminder

RevFramework does not include networking.

For multiplayer projects, currency mutations must be validated and executed through your own authority and networking layer.


How To Use

  1. Enter Play Mode.
  2. Toggle the CurrencyBasicsPanel with F8.
  3. In Setup:

  4. Ensure an owner is selected

  5. Confirm ICurrencyService is resolved
  6. In Balances:

  7. Enter a value and press + (Credit), - (Debit), or Apply (Set)

  8. Observe the returned result
  9. In Audit:

  10. Check for recorded entries if audit is supported


Failure Behaviour

Failures are returned through CurOpResult.

Common causes:

  • Service missing

  • No ICurrencyService resolved

  • Fix: add or publish a currency service

  • Owner missing

  • No wallet owner selected

  • Fix: assign an owner or tag a player

  • Invalid CurrencyId

  • Definition is misconfigured

  • Fix: correct the CurrencyDefinition

  • Authority rejected

  • Mutation blocked by authority rules

  • Fix: provide a valid authority path

  • Policy or caps applied

  • Result may be clamped or rejected

  • Fix: inspect service configuration or use Policy/Caps scene

Behind The Scenes

The panel uses only public Currency APIs:

  • ICurrencyService

  • GetBalance

  • Credit
  • Debit
  • SetBalance

  • CurOpResult

  • Success

  • Code
  • Message

  • Optional capabilities:

  • ICurrencyAuditReader

  • ICurrencyAuditEvents
  • ICurrencyBatchEvents
  • ICurrencyEscrow

Service resolution is performed via CurrencyResolve.


Key Takeaway

Currency interactions are service-driven.

You select an owner, call the service, and trust the returned result.

Everything else — UI, audit display, helpers — exists to make that flow visible.