No silent failures: Arithmetic operations throw on overflow/underflow instead of clamping. This surfaces bugs immediately rather than corrupting balances silently.
Integer-based storage: Stores values as uint64_t atomic units (dusties or 1e-8 Salvium), eliminating floating-point rounding errors entirely. 8 decimal places matches Salvium's precision requirements.
Type-safe: The type system itself prevents negative values (unsigned backing type) rather than relying on runtime checks. You cannot construct an invalid state.
Explicit bounds checking: Operations that could overflow check before executing, making resource limits visible in the code.
-
Precision: Fixed-point arithmetic with integer backing guarantees exact results. No floating-point rounding corruption.
-
Atomicity: Works directly with atomic units (dusties), which is how blockchains actually store values.
-
Auditability: Failed operations throw; you know immediately when something went wrong. No silently-clamped balance errors.
-
No negative values by design: Uses unsigned integers, not runtime validation that can fail.
// From atomic units
Salvium balance(500000000ULL); // 5 Salvium
// From decimal string (no floating-point involved)
Salvium amount = Salvium::from_string("1.5");
// Arithmetic throws on overflow/underflow
balance += amount;
balance -= amount; // throws if amount > balance
// Get values back
uint64_t atomic = balance.to_atomic();
std::string display = balance.to_salvium_string();This is what crypto needs.