Expand description
The singleton amount — a coin amount proven odd at construction (SPEC §3 “Create”).
Chia’s singleton top layer only recognises an ODD-amount coin as the singleton. A launch built from an even-amount funding coin therefore spends the funding coin and produces no singleton at all: the money is gone and the identity does not exist. Arbitrary wallet coins are even roughly half the time, so this is not an exotic input.
SingletonAmount makes that state unrepresentable rather than merely refused. Its only
constructor validates, its field is private, and it is the only type this crate hands to a
launcher — unlike a bare if amount % 2 == 0 inside one function, which the next caller can
simply not write.
The type alone does not stop a future author reaching the SDK’s launcher directly, so EVERY
route by which a launcher can take a raw amount — all five of its constructors and its
with_singleton_amount mutator — is on disallowed-methods in clippy.toml, and CI runs
cargo clippy --all-targets -- -D warnings. A launch site that skips this check therefore fails
the build; the single production exemption is annotated at create::singleton_launcher.
Structs§
- Singleton
Amount - A coin amount that has been proven ODD, and is therefore usable as a singleton’s amount.