The economy cookbook
22 working economies, ready to apply.
Every pattern is a self-contained bundle of manifest primitives — instruments, account types, valuation rules and Starlark sagas — that solves a whole business problem. Copying a pattern into your tenant is the deployment. They're also browsable inside the live demo, where you can see each one's account graph before you run it.
Stripe Payment via Financial Gateway
End-to-end Stripe payment saga via the Financial Gateway. Resolves the party's default payment method, reserves funds with a lien, dispatches to Stripe through the typed financial_gateway.dispatch_payment API, posts double-entry ledger entries on webhook confirmation, and executes the lien to finalize the debit.
Stripe Payment Gateway
Stripe payment integration via the Financial Gateway. Includes payment rail configuration, Financial Gateway dispatch for typed payment APIs, and a multi-step saga with gateway dispatch and double-entry ledger posting.
Tote (Parimutuel) Betting Platform
Syndicate-based parimutuel betting with pooled stakes, equal-entry bets tracked as voucher instruments, market-data-driven settlement, 15% platform commission, and Stripe Connect payouts via the Financial Gateway.
Carbon Credit Registry
Carbon credit trading and retirement with verified emission reductions (VERs) and certified emission reductions (CERs). Tracks credit provenance by vintage year and project, with a permanent retirement account for irrevocable credit retirement.
Dividend Distribution
Org-scoped syndicate dividend distribution saga. Lists all active participants, retrieves each participant's allocation share via structuring data, resolves their org-scoped account via composite account references, and credits each participant's position proportionally.
Dunning Escalation
Progressive dunning escalation saga for handling payment failures. Escalates through three levels: first notice (level 1), second notice with retry scheduling (level 2), and final warning with account freeze and freeze notification (level 3). Each level sends a templated email via correspondence service.
Dunning Unfreeze
Account unfreeze and payment retry saga triggered when a party updates their payment method on a frozen account. Unfreezes the account, resolves the updated payment method, reserves funds with a new lien, retries the gateway payment, and sends a resolution confirmation. Compensation re-freezes the account if the retry fails.
Payment Order Execution
Orchestrates the complete payment order flow: reserves funds via a bucket-aware lien, sends the payment to an external gateway, posts double-entry ledger entries on webhook confirmation, and executes the lien to finalize the debit. Steps 3 and 4 are conditionally invoked via webhook callbacks.
Dynamic Capacity Pricing
Self-referential feedback loop pricing for compute tokens. Bills token consumption at rates derived from the platform's own utilisation forecasts per data centre region. Usage patterns drive pricing, and pricing shapes usage patterns.
Entity Hierarchy Distribution
Distributes value across a party hierarchy based on structuring data (allocation shares). Triggered by market data events, traverses the party organization graph to find participants and their payout ratios, then books proportional position logs for each participant.
Prepayment Energy Billing (PAYG)
Complete prepayment energy billing model with no-standing-charge block tariff, emergency credit, debt recovery waterfall, DCC smart meter integration, and MHHS-ready half-hourly settlement. Two-tier pricing (First Rate / Saver Rate) with VAT at top-up (HMRC Reg 86).
Phantom Cost Basis Adjustment
Adjusts cost basis for all holdings of an instrument when a corporate action occurs. Handles phantom events where no cash or units move but the tax position changes, such as accumulating ETF dividends. The cost basis account position log serves as the HMRC audit trail.
Precious Metals Trading
Precious metals trading platform with event-triggered valuation. When gold, silver, or platinum positions are captured, an event-driven saga automatically books the GBP settlement value at the current spot rate from LBMA/LPPM price fixes.
SaaS Compute Billing
Usage-based billing for cloud compute resources. Meters GPU hours, API calls, and storage consumption, then converts to USD charges via valuation rules. Includes platform credits as a voucher instrument.
Time-of-Use Energy Pricing
Extends energy settlement with temporal pricing awareness. Values kWh consumption at dynamic rates that vary by settlement period (half-hour), using forecast-derived price curves from Market Data. Peak, off-peak, and overnight rates are resolved from the event timestamp.
Current Account Deposit
Multi-step saga for depositing funds into a current account with double-entry ledger posting. Logs a CREDIT position in position keeping, initiates a booking log, posts DEBIT to clearing and CREDIT to customer account, then finalizes the booking to POSTED state.
Reconciliation Adjustment
Ledger correction saga triggered when a reconciliation variance is resolved. Initiates a booking log for the adjustment, posts DEBIT and CREDIT entries to correct the ledger imbalance, and finalizes the booking to POSTED. Follows the immutable ledger pattern - compensation creates reversal entries rather than rolling back state.
Current Account Withdrawal
Multi-step saga for withdrawing funds from a current account with double-entry ledger posting. Logs a DEBIT position in position keeping, initiates a booking log, posts DEBIT to customer account and CREDIT to clearing account, then finalizes the booking to POSTED state.
Energy Usage-to-Value Settlement
Converts metered kWh into monetary value using market rates. Creates retail and wholesale GBP positions from energy consumption.
KYC Compliance Workflow
Initiates KYC verification when an individual party is created. Uses the compliance marker pattern: books a zero-amount position log to track outstanding KYC obligations per jurisdiction. Compliance accounts are resolved via entity graph traversal.
Base Fiat Currency (GBP)
Foundation instrument for British Pound Sterling. Provides GBP instrument with standard 2-decimal precision.
Base Fiat Currency (USD)
Foundation instrument for United States Dollar. Provides USD instrument with standard 2-decimal precision.
Don't see your economy?
Patterns compose — and the manifest format is constrained enough that an AI assistant can draft a new one in conversation. Or we'll help you write it.