#currency #currencies #module #system #native #adapter #multi-currency

no-std orml-currencies

Provide MultiCurrency implementation using pallet-balances and orml-tokens module

19 releases (1 stable)

1.0.0 Aug 1, 2024
0.13.0 Jun 26, 2024
0.12.0 Jun 3, 2024
0.8.0 Mar 18, 2024
0.1.1 Jun 5, 2020

#12 in #currencies

Download history 179/week @ 2024-06-25 14/week @ 2024-07-02 4/week @ 2024-07-09 14/week @ 2024-07-16 9/week @ 2024-07-23 265/week @ 2024-07-30 10/week @ 2024-08-06 19/week @ 2024-08-13 5/week @ 2024-08-20 7/week @ 2024-08-27 21/week @ 2024-09-10 14/week @ 2024-09-17 38/week @ 2024-09-24 11/week @ 2024-10-01

84 downloads per month
Used in pallet-mixer

Apache-2.0 and GPL-3.0-only

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 - Extended MultiCurrency 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 in Config::NativeCurrency.
  • update_balance - Update balance by signed integer amount, in a given currency, root origin required.

Dependencies

~21–35MB
~586K SLoC