Crate currencies
source ·Expand description
§💰 currencies
This crate allows for generic manipulation of currencies (both real-world and
cryptocurrencies) via the Amount
struct and the Currency
trait.
The Amount
struct is able to represent arbitrary amounts of any supported Currency
with the ability to restrict the underlying currencies at compile-time to only allow
checked arithmetic operations and requires consuming an Option
in all fallible
circumstances.
Re-exports§
Modules§
- Home of the
Amount
struct and supporting types and impls. - Home of the
Currency
trait, all built-in currencies such asUSD
,AAVE
,ETH
, etc., thedefine_currency!
macro, and related/supporting types. - Contains impls for
serde
integration
Macros§
- Shorthand for defining a new
Currency
. All ISO-4217 currencies already have an entry.
Structs§
- Wraps
primitive_types::U256
enhancing it with some extra trait impls needed for currency manipulation.