Economy
pkg/online/economy is the provider-neutral wallet core for server-owned balances. It validates versioned currency definitions, applies caps, rejects insufficient spends, and makes grants, spends and exchanges idempotent with caller-supplied keys. Wrap it in a records-backed transaction and expose it through a service that authorizes player reads/spends separately from server grants.
Amounts must be positive (ErrInvalidAmount otherwise). Replaying an idempotency key with the same operation, currency and amount returns the first result without changing anything; reusing it for a different change is ErrDuplicateKey. A grant past a currency's cap or past the largest int64 is ErrCapExceeded.