Vixen
c7401864
csharp
public sealed class EconomyIntent

An indivisible set of movements, named by a key that makes replaying it free.

Read the guide page for this →

Remarks

Doc 28: "every one of those is a ledger transaction with an idempotency key". A duplicated auction settlement, a retried mail claim and a trade confirmation that arrives twice are all no-ops the second time by construction, not by a check somebody remembered.

⚠ Balanced per asset, not overall. Summing every delta together would let a hundred gold leaving one account be paid for by a hundred ore arriving in another, which is a duplication bug with a receipt.

Fields and properties (3)

  • public string Key

    What makes replaying it free.

  • public ReadOnlySpan<AssetMove> Movements

    What moves.

  • public string Detail

    What it was.

Methods (3)

  • public EconomyIntent(string key, IEnumerable<AssetMove> movements, string detail = "")

    Makes one.

  • public bool IsBalanced()

    Whether every asset's movements sum to zero.

  • public static EconomyIntent Transfer(string key, EconomyAccount from, EconomyAccount to, DefId asset, long amount, string detail = "")

    A one-line transfer, which is most of what an economy does.

Used by (11)

  • SoakMmo.Soak
  • HousekeepingTestsVixen.Live.Gameplay.Tests
  • IEconomyLedgerVixen.Gameplay.Economy
  • KeyHorizonTestsVixen.Gameplay.Economy.Tests
  • LedgerBridgeVixen.Live.Gameplay
  • LedgerBridgeTestsVixen.Live.Gameplay.Tests
  • LedgerReleaseTestsVixen.Gameplay.Economy.Tests
  • LedgerTestsVixen.Gameplay.Economy.Tests
  • MemoryEconomyLedgerVixen.Gameplay.Economy
  • TradeSessionVixen.Gameplay.Economy
  • VendorTestsVixen.Gameplay.Economy.Tests