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:

  • Runtime/Systems/Economy/Adapters/Currency/index.md

🚫 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 UX 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 best-effort and side-effect free
  • 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