CurrencyLedger.V2 records every gameplay currency change as an immutable
transaction record. It builds on CurrencyDefinition.V2 so ledger behavior uses
the same currency ids, hard caps, and negative-balance rules as display and
authoring tools.
Runtime Surface#
FV2CurrencyLedgerRequestis the requested currency change. It requires a transaction id, account id, currency id, amount in minor units, source id, human-readable reason, timestamp, and transaction type.FV2CurrencyTransactionRecordis the auditable record written after validation. It stores source, amount, timestamp, reason, balance before, and balance after in the same object.FV2CurrencyTransactionLedgeris account-scoped and stores balance snapshots plus the immutable transaction records that produced those balances.FV2CurrencyLedgerAuditTrailfilters ledger records by account and currency and reports opening balance, closing balance, credits, debits, and all matching entries.FV2CurrencyLedgerValidationResultreplays the audit chain and verifies that balance snapshots still match the transaction history.
Audit Rules#
- Every applied transaction must have
TransactionId,AccountId,CurrencyId,SourceId,Reason,TimestampUnixSeconds, andAmountMinorUnits. TransactionIdvalues are idempotency keys. Duplicate ids are rejected before balance changes are applied.- Grants, transfer-ins, and refunds require positive amounts. Spends and transfer-outs require negative amounts. Adjustments can be positive or negative but cannot be zero.
- The ledger resolves
CurrencyIdthrough the currency definition catalog. Unknown currencies are rejected. - Currencies that disallow negative balances reject insufficient-funds spends. Reputation-style currencies can go negative only when the definition permits it.
- Hard caps from currency definitions are enforced before the transaction is recorded.
- Audit trails are generated from transaction records, not from the balance snapshot alone.
Validation Commands#
Run these checks when touching currency ledger behavior:
bash
python3 V2/ue/Tools/check-v2-currency-ledger.py
python3 V2/ue/Tools/check-v2-currency-definition.py
python3 V2/ue/Tools/check-v2-ci-workflow.py
python3 -m json.tool V2/ue/Content/V2/Gameplay/Economy/CurrencyLedger_V2_Contract.json
python3 -m json.tool V2/ue/Build/Horde/v2-buildgraph-job.json
python3 V2/tools/validate-v2-docs.py