polycratia

The moment a ledger ships its own Money class, your system has two money types.

One from your currency library. One from the ledger. Every posting becomes a conversion at the boundary, and every conversion is a place where scale, rounding, or currency can quietly change.

In the payment systems I have built — per-user account ledgering, attribution by requisites, reconciliation against what the bank actually settled — the bugs that take longest to find are almost never in the arithmetic. They live in the translation layer nobody thinks of as logic.

So I stopped letting the ledger define money. A ledger needs exactly three things from a value: an exact amount, a currency, and arithmetic that obeys the rules of that currency. That is a protocol, not a class. Anything that satisfies it can be posted.

One money type per system, owned by the currency library, consumed by the ledger.

The trade-off is honest: you give up having the ledger validate money for you, and you take on making your own type correct. I would rather get one type right than keep two in sync forever.

Where does your system convert between money representations today — and do you know every place it happens?

https://polycratia.com/c/c9290dd5

react

$ new-project --brief

or email hey@polycratia.com