14 major breaking releases

17.0.0 Sep 26, 2024
16.0.0 Jul 18, 2024
15.0.0 Jul 12, 2024
14.0.0 Jun 21, 2024
0.0.0 Oct 16, 2023

#12 in #balance

Download history 824/week @ 2024-07-02 1279/week @ 2024-07-09 1333/week @ 2024-07-16 1118/week @ 2024-07-23 1182/week @ 2024-07-30 924/week @ 2024-08-06 1361/week @ 2024-08-13 1633/week @ 2024-08-20 1152/week @ 2024-08-27 858/week @ 2024-09-03 1198/week @ 2024-09-10 1007/week @ 2024-09-17 1605/week @ 2024-09-24 1501/week @ 2024-10-01 1599/week @ 2024-10-08 1741/week @ 2024-10-15

6,670 downloads per month
Used in 56 crates (5 directly)

Apache-2.0

2.5MB
42K SLoC

Release

Polkadot SDK stable2409


lib.rs:

Asset Rate Pallet

Overview

The AssetRate pallet provides means of setting conversion rates for some asset to native balance.

The supported dispatchable functions are documented in the Call enum.

Terminology

  • Asset balance: The balance type of an arbitrary asset. The network might only know about the identifier of the asset and nothing more.
  • Native balance: The balance type of the network's native currency.

Goals

The asset-rate system in Substrate is designed to make the following possible:

  • Providing a soft conversion for the balance of supported assets to a default asset class.
  • Updating existing conversion rates.

Interface

Permissioned Functions

  • create: Creates a new asset conversion rate.
  • remove: Removes an existing asset conversion rate.
  • update: Overwrites an existing assert conversion rate.

Please refer to the Call enum and its associated variants for documentation on each function.

Assumptions

  • Conversion rates are only used as estimates, and are not designed to be precise or closely tracking real world values.
  • All conversion rates reflect the ration of some asset to native, e.g. native = asset * rate.

Dependencies

~18–33MB
~544K SLoC