#currencies #substrate #orml-currencies

no-std orml-currencies

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

23 releases (5 stable)

new 1.4.0 Apr 28, 2025
1.3.0 Feb 9, 2025
1.2.1 Jan 14, 2025
1.1.0 Dec 10, 2024
0.1.1 Jun 5, 2020

#9 in #currencies

Download history 21/week @ 2025-01-05 145/week @ 2025-01-12 53/week @ 2025-01-19 10/week @ 2025-01-26 42/week @ 2025-02-02 139/week @ 2025-02-09 58/week @ 2025-02-16 47/week @ 2025-02-23 24/week @ 2025-03-02 33/week @ 2025-03-09 30/week @ 2025-03-16 18/week @ 2025-03-23 7/week @ 2025-03-30 14/week @ 2025-04-06 10/week @ 2025-04-13 22/week @ 2025-04-20

53 downloads per month
Used in pallet-mixer

Apache-2.0 and GPL-3.0-only

155KB
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.

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.

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.

Dependencies

~23–37MB
~628K SLoC