Skip to content

💰 Crafting — Currency Abstractions

This folder defines the currency integration seam for the Crafting system.

Currency support is optional in Crafting. If no currency adapter is provided, currency costs are ignored.


✅ Primary adapter

ICraftingCurrencyAdapter

Used by the Crafting service to: - query balances - attempt to debit currency - credit currency amounts

Normal failure should be reported via return values rather than exceptions.

Note: Credit has no success/failure return value. Implementations should avoid throwing for expected failure modes.


🛡️ Strong / escrow currency (optional)

ICraftingCurrencyHoldAdapter

An optional extension seam used by strong / escrow crafting.

Supports a two-phase model: 1. Hold (reserve currency) 2. Capture (commit the hold)

Correctness guarantees (atomicity, idempotency) are provided by the adapter implementation. The Crafting service relies on these guarantees but cannot enforce them.

CraftCurrencyHoldToken

A lightweight value representing a held currency reservation.

If this adapter is not present, crafting flows that require currency holds cannot run.