Balance Modifiers

Balance modifiers are the logic of your coin economy. The configuration of a balance modifier defines how it will perform operations on account balances. Applied in sequence, balance modifiers can create complex behaviors. A sequence of one or more balance modifiers comprises an event.

Ledger entries are produced when balance modifiers are applied to the balance. All balance modifiers are subject to the ledger invariant, which states that the ledger must be balanced at all times. Maintaining a balanced ledger essentially means that the aggregate of all credits on the ledger must equal the aggregate of debits.

There are three classes of balance modifier: simple, advanced, and vendor.

  • Simple modifiers move a set number or percentage of coins between two or more accounts.
  • Advanced modifiers add additional flexibility by allowing the amount calculation to change based on parameters such as the requested transaction amount, time of day, or the amount of another coin used in previous operations.