Skip to content

Economy — Internal — Adapters — Currency

Purpose

This folder contains the internal Currency-backed implementations used by Economy to provide an IValueLedger over an ICurrencyService (optionally policy-aware).

Namespace: RevGaming.RevFramework.Economy.Internal.Adapters.Currency Folder: Runtime/Systems/Economy/Internal/Adapters/Currency/

Public-facing behaviour documentation lives in:

  • Documentation/Economy/PublicAPI/

Not for Production Use

Types in this folder are internal implementation details

They should not be referenced from gameplay code or relied upon as stable APIs.


What Lives Here

Currency-backed IValueLedger

The built-in ledger implementation is an internal adapter that:

  • Passes sourceId to underlying currency operations
  • Uses escrow-first behaviour when available, otherwise falls back to direct debit with best-effort rollback
  • Uses shared normalization and policy computation between CanPay() and Pay() / Grant()

Policy computation helpers

Internal helpers compute effective debits under a CurrencyPolicy to help keep behaviour consistent across:

  • Preflight checks
  • Authoritative debits
  • Rollback paths

Result mapping

Currency operation results are mapped into Economy outcomes (EcoOpResult / EcoOpCode) so higher layers do not depend on currency result types.


Important Notes

Implementation expectations

  • CanPay() is side-effect free. A true is advisory, but a false cancels the transaction
  • Pay() / Grant() are authoritative and may attempt rollback on partial failure
  • sourceId is passed to underlying currency operations when available
  • Currency-layer failures are mapped to Economy failure codes without exposing currency-specific types

  • Economy — Abstractions
  • Economy — Facade
  • Economy — Adapters
  • Economy — Diagnostics