14 releases (7 breaking)
0.8.0 | Mar 18, 2024 |
---|---|
0.6.7 | Nov 21, 2023 |
0.4.0 | Feb 14, 2021 |
0.3.2 | Oct 22, 2020 |
0.1.1 | Jun 5, 2020 |
#2875 in Magic Beans
305 downloads per month
Used in pallet-mixer
140KB
3K
SLoC
Currencies Module
Overview
The currencies module provides a mixed currencies system, by configuring a native currency which implements BasicCurrencyExtended
, and a multi-currency which implements MultiCurrency
.
It also provides an adapter, to adapt frame_support::traits::Currency
implementations into BasicCurrencyExtended
.
The currencies module provides functionality of both MultiCurrencyExtended
and BasicCurrencyExtended
, via unified interfaces, and all calls would be delegated to the underlying multi-currency and base currency system. A native currency ID could be set by Config::GetNativeCurrencyId
, to identify the native currency.
lib.rs
:
Currencies Module
Overview
The currencies module provides a mixed currencies system, by configuring a
native currency which implements BasicCurrencyExtended
, and a
multi-currency which implements MultiCurrency
.
It also provides an adapter, to adapt frame_support::traits::Currency
implementations into BasicCurrencyExtended
.
The currencies module provides functionality of both MultiCurrencyExtended
and BasicCurrencyExtended
, via unified interfaces, and all calls would be
delegated to the underlying multi-currency and base currency system.
A native currency ID could be set by Config::GetNativeCurrencyId
, to
identify the native currency.
Implementations
The currencies module provides implementations for following traits.
MultiCurrency
- Abstraction over a fungible multi-currency system.MultiCurrencyExtended
- ExtendedMultiCurrency
with additional helper types and methods, like updating balance by a given signed integer amount.
Interface
Dispatchable Functions
transfer
- Transfer some balance to another account, in a given currency.transfer_native_currency
- Transfer some balance to another account, in native currency set inConfig::NativeCurrency
.update_balance
- Update balance by signed integer amount, in a given currency, root origin required.
Dependencies
~18–37MB
~609K SLoC