From 8a4b9555e35078886def512cb6539eea212fadf9 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Sat, 23 Dec 2023 15:07:14 +0400 Subject: [PATCH 01/49] wip --- .../src/reference_docs/tokens_in_substrate.rs | 72 +++++++++++++++++++ substrate/frame/balances/src/lib.rs | 14 +++- .../support/src/traits/tokens/fungible/mod.rs | 37 ++++++---- 3 files changed, 107 insertions(+), 16 deletions(-) create mode 100644 docs/sdk/src/reference_docs/tokens_in_substrate.rs diff --git a/docs/sdk/src/reference_docs/tokens_in_substrate.rs b/docs/sdk/src/reference_docs/tokens_in_substrate.rs new file mode 100644 index 000000000000..2c929610380f --- /dev/null +++ b/docs/sdk/src/reference_docs/tokens_in_substrate.rs @@ -0,0 +1,72 @@ +// This file is part of polkadot-sdk. +// +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # Tokens in Substrate +//! +//! This reference doc serves as a high-level overview of the token-related logic in Substrate and +//! how to use it. +//! +//! On completion of reading this doc, you should have a good understanding of +//! - The distinction between token traits and trait implementations in Substrate, and why this +//! distinction is helpful +//! - The token-related traits avaliable in Substrate +//! - The token-related trait implementations in Substrate +//! - How to choose the right trait or trait implementation for your use case +//! - Where to go next +//! +//! ## Traits and Trait Implementations +//! +//! Broardly, token logic in Substrate can be divided into two categories, traits and trait +//! implementations. +//! +//! Traits define common interfaces that types of token should implement. For example, the +//! [`fungible::Inspect`] trait specifies that implementations of this trait must contain methods +//! for accessing the total issuance of the token, the balance of individual accounts, etc. +//! +//! Trait implementations are concrete implementations of these traits. For example, one of the +//! many traits [`pallet_balances`] implements is [`fungible::Inspect`]. +//! +//! The distinction between traits and trait implementations is helpful because it allows pallets +//! and other logic to be generic over their dependencies, avoiding cumbersome and unwieldy tight +//! coupling. +//! +//! To illustrate this with an example let's consider [`pallet_preimage`]. This pallet takes a +//! deposit in exchange for storing some preimage for use later. A naive implementation of the +//! pallet may use [`pallet_balances`] as a dependency, and directly call the methods exposed by +//! [`pallet_balances`] to reserve and unreserve deposits. This approach works well, until someone +//! has a usecase requiring that an asset from a different pallet such as [`pallet_assets`] is +//! used for the deposit. Rather than tightly couple [`pallet_preimage`] to [`pallet_balances`], +//! [`pallet_assets`], along with every other token type pallet a user could possibly specify, +//! [`pallet_preimage`] does not specify a concrete pallet as a dependency but instead accepts any +//! dependency which implements the `Reservable` trait. This allows [`pallet_preimage`] to support +//! any arbitrary pallet implementing this trait, without needing any knowledge of what those +//! pallets may be or requiring changes to support new pallets which may be written. +//! +//! ## Fungible Token Traits in Substrate +//! +//! The [`frame_support::traits::fungible`] crate contains the latest set of Substrate +//! fungible token traits, and are recommended to use for all new logic. See the crate documentation +//! for more info about these traits. +//! +//! You may notice the trait [`frame_support::traits::Currency`] with similar functionality is also +//! used in the codebase, however this trait is deprecated and existing logic is in the process of +//! being migrated to [`frame_support::traits::fungible`] ([tracking issue](https://github.com/paritytech/polkadot-sdk/issues/226)). +//! +//! ## Fungible Token Trait Implementations in Substrate +//! +//! [`pallet_balances`] is the most common fungible token implementation, usually used for the +//! network native token. diff --git a/substrate/frame/balances/src/lib.rs b/substrate/frame/balances/src/lib.rs index 843bc351494e..3eb177780b32 100644 --- a/substrate/frame/balances/src/lib.rs +++ b/substrate/frame/balances/src/lib.rs @@ -17,7 +17,11 @@ //! # Balances Pallet //! -//! The Balances pallet provides functionality for handling accounts and balances. +//! The Balances pallet provides functionality for handling accounts and balances for a single +//! token. It implements the fungible assets paradigm using a single currency. +//! +//! See the [`tokens_in_substrate`] reference docs for more information about the place of +//! this palet in Substrate. //! //! - [`Config`] //! - [`Call`] @@ -308,10 +312,14 @@ pub mod pallet { /// The maximum number of locks that should exist on an account. /// Not strictly enforced, but used for weight estimation. + /// + /// Use of locks is deprecated in favour of freezes. See `https://github.com/paritytech/substrate/pull/12951/` #[pallet::constant] type MaxLocks: Get; /// The maximum number of named reserves that can exist on an account. + /// + /// Use of reserves is deprecated in favour of holds. See `https://github.com/paritytech/substrate/pull/12951/` #[pallet::constant] type MaxReserves: Get; @@ -453,6 +461,8 @@ pub mod pallet { /// Any liquidity locks on some account balances. /// NOTE: Should only be accessed when setting, changing and freeing a lock. + /// + /// Use of locks is deprecated in favour of freezes. See `https://github.com/paritytech/substrate/pull/12951/` #[pallet::storage] #[pallet::getter(fn locks)] pub type Locks, I: 'static = ()> = StorageMap< @@ -464,6 +474,8 @@ pub mod pallet { >; /// Named reserves on some account balances. + /// + /// Use of reserves is deprecated in favour of holds. See `https://github.com/paritytech/substrate/pull/12951/` #[pallet::storage] #[pallet::getter(fn reserves)] pub type Reserves, I: 'static = ()> = StorageMap< diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index ba4a2e5e21a2..3df983fcb561 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -17,26 +17,33 @@ //! The traits for dealing with a single fungible token class and any associated types. //! -//! ### User-implememted traits -//! - `Inspect`: Regular balance inspector functions. -//! - `Unbalanced`: Low-level balance mutating functions. Does not guarantee proper book-keeping and -//! so should not be called into directly from application code. Other traits depend on this and -//! provide default implementations based on it. -//! - `UnbalancedHold`: Low-level balance mutating functions for balances placed on hold. Does not +//! See the [`tokens_in_substrate`] reference docs for more information about the place of +//! `fungible` traits in Substrate. +//! +//! # Avaliable Traits +//! - [`Inspect`]: Regular balance inspector functions. +//! - [`Unbalanced`]: Low-level balance mutating functions. Does not guarantee proper book-keeping +//! and so should not be called into directly from application code. Other traits depend on this +//! and provide default implementations based on it. +//! - [`UnbalancedHold`]: Low-level balance mutating functions for balances placed on hold. Does not //! guarantee proper book-keeping and so should not be called into directly from application code. //! Other traits depend on this and provide default implementations based on it. -//! - `Mutate`: Regular balance mutator functions. Pre-implemented using `Unbalanced`, though the -//! `done_*` functions should likely be reimplemented in case you want to do something following -//! the operation such as emit events. -//! - `InspectHold`: Inspector functions for balances on hold. -//! - `MutateHold`: Mutator functions for balances on hold. Mostly pre-implemented using -//! `UnbalancedHold`. -//! - `InspectFreeze`: Inspector functions for frozen balance. -//! - `MutateFreeze`: Mutator functions for frozen balance. -//! - `Balanced`: One-sided mutator functions for regular balances, which return imbalance objects +//! - [`Mutate`]: Regular balance mutator functions. Pre-implemented using [`Unbalanced`], though +//! the `done_*` functions should likely be reimplemented in case you want to do something +//! following the operation such as emit events. +//! - [`InspectHold`]: Inspector functions for balances on hold. +//! - [`MutateHold`]: Mutator functions for balances on hold. Mostly pre-implemented using +//! [`UnbalancedHold`]. +//! - [`InspectFreeze`]: Inspector functions for frozen balance. +//! - [`MutateFreeze`]: Mutator functions for frozen balance. +//! - [`Balanced`]: One-sided mutator functions for regular balances, which return imbalance objects //! which guarantee eventual book-keeping. May be useful for some sophisticated operations where //! funds must be removed from an account before it is known precisely what should be done with //! them. +//! +//! # Holds vs. Freezes +//! +//! TODO: Differentiate between the two. pub mod conformance_tests; pub mod freeze; From 8e24dbc07861539e479538929f2a7cfc459f76f8 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Wed, 28 Feb 2024 18:20:58 +1100 Subject: [PATCH 02/49] update cargo.lock --- Cargo.lock | 450 ++++++++++++++++++++++++++++------------------------- 1 file changed, 236 insertions(+), 214 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 27ba43780eda..05843eead4ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -114,9 +114,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.7.8" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ "getrandom 0.2.10", "once_cell", @@ -125,9 +125,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" +checksum = "8b79b82693f705137f8fb9b37871d99e4f9a7df12b917eed79c3d3954830a60b" dependencies = [ "cfg-if", "getrandom 0.2.10", @@ -191,7 +191,7 @@ checksum = "c0391754c09fab4eae3404d19d0d297aa1c670c1775ab51d8a5312afeca23157" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -206,7 +206,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", "syn-solidity", "tiny-keccak", ] @@ -261,9 +261,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.11" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" dependencies = [ "anstyle", "anstyle-parse", @@ -333,7 +333,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -1218,7 +1218,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -1235,7 +1235,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -1417,7 +1417,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -2671,7 +2671,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -3900,10 +3900,10 @@ dependencies = [ name = "cumulus-pallet-parachain-system-proc-macro" version = "0.6.0" dependencies = [ - "proc-macro-crate 3.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -4408,9 +4408,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.2" +version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" dependencies = [ "cfg-if", "cpufeatures", @@ -4431,7 +4431,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -4471,7 +4471,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -4488,7 +4488,7 @@ checksum = "50c49547d73ba8dcfd4ad7325d64c6d5391ff4224d498fc39a6f3f49825a530d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -4696,7 +4696,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -4757,9 +4757,9 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.50", + "syn 2.0.51", "termcolor", - "toml 0.8.8", + "toml 0.8.10", "walkdir", ] @@ -4844,7 +4844,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" dependencies = [ - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.1", "ed25519", "rand_core 0.6.4", "serde", @@ -4873,7 +4873,7 @@ version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d9ce6874da5d4415896cd45ffbc4d1cfc0c4f9c079427bd870742c30f2f65a9" dependencies = [ - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.1", "ed25519", "hashbrown 0.14.3", "hex", @@ -4982,7 +4982,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -4993,7 +4993,7 @@ checksum = "c2ad8cef1d801a4686bfd8919f0b30eac4c8e48968c437a6405ded4fb5272d2b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -5183,7 +5183,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -5571,12 +5571,12 @@ dependencies = [ "frame-election-provider-support", "frame-support", "parity-scale-codec", - "proc-macro-crate 3.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "scale-info", "sp-arithmetic", - "syn 2.0.50", + "syn 2.0.51", "trybuild", ] @@ -5731,7 +5731,7 @@ dependencies = [ "quote", "regex", "sp-crypto-hashing", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -5739,10 +5739,10 @@ name = "frame-support-procedural-tools" version = "10.0.0" dependencies = [ "frame-support-procedural-tools-derive", - "proc-macro-crate 3.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -5751,7 +5751,7 @@ version = "11.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -5984,7 +5984,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -6213,9 +6213,9 @@ dependencies = [ [[package]] name = "governor" -version = "0.6.0" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "821239e5672ff23e2a7060901fa622950bbd80b649cdaadd78d1c1767ed14eb4" +checksum = "68a7f542ee6b35af73b06abc0dad1c1bae89964e4e253bc4b587b91c9637867b" dependencies = [ "cfg-if", "dashmap", @@ -6224,9 +6224,11 @@ dependencies = [ "no-std-compat", "nonzero_ext", "parking_lot 0.12.1", + "portable-atomic", "quanta", "rand", "smallvec", + "spinning_top", ] [[package]] @@ -6242,9 +6244,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -6252,7 +6254,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.2.3", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -6300,7 +6302,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.8", + "ahash 0.7.6", ] [[package]] @@ -6309,7 +6311,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.10", ] [[package]] @@ -6318,7 +6320,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.10", "allocator-api2", "serde", ] @@ -6683,9 +6685,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.3" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -6699,9 +6701,9 @@ checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" [[package]] name = "indicatif" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb28741c9db9a713d93deb3bb9515c20788cef5815265bee4980e87bde7e0f25" +checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" dependencies = [ "console", "instant", @@ -6848,9 +6850,9 @@ checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" [[package]] name = "jsonrpsee" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a95f7cc23d5fab0cdeeaf6bad8c8f5e7a3aa7f0d211957ea78232b327ab27b0" +checksum = "16fcc9dd231e72d22993f1643d5f7f0db785737dbe3c3d7ca222916ab4280795" dependencies = [ "jsonrpsee-core", "jsonrpsee-http-client", @@ -6864,9 +6866,9 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1736cfa3845fd9f8f43751f2b8e0e83f7b6081e754502f7d63b6587692cc83" +checksum = "0476c96eb741b40d39dcb39d0124e3b9be9840ec77653c42a0996563ae2a53f7" dependencies = [ "futures-util", "http", @@ -6885,9 +6887,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82030d038658974732103e623ba2e0abec03bbbe175b39c0a2fafbada60c5868" +checksum = "b974d8f6139efbe8425f32cb33302aba6d5e049556b5bfc067874e7a0da54a2e" dependencies = [ "anyhow", "async-lock 3.3.0", @@ -6911,9 +6913,9 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36a06ef0de060005fddf772d54597bb6a8b0413da47dcffd304b0306147b9678" +checksum = "19dc795a277cff37f27173b3ca790d042afcc0372c34a7ca068d2e76de2cb6d1" dependencies = [ "async-trait", "hyper", @@ -6931,12 +6933,12 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69fc56131589f82e57805f7338b87023db4aafef813555708b159787e34ad6bc" +checksum = "68e79a7109506831bf0cbeaad08729cdf0e592300c00f626bccd6d479974221e" dependencies = [ "heck", - "proc-macro-crate 3.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 1.0.109", @@ -6944,9 +6946,9 @@ dependencies = [ [[package]] name = "jsonrpsee-server" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d85be77fe5b2a94589e3164fb780017f7aff7d646b49278c0d0346af16975c8e" +checksum = "344440ccd8492c1ca65f1391c5aa03f91189db38d602d189b9266a1a5c6a4d22" dependencies = [ "futures-util", "http", @@ -6968,9 +6970,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a48fdc1202eafc51c63e00406575e59493284ace8b8b61aa16f3a6db5d64f1a" +checksum = "b13dac43c1a9fc2648b37f306b0a5b0e29b2a6e1c36a33b95c1948da2494e9c5" dependencies = [ "anyhow", "beef", @@ -6981,9 +6983,9 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5ce25d70a8e4d3cc574bbc3cad0137c326ad64b194793d5e7bbdd3fa4504181" +checksum = "b1bbaaf4ce912654081d997ade417c3155727db106c617c0612e85f504c2f744" dependencies = [ "http", "jsonrpsee-client-transport", @@ -7226,9 +7228,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libflate" @@ -7907,15 +7909,6 @@ dependencies = [ "libc", ] -[[package]] -name = "mach2" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" -dependencies = [ - "libc", -] - [[package]] name = "macro_magic" version = "0.5.0" @@ -7925,7 +7918,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -7939,7 +7932,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -7950,7 +7943,7 @@ checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -7961,7 +7954,7 @@ checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -8036,9 +8029,9 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45fd3a57831bf88bc63f8cebc0cf956116276e97fef3966103e96416209f7c92" +checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" dependencies = [ "libc", ] @@ -8209,7 +8202,7 @@ dependencies = [ "bitflags 1.3.2", "blake2 0.10.6", "c2-chacha", - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.1", "either", "hashlink", "lioness", @@ -9053,7 +9046,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eedb646674596266dc9bb2b5c7eea7c36b32ecc7777eba0d510196972d72c4fd" dependencies = [ "expander 2.0.0", - "indexmap 2.2.3", + "indexmap 2.0.0", "itertools 0.11.0", "petgraph", "proc-macro-crate 1.3.1", @@ -9669,7 +9662,7 @@ dependencies = [ "polkavm-linker 0.5.0", "sp-runtime", "tempfile", - "toml 0.8.8", + "toml 0.8.10", "twox-hash", "wat", ] @@ -9718,7 +9711,7 @@ version = "18.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -10889,11 +10882,11 @@ dependencies = [ name = "pallet-staking-reward-curve" version = "11.0.0" dependencies = [ - "proc-macro-crate 3.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "sp-runtime", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -11975,7 +11968,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -11996,7 +11989,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.2.3", + "indexmap 2.0.0", ] [[package]] @@ -12016,7 +12009,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -12306,7 +12299,7 @@ dependencies = [ "fatality", "futures", "futures-timer", - "indexmap 2.2.3", + "indexmap 2.0.0", "lazy_static", "parity-scale-codec", "polkadot-erasure-coding", @@ -13562,7 +13555,7 @@ dependencies = [ "fatality", "futures", "futures-timer", - "indexmap 2.2.3", + "indexmap 2.0.0", "parity-scale-codec", "polkadot-node-network-protocol", "polkadot-node-primitives", @@ -13869,7 +13862,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6380dbe1fb03ecc74ad55d841cfc75480222d153ba69ddcb00977866cbdabdb8" dependencies = [ "polkavm-derive-impl 0.5.0", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -13890,7 +13883,7 @@ dependencies = [ "polkavm-common 0.5.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -13902,7 +13895,7 @@ dependencies = [ "polkavm-common 0.8.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -13912,7 +13905,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15e85319a0d5129dc9f021c62607e0804f5fb777a05cdda44d750ac0732def66" dependencies = [ "polkavm-derive-impl 0.8.0", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -14009,9 +14002,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.4.2" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f32154ba0af3a075eefa1eda8bb414ee928f62303a54ea85b8d6638ff1a6ee9e" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" [[package]] name = "portpicker" @@ -14117,7 +14110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c64d9ba0963cdcea2e1b2230fbae2bab30eb25a174be395c41e764bfb65dd62" dependencies = [ "proc-macro2", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -14163,11 +14156,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b2685dd208a3771337d8d386a89840f0f43cd68be8dae90a5f8c2384effc9cd" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_edit 0.21.0", + "toml_edit 0.21.1", ] [[package]] @@ -14208,14 +14201,14 @@ checksum = "9b698b0b09d40e9b7c1a47b132d66a8b54bcd20583d9b6d06e4535e383b4405c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] name = "proc-macro2" -version = "1.0.75" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -14280,7 +14273,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -14380,7 +14373,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -14433,13 +14426,12 @@ dependencies = [ [[package]] name = "quanta" -version = "0.11.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" +checksum = "9ca0b7bac0b97248c40bb77288fc52029cf1459c0461ea1b05ee32ccf011de2c" dependencies = [ "crossbeam-utils", "libc", - "mach2", "once_cell", "raw-cpuid", "wasi 0.11.0+wasi-snapshot-preview1", @@ -14609,11 +14601,11 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "10.7.0" +version = "11.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" +checksum = "9d86a7c4638d42c44551f4791a20e687dbb4c3de1f33c43dd71e355cd429def1" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", ] [[package]] @@ -14723,7 +14715,7 @@ checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -14914,16 +14906,17 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", "getrandom 0.2.10", "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -15214,7 +15207,7 @@ dependencies = [ "regex", "relative-path", "rustc_version 0.4.0", - "syn 2.0.50", + "syn 2.0.51", "unicode-ident", ] @@ -15399,7 +15392,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" dependencies = [ "log", - "ring 0.17.7", + "ring 0.17.8", "rustls-pki-types", "rustls-webpki 0.102.2", "subtle 2.5.0", @@ -15425,7 +15418,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" dependencies = [ "openssl-probe", - "rustls-pemfile 2.0.0", + "rustls-pemfile 2.1.0", "rustls-pki-types", "schannel", "security-framework", @@ -15442,9 +15435,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35e4980fa29e4c4b212ffb3db068a564cbf560e51d3944b7c88bd8bf5bec64f4" +checksum = "3c333bb734fcdedcea57de1602543590f545f127dc8b533324318fd492c5c70b" dependencies = [ "base64 0.21.2", "rustls-pki-types", @@ -15452,9 +15445,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.2.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a716eb65e3158e90e17cd93d855216e27bde02745ab842f2cab4a39dba1bacf" +checksum = "5ede67b28608b4c60685c7d54122d4400d90f62b40caee7700e700380a390fa8" [[package]] name = "rustls-webpki" @@ -15472,7 +15465,7 @@ version = "0.102.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "rustls-pki-types", "untrusted 0.9.0", ] @@ -15639,7 +15632,7 @@ dependencies = [ "array-bytes 6.1.0", "docify", "log", - "memmap2 0.9.3", + "memmap2 0.9.4", "parity-scale-codec", "sc-chain-spec-derive", "sc-client-api", @@ -15665,10 +15658,10 @@ dependencies = [ name = "sc-chain-spec-derive" version = "11.0.0" dependencies = [ - "proc-macro-crate 3.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -15989,7 +15982,7 @@ dependencies = [ name = "sc-consensus-grandpa" version = "0.19.0" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.10", "array-bytes 6.1.0", "assert_matches", "async-trait", @@ -16375,7 +16368,7 @@ dependencies = [ name = "sc-network-gossip" version = "0.34.0" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.10", "async-trait", "futures", "futures-timer", @@ -16936,10 +16929,10 @@ dependencies = [ name = "sc-tracing-proc-macro" version = "11.0.0" dependencies = [ - "proc-macro-crate 3.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -17072,7 +17065,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.10", "cfg-if", "hashbrown 0.13.2", ] @@ -17118,7 +17111,7 @@ dependencies = [ "aead 0.5.2", "arrayref", "arrayvec 0.7.4", - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.1", "getrandom_or_panic", "merlin 3.0.0", "rand_core 0.6.4", @@ -17356,7 +17349,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -17392,9 +17385,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ "serde", ] @@ -17413,11 +17406,11 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.32" +version = "0.9.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd075d994154d4a774f95b51fb96bdc2832b0ea48425c92546073816cda1f2f" +checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c" dependencies = [ - "indexmap 2.2.3", + "indexmap 2.0.0", "itoa", "ryu", "serde", @@ -17446,7 +17439,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -17578,9 +17571,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.3.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "signal-hook" @@ -17673,9 +17666,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "smol" @@ -17808,7 +17801,7 @@ dependencies = [ "aes-gcm 0.9.2", "blake2 0.10.6", "chacha20poly1305", - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.1", "rand_core 0.6.4", "ring 0.16.20", "rustc_version 0.4.0", @@ -18282,10 +18275,10 @@ dependencies = [ "assert_matches", "blake2 0.10.6", "expander 2.0.0", - "proc-macro-crate 3.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -18678,7 +18671,7 @@ version = "0.0.0" dependencies = [ "quote", "sp-crypto-hashing", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -18696,7 +18689,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk#82912acb33a9030c0ef3bf5 dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -18705,7 +18698,7 @@ version = "14.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -18979,7 +18972,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -18988,10 +18981,10 @@ version = "17.0.0" dependencies = [ "Inflector", "expander 2.0.0", - "proc-macro-crate 3.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -19088,7 +19081,7 @@ name = "sp-statement-store" version = "10.0.0" dependencies = [ "aes-gcm 0.10.3", - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.1", "ed25519-dalek", "hkdf", "parity-scale-codec", @@ -19215,7 +19208,7 @@ dependencies = [ name = "sp-trie" version = "29.0.0" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.10", "array-bytes 6.1.0", "criterion 0.4.0", "hash-db", @@ -19263,7 +19256,7 @@ dependencies = [ "proc-macro2", "quote", "sp-version", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -19329,6 +19322,15 @@ dependencies = [ "strum 0.24.1", ] +[[package]] +name = "spinning_top" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.2" @@ -19708,7 +19710,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -19979,7 +19981,7 @@ dependencies = [ "sp-maybe-compressed-blob", "strum 0.24.1", "tempfile", - "toml 0.8.8", + "toml 0.8.10", "walkdir", "wasm-opt", ] @@ -20106,9 +20108,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.50" +version = "2.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" +checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" dependencies = [ "proc-macro2", "quote", @@ -20124,7 +20126,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -20389,7 +20391,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -20550,7 +20552,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -20648,14 +20650,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" +checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.21.0", + "toml_edit 0.22.6", ] [[package]] @@ -20673,22 +20675,33 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.3", + "indexmap 2.0.0", "toml_datetime", - "winnow", + "winnow 0.5.15", ] [[package]] name = "toml_edit" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.3", + "indexmap 2.0.0", + "toml_datetime", + "winnow 0.5.15", +] + +[[package]] +name = "toml_edit" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" +dependencies = [ + "indexmap 2.0.0", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.2", ] [[package]] @@ -20757,7 +20770,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -20796,10 +20809,10 @@ version = "5.0.0" dependencies = [ "assert_matches", "expander 2.0.0", - "proc-macro-crate 3.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -21364,7 +21377,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", "wasm-bindgen-shared", ] @@ -21398,7 +21411,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -21508,9 +21521,9 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.31.2" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8281d1d660cdf54c76a3efa9ddd0c270cada1383a995db3ccb43d166456c7" +checksum = "1f341edb80021141d4ae6468cbeefc50798716a347d4085c3811900049ea8945" dependencies = [ "smallvec", "spin 0.9.8", @@ -21521,9 +21534,9 @@ dependencies = [ [[package]] name = "wasmi_arena" -version = "0.4.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" +checksum = "401c1f35e413fac1846d4843745589d9ec678977ab35a384db8ae7830525d468" [[package]] name = "wasmi_core" @@ -21784,12 +21797,12 @@ dependencies = [ [[package]] name = "webpki" -version = "0.22.4" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" dependencies = [ - "ring 0.17.7", - "untrusted 0.9.0", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] @@ -22068,7 +22081,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -22103,17 +22116,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.3", + "windows_aarch64_msvc 0.52.3", + "windows_i686_gnu 0.52.3", + "windows_i686_msvc 0.52.3", + "windows_x86_64_gnu 0.52.3", + "windows_x86_64_gnullvm 0.52.3", + "windows_x86_64_msvc 0.52.3", ] [[package]] @@ -22130,9 +22143,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" [[package]] name = "windows_aarch64_msvc" @@ -22154,9 +22167,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" [[package]] name = "windows_i686_gnu" @@ -22178,9 +22191,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" [[package]] name = "windows_i686_msvc" @@ -22202,9 +22215,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" [[package]] name = "windows_x86_64_gnu" @@ -22226,9 +22239,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" [[package]] name = "windows_x86_64_gnullvm" @@ -22244,9 +22257,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" [[package]] name = "windows_x86_64_msvc" @@ -22268,9 +22281,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" [[package]] name = "winnow" @@ -22281,6 +22294,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a4191c47f15cc3ec71fcb4913cb83d58def65dd3787610213c649283b5ce178" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.50.0" @@ -22317,7 +22339,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" dependencies = [ - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.1", "rand_core 0.6.4", "serde", "zeroize", @@ -22415,7 +22437,7 @@ dependencies = [ "proc-macro2", "quote", "staging-xcm", - "syn 2.0.50", + "syn 2.0.51", "trybuild", ] @@ -22537,7 +22559,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] @@ -22557,7 +22579,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.51", ] [[package]] From ef7c3dd6f79b1b3a13c1b7a17699d1243e0ebbe9 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Wed, 28 Feb 2024 18:54:01 +1100 Subject: [PATCH 03/49] wip --- Cargo.lock | 452 +++++++++--------- docs/sdk/Cargo.toml | 2 + .../src/reference_docs/tokens_in_substrate.rs | 34 +- 3 files changed, 244 insertions(+), 244 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 05843eead4ac..c6d4a54ca421 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -114,9 +114,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ "getrandom 0.2.10", "once_cell", @@ -125,9 +125,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.10" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b79b82693f705137f8fb9b37871d99e4f9a7df12b917eed79c3d3954830a60b" +checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" dependencies = [ "cfg-if", "getrandom 0.2.10", @@ -191,7 +191,7 @@ checksum = "c0391754c09fab4eae3404d19d0d297aa1c670c1775ab51d8a5312afeca23157" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -206,7 +206,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", "syn-solidity", "tiny-keccak", ] @@ -261,9 +261,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.13" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -333,7 +333,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -1218,7 +1218,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -1235,7 +1235,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -1417,7 +1417,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -2671,7 +2671,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -3900,10 +3900,10 @@ dependencies = [ name = "cumulus-pallet-parachain-system-proc-macro" version = "0.6.0" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -4408,9 +4408,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.1" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ "cfg-if", "cpufeatures", @@ -4431,7 +4431,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -4471,7 +4471,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -4488,7 +4488,7 @@ checksum = "50c49547d73ba8dcfd4ad7325d64c6d5391ff4224d498fc39a6f3f49825a530d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -4696,7 +4696,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -4757,9 +4757,9 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.51", + "syn 2.0.50", "termcolor", - "toml 0.8.10", + "toml 0.8.8", "walkdir", ] @@ -4844,7 +4844,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" dependencies = [ - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "ed25519", "rand_core 0.6.4", "serde", @@ -4873,7 +4873,7 @@ version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d9ce6874da5d4415896cd45ffbc4d1cfc0c4f9c079427bd870742c30f2f65a9" dependencies = [ - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "ed25519", "hashbrown 0.14.3", "hex", @@ -4982,7 +4982,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -4993,7 +4993,7 @@ checksum = "c2ad8cef1d801a4686bfd8919f0b30eac4c8e48968c437a6405ded4fb5272d2b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -5183,7 +5183,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -5571,12 +5571,12 @@ dependencies = [ "frame-election-provider-support", "frame-support", "parity-scale-codec", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.0.0", "proc-macro2", "quote", "scale-info", "sp-arithmetic", - "syn 2.0.51", + "syn 2.0.50", "trybuild", ] @@ -5731,7 +5731,7 @@ dependencies = [ "quote", "regex", "sp-crypto-hashing", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -5739,10 +5739,10 @@ name = "frame-support-procedural-tools" version = "10.0.0" dependencies = [ "frame-support-procedural-tools-derive", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -5751,7 +5751,7 @@ version = "11.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -5984,7 +5984,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -6213,9 +6213,9 @@ dependencies = [ [[package]] name = "governor" -version = "0.6.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a7f542ee6b35af73b06abc0dad1c1bae89964e4e253bc4b587b91c9637867b" +checksum = "821239e5672ff23e2a7060901fa622950bbd80b649cdaadd78d1c1767ed14eb4" dependencies = [ "cfg-if", "dashmap", @@ -6224,11 +6224,9 @@ dependencies = [ "no-std-compat", "nonzero_ext", "parking_lot 0.12.1", - "portable-atomic", "quanta", "rand", "smallvec", - "spinning_top", ] [[package]] @@ -6244,9 +6242,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", @@ -6254,7 +6252,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 1.9.3", + "indexmap 2.2.3", "slab", "tokio", "tokio-util", @@ -6302,7 +6300,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.6", + "ahash 0.7.8", ] [[package]] @@ -6311,7 +6309,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.10", + "ahash 0.8.8", ] [[package]] @@ -6320,7 +6318,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.10", + "ahash 0.8.8", "allocator-api2", "serde", ] @@ -6685,9 +6683,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -6701,9 +6699,9 @@ checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" [[package]] name = "indicatif" -version = "0.17.8" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" +checksum = "fb28741c9db9a713d93deb3bb9515c20788cef5815265bee4980e87bde7e0f25" dependencies = [ "console", "instant", @@ -6850,9 +6848,9 @@ checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" [[package]] name = "jsonrpsee" -version = "0.22.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16fcc9dd231e72d22993f1643d5f7f0db785737dbe3c3d7ca222916ab4280795" +checksum = "4a95f7cc23d5fab0cdeeaf6bad8c8f5e7a3aa7f0d211957ea78232b327ab27b0" dependencies = [ "jsonrpsee-core", "jsonrpsee-http-client", @@ -6866,9 +6864,9 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.22.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0476c96eb741b40d39dcb39d0124e3b9be9840ec77653c42a0996563ae2a53f7" +checksum = "6b1736cfa3845fd9f8f43751f2b8e0e83f7b6081e754502f7d63b6587692cc83" dependencies = [ "futures-util", "http", @@ -6887,9 +6885,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.22.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b974d8f6139efbe8425f32cb33302aba6d5e049556b5bfc067874e7a0da54a2e" +checksum = "82030d038658974732103e623ba2e0abec03bbbe175b39c0a2fafbada60c5868" dependencies = [ "anyhow", "async-lock 3.3.0", @@ -6913,9 +6911,9 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.22.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19dc795a277cff37f27173b3ca790d042afcc0372c34a7ca068d2e76de2cb6d1" +checksum = "36a06ef0de060005fddf772d54597bb6a8b0413da47dcffd304b0306147b9678" dependencies = [ "async-trait", "hyper", @@ -6933,12 +6931,12 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.22.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68e79a7109506831bf0cbeaad08729cdf0e592300c00f626bccd6d479974221e" +checksum = "69fc56131589f82e57805f7338b87023db4aafef813555708b159787e34ad6bc" dependencies = [ "heck", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.0.0", "proc-macro2", "quote", "syn 1.0.109", @@ -6946,9 +6944,9 @@ dependencies = [ [[package]] name = "jsonrpsee-server" -version = "0.22.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "344440ccd8492c1ca65f1391c5aa03f91189db38d602d189b9266a1a5c6a4d22" +checksum = "d85be77fe5b2a94589e3164fb780017f7aff7d646b49278c0d0346af16975c8e" dependencies = [ "futures-util", "http", @@ -6970,9 +6968,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.22.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13dac43c1a9fc2648b37f306b0a5b0e29b2a6e1c36a33b95c1948da2494e9c5" +checksum = "9a48fdc1202eafc51c63e00406575e59493284ace8b8b61aa16f3a6db5d64f1a" dependencies = [ "anyhow", "beef", @@ -6983,9 +6981,9 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.22.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1bbaaf4ce912654081d997ade417c3155727db106c617c0612e85f504c2f744" +checksum = "c5ce25d70a8e4d3cc574bbc3cad0137c326ad64b194793d5e7bbdd3fa4504181" dependencies = [ "http", "jsonrpsee-client-transport", @@ -7228,9 +7226,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libflate" @@ -7909,6 +7907,15 @@ dependencies = [ "libc", ] +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + [[package]] name = "macro_magic" version = "0.5.0" @@ -7918,7 +7925,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -7932,7 +7939,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -7943,7 +7950,7 @@ checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -7954,7 +7961,7 @@ checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -8029,9 +8036,9 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.9.4" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" +checksum = "45fd3a57831bf88bc63f8cebc0cf956116276e97fef3966103e96416209f7c92" dependencies = [ "libc", ] @@ -8202,7 +8209,7 @@ dependencies = [ "bitflags 1.3.2", "blake2 0.10.6", "c2-chacha", - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "either", "hashlink", "lioness", @@ -9046,7 +9053,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eedb646674596266dc9bb2b5c7eea7c36b32ecc7777eba0d510196972d72c4fd" dependencies = [ "expander 2.0.0", - "indexmap 2.0.0", + "indexmap 2.2.3", "itertools 0.11.0", "petgraph", "proc-macro-crate 1.3.1", @@ -9662,7 +9669,7 @@ dependencies = [ "polkavm-linker 0.5.0", "sp-runtime", "tempfile", - "toml 0.8.10", + "toml 0.8.8", "twox-hash", "wat", ] @@ -9711,7 +9718,7 @@ version = "18.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -10882,11 +10889,11 @@ dependencies = [ name = "pallet-staking-reward-curve" version = "11.0.0" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.0.0", "proc-macro2", "quote", "sp-runtime", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -11968,7 +11975,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -11989,7 +11996,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.0.0", + "indexmap 2.2.3", ] [[package]] @@ -12009,7 +12016,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -12299,7 +12306,7 @@ dependencies = [ "fatality", "futures", "futures-timer", - "indexmap 2.0.0", + "indexmap 2.2.3", "lazy_static", "parity-scale-codec", "polkadot-erasure-coding", @@ -13388,9 +13395,11 @@ dependencies = [ "pallet-democracy", "pallet-examples", "pallet-multisig", + "pallet-nfts", "pallet-proxy", "pallet-timestamp", "pallet-transaction-payment", + "pallet-uniques", "pallet-utility", "parity-scale-codec", "sc-cli", @@ -13555,7 +13564,7 @@ dependencies = [ "fatality", "futures", "futures-timer", - "indexmap 2.0.0", + "indexmap 2.2.3", "parity-scale-codec", "polkadot-node-network-protocol", "polkadot-node-primitives", @@ -13862,7 +13871,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6380dbe1fb03ecc74ad55d841cfc75480222d153ba69ddcb00977866cbdabdb8" dependencies = [ "polkavm-derive-impl 0.5.0", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -13883,7 +13892,7 @@ dependencies = [ "polkavm-common 0.5.0", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -13895,7 +13904,7 @@ dependencies = [ "polkavm-common 0.8.0", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -13905,7 +13914,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15e85319a0d5129dc9f021c62607e0804f5fb777a05cdda44d750ac0732def66" dependencies = [ "polkavm-derive-impl 0.8.0", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -14002,9 +14011,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.6.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +checksum = "f32154ba0af3a075eefa1eda8bb414ee928f62303a54ea85b8d6638ff1a6ee9e" [[package]] name = "portpicker" @@ -14110,7 +14119,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c64d9ba0963cdcea2e1b2230fbae2bab30eb25a174be395c41e764bfb65dd62" dependencies = [ "proc-macro2", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -14156,11 +14165,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "6b2685dd208a3771337d8d386a89840f0f43cd68be8dae90a5f8c2384effc9cd" dependencies = [ - "toml_edit 0.21.1", + "toml_edit 0.21.0", ] [[package]] @@ -14201,14 +14210,14 @@ checksum = "9b698b0b09d40e9b7c1a47b132d66a8b54bcd20583d9b6d06e4535e383b4405c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" dependencies = [ "unicode-ident", ] @@ -14273,7 +14282,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -14373,7 +14382,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -14426,12 +14435,13 @@ dependencies = [ [[package]] name = "quanta" -version = "0.12.2" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca0b7bac0b97248c40bb77288fc52029cf1459c0461ea1b05ee32ccf011de2c" +checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" dependencies = [ "crossbeam-utils", "libc", + "mach2", "once_cell", "raw-cpuid", "wasi 0.11.0+wasi-snapshot-preview1", @@ -14601,11 +14611,11 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "11.0.1" +version = "10.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d86a7c4638d42c44551f4791a20e687dbb4c3de1f33c43dd71e355cd429def1" +checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" dependencies = [ - "bitflags 2.4.0", + "bitflags 1.3.2", ] [[package]] @@ -14715,7 +14725,7 @@ checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -14906,17 +14916,16 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.8" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", - "cfg-if", "getrandom 0.2.10", "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] @@ -15207,7 +15216,7 @@ dependencies = [ "regex", "relative-path", "rustc_version 0.4.0", - "syn 2.0.51", + "syn 2.0.50", "unicode-ident", ] @@ -15392,7 +15401,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" dependencies = [ "log", - "ring 0.17.8", + "ring 0.17.7", "rustls-pki-types", "rustls-webpki 0.102.2", "subtle 2.5.0", @@ -15418,7 +15427,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" dependencies = [ "openssl-probe", - "rustls-pemfile 2.1.0", + "rustls-pemfile 2.0.0", "rustls-pki-types", "schannel", "security-framework", @@ -15435,9 +15444,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c333bb734fcdedcea57de1602543590f545f127dc8b533324318fd492c5c70b" +checksum = "35e4980fa29e4c4b212ffb3db068a564cbf560e51d3944b7c88bd8bf5bec64f4" dependencies = [ "base64 0.21.2", "rustls-pki-types", @@ -15445,9 +15454,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.3.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ede67b28608b4c60685c7d54122d4400d90f62b40caee7700e700380a390fa8" +checksum = "0a716eb65e3158e90e17cd93d855216e27bde02745ab842f2cab4a39dba1bacf" [[package]] name = "rustls-webpki" @@ -15465,7 +15474,7 @@ version = "0.102.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" dependencies = [ - "ring 0.17.8", + "ring 0.17.7", "rustls-pki-types", "untrusted 0.9.0", ] @@ -15632,7 +15641,7 @@ dependencies = [ "array-bytes 6.1.0", "docify", "log", - "memmap2 0.9.4", + "memmap2 0.9.3", "parity-scale-codec", "sc-chain-spec-derive", "sc-client-api", @@ -15658,10 +15667,10 @@ dependencies = [ name = "sc-chain-spec-derive" version = "11.0.0" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -15982,7 +15991,7 @@ dependencies = [ name = "sc-consensus-grandpa" version = "0.19.0" dependencies = [ - "ahash 0.8.10", + "ahash 0.8.8", "array-bytes 6.1.0", "assert_matches", "async-trait", @@ -16368,7 +16377,7 @@ dependencies = [ name = "sc-network-gossip" version = "0.34.0" dependencies = [ - "ahash 0.8.10", + "ahash 0.8.8", "async-trait", "futures", "futures-timer", @@ -16929,10 +16938,10 @@ dependencies = [ name = "sc-tracing-proc-macro" version = "11.0.0" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -17065,7 +17074,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" dependencies = [ - "ahash 0.8.10", + "ahash 0.8.8", "cfg-if", "hashbrown 0.13.2", ] @@ -17111,7 +17120,7 @@ dependencies = [ "aead 0.5.2", "arrayref", "arrayvec 0.7.4", - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "getrandom_or_panic", "merlin 3.0.0", "rand_core 0.6.4", @@ -17349,7 +17358,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -17385,9 +17394,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] @@ -17406,11 +17415,11 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.27" +version = "0.9.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c" +checksum = "8fd075d994154d4a774f95b51fb96bdc2832b0ea48425c92546073816cda1f2f" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.2.3", "itoa", "ryu", "serde", @@ -17439,7 +17448,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -17571,9 +17580,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook" @@ -17666,9 +17675,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "smol" @@ -17801,7 +17810,7 @@ dependencies = [ "aes-gcm 0.9.2", "blake2 0.10.6", "chacha20poly1305", - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "rand_core 0.6.4", "ring 0.16.20", "rustc_version 0.4.0", @@ -18275,10 +18284,10 @@ dependencies = [ "assert_matches", "blake2 0.10.6", "expander 2.0.0", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -18671,7 +18680,7 @@ version = "0.0.0" dependencies = [ "quote", "sp-crypto-hashing", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -18689,7 +18698,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk#82912acb33a9030c0ef3bf5 dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -18698,7 +18707,7 @@ version = "14.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -18972,7 +18981,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -18981,10 +18990,10 @@ version = "17.0.0" dependencies = [ "Inflector", "expander 2.0.0", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -19081,7 +19090,7 @@ name = "sp-statement-store" version = "10.0.0" dependencies = [ "aes-gcm 0.10.3", - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "ed25519-dalek", "hkdf", "parity-scale-codec", @@ -19208,7 +19217,7 @@ dependencies = [ name = "sp-trie" version = "29.0.0" dependencies = [ - "ahash 0.8.10", + "ahash 0.8.8", "array-bytes 6.1.0", "criterion 0.4.0", "hash-db", @@ -19256,7 +19265,7 @@ dependencies = [ "proc-macro2", "quote", "sp-version", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -19322,15 +19331,6 @@ dependencies = [ "strum 0.24.1", ] -[[package]] -name = "spinning_top" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" -dependencies = [ - "lock_api", -] - [[package]] name = "spki" version = "0.7.2" @@ -19710,7 +19710,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -19981,7 +19981,7 @@ dependencies = [ "sp-maybe-compressed-blob", "strum 0.24.1", "tempfile", - "toml 0.8.10", + "toml 0.8.8", "walkdir", "wasm-opt", ] @@ -20108,9 +20108,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.51" +version = "2.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" +checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" dependencies = [ "proc-macro2", "quote", @@ -20126,7 +20126,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -20391,7 +20391,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -20552,7 +20552,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -20650,14 +20650,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.10" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.6", + "toml_edit 0.21.0", ] [[package]] @@ -20675,33 +20675,22 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.2.3", "toml_datetime", - "winnow 0.5.15", + "winnow", ] [[package]] name = "toml_edit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap 2.0.0", - "toml_datetime", - "winnow 0.5.15", -] - -[[package]] -name = "toml_edit" -version = "0.22.6" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.2", + "winnow", ] [[package]] @@ -20770,7 +20759,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -20809,10 +20798,10 @@ version = "5.0.0" dependencies = [ "assert_matches", "expander 2.0.0", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -21377,7 +21366,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", "wasm-bindgen-shared", ] @@ -21411,7 +21400,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -21521,9 +21510,9 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.31.0" +version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f341edb80021141d4ae6468cbeefc50798716a347d4085c3811900049ea8945" +checksum = "77a8281d1d660cdf54c76a3efa9ddd0c270cada1383a995db3ccb43d166456c7" dependencies = [ "smallvec", "spin 0.9.8", @@ -21534,9 +21523,9 @@ dependencies = [ [[package]] name = "wasmi_arena" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "401c1f35e413fac1846d4843745589d9ec678977ab35a384db8ae7830525d468" +checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" [[package]] name = "wasmi_core" @@ -21797,12 +21786,12 @@ dependencies = [ [[package]] name = "webpki" -version = "0.22.0" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring 0.16.20", - "untrusted 0.7.1", + "ring 0.17.7", + "untrusted 0.9.0", ] [[package]] @@ -22081,7 +22070,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.3", + "windows-targets 0.52.0", ] [[package]] @@ -22116,17 +22105,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.3" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" dependencies = [ - "windows_aarch64_gnullvm 0.52.3", - "windows_aarch64_msvc 0.52.3", - "windows_i686_gnu 0.52.3", - "windows_i686_msvc 0.52.3", - "windows_x86_64_gnu 0.52.3", - "windows_x86_64_gnullvm 0.52.3", - "windows_x86_64_msvc 0.52.3", + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -22143,9 +22132,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.3" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" [[package]] name = "windows_aarch64_msvc" @@ -22167,9 +22156,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.3" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" [[package]] name = "windows_i686_gnu" @@ -22191,9 +22180,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.3" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" [[package]] name = "windows_i686_msvc" @@ -22215,9 +22204,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.3" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" [[package]] name = "windows_x86_64_gnu" @@ -22239,9 +22228,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.3" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" [[package]] name = "windows_x86_64_gnullvm" @@ -22257,9 +22246,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.3" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" [[package]] name = "windows_x86_64_msvc" @@ -22281,9 +22270,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.3" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" @@ -22294,15 +22283,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winnow" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a4191c47f15cc3ec71fcb4913cb83d58def65dd3787610213c649283b5ce178" -dependencies = [ - "memchr", -] - [[package]] name = "winreg" version = "0.50.0" @@ -22339,7 +22319,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" dependencies = [ - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "rand_core 0.6.4", "serde", "zeroize", @@ -22437,7 +22417,7 @@ dependencies = [ "proc-macro2", "quote", "staging-xcm", - "syn 2.0.51", + "syn 2.0.50", "trybuild", ] @@ -22559,7 +22539,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] @@ -22579,7 +22559,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.50", ] [[package]] diff --git a/docs/sdk/Cargo.toml b/docs/sdk/Cargo.toml index 576a81834f8c..e5ea12387e2e 100644 --- a/docs/sdk/Cargo.toml +++ b/docs/sdk/Cargo.toml @@ -66,6 +66,8 @@ pallet-proxy = { path = "../../substrate/frame/proxy" } pallet-authorship = { path = "../../substrate/frame/authorship" } pallet-collective = { path = "../../substrate/frame/collective" } pallet-democracy = { path = "../../substrate/frame/democracy" } +pallet-uniques = { path = "../../substrate/frame/uniques" } +pallet-nfts = { path = "../../substrate/frame/nfts" } frame-system = { path = "../../substrate/frame/system" } # Primitives diff --git a/docs/sdk/src/reference_docs/tokens_in_substrate.rs b/docs/sdk/src/reference_docs/tokens_in_substrate.rs index 2c929610380f..5f624ffc9392 100644 --- a/docs/sdk/src/reference_docs/tokens_in_substrate.rs +++ b/docs/sdk/src/reference_docs/tokens_in_substrate.rs @@ -30,14 +30,14 @@ //! //! ## Traits and Trait Implementations //! -//! Broardly, token logic in Substrate can be divided into two categories, traits and trait -//! implementations. +//! Broardly speaking, token logic in Substrate can be divided into two categories: traits, and +//! trait implementations. //! -//! Traits define common interfaces that types of token should implement. For example, the +//! *Traits* define common interfaces that types of token should implement. For example, the //! [`fungible::Inspect`] trait specifies that implementations of this trait must contain methods //! for accessing the total issuance of the token, the balance of individual accounts, etc. //! -//! Trait implementations are concrete implementations of these traits. For example, one of the +//! *Trait implementations* are concrete implementations of these traits. For example, one of the //! many traits [`pallet_balances`] implements is [`fungible::Inspect`]. //! //! The distinction between traits and trait implementations is helpful because it allows pallets @@ -59,8 +59,11 @@ //! ## Fungible Token Traits in Substrate //! //! The [`frame_support::traits::fungible`] crate contains the latest set of Substrate -//! fungible token traits, and are recommended to use for all new logic. See the crate documentation -//! for more info about these traits. +//! fungible token traits, and is recommended to use for all new logic requiring a fungible tokens. +//! See the crate documentation for more info about these fungible traits. +//! +//! [`frame_support::traits::fungibles`] provides very similar functionality to +//! [`frame_support::traits::fungible`], except it supports managing multiple tokens. //! //! You may notice the trait [`frame_support::traits::Currency`] with similar functionality is also //! used in the codebase, however this trait is deprecated and existing logic is in the process of @@ -68,5 +71,20 @@ //! //! ## Fungible Token Trait Implementations in Substrate //! -//! [`pallet_balances`] is the most common fungible token implementation, usually used for the -//! network native token. +//! [`pallet_balances`] implements [`frame_support::traits::fungible`], and is the most commonly +//! used fungible implementation in Substrate. Most of the time, it's used for managing the native +//! token of the blockchain network. +//! +//! [`pallet_assets`] implements [`frame_support::traits::fungibles`], and is another popular +//! fungible token implementation. It supports the creation and management of multiple assets in a +//! single crate, making it a good choice when a network requires more assets in +//! addition to its native token. +//! +//! ## Non-Fungible Tokens in Substrate +//! +//! The [`pallet_uniques`] is recommended to use for all NFT use cases in Substrate. +//! See the crate documentation for more info about this pallet. +//! +//! The [`pallet_nfts`] is deprecatd and should not be used. +//! +//! akkk From 1d1b71e506d5d57a8549dd266392c0c2af228b6f Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Wed, 13 Mar 2024 17:33:34 +1100 Subject: [PATCH 04/49] wip fungible docs --- Cargo.lock | 2 + docs/sdk/Cargo.toml | 2 + .../frame_runtime_upgrades_and_migrations.rs | 1 - docs/sdk/src/reference_docs/mod.rs | 3 + .../src/reference_docs/tokens_in_substrate.rs | 19 +++-- substrate/frame/balances/src/lib.rs | 2 + .../support/src/traits/tokens/fungible/mod.rs | 70 ++++++++++++++++++- 7 files changed, 90 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f9dc32fe6a7b..49d7a2ae3c63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13476,6 +13476,7 @@ dependencies = [ "frame-support", "frame-system", "kitchensink-runtime", + "pallet-assets", "pallet-aura", "pallet-authorship", "pallet-balances", @@ -13487,6 +13488,7 @@ dependencies = [ "pallet-examples", "pallet-multisig", "pallet-nfts", + "pallet-preimage", "pallet-proxy", "pallet-scheduler", "pallet-timestamp", diff --git a/docs/sdk/Cargo.toml b/docs/sdk/Cargo.toml index cee1d2ef964d..fee21946827d 100644 --- a/docs/sdk/Cargo.toml +++ b/docs/sdk/Cargo.toml @@ -65,6 +65,8 @@ pallet-aura = { path = "../../substrate/frame/aura", default-features = false } # Pallets and FRAME internals pallet-timestamp = { path = "../../substrate/frame/timestamp" } pallet-balances = { path = "../../substrate/frame/balances" } +pallet-assets = { path = "../../substrate/frame/assets" } +pallet-preimage = { path = "../../substrate/frame/preimage" } pallet-transaction-payment = { path = "../../substrate/frame/transaction-payment" } pallet-utility = { path = "../../substrate/frame/utility" } pallet-multisig = { path = "../../substrate/frame/multisig" } diff --git a/docs/sdk/src/reference_docs/frame_runtime_upgrades_and_migrations.rs b/docs/sdk/src/reference_docs/frame_runtime_upgrades_and_migrations.rs index 7d870b432218..e6015658fd23 100644 --- a/docs/sdk/src/reference_docs/frame_runtime_upgrades_and_migrations.rs +++ b/docs/sdk/src/reference_docs/frame_runtime_upgrades_and_migrations.rs @@ -131,7 +131,6 @@ //! //! TODO: Link to multi block migration example/s once PR is merged (). //! -//! [`GetStorageVersion`]: frame_support::traits::GetStorageVersion //! [`OnRuntimeUpgrade`]: frame_support::traits::OnRuntimeUpgrade //! [`StorageVersion`]: frame_support::traits::StorageVersion //! [`set_code`]: frame_system::Call::set_code diff --git a/docs/sdk/src/reference_docs/mod.rs b/docs/sdk/src/reference_docs/mod.rs index 0bd204e4b6ab..105822336ccd 100644 --- a/docs/sdk/src/reference_docs/mod.rs +++ b/docs/sdk/src/reference_docs/mod.rs @@ -32,6 +32,9 @@ pub mod glossary; /// Learn about the WASM meta-protocol of all Substrate-based chains. pub mod wasm_meta_protocol; +/// Learn about the token-related logic in Substrate and how to use it. +pub mod tokens_in_substrate; + /// Learn about the differences between smart contracts and a FRAME-based runtime. They are both /// "code stored onchain", but how do they differ? pub mod runtime_vs_smart_contract; diff --git a/docs/sdk/src/reference_docs/tokens_in_substrate.rs b/docs/sdk/src/reference_docs/tokens_in_substrate.rs index 5f624ffc9392..fa6004a7f39a 100644 --- a/docs/sdk/src/reference_docs/tokens_in_substrate.rs +++ b/docs/sdk/src/reference_docs/tokens_in_substrate.rs @@ -34,11 +34,12 @@ //! trait implementations. //! //! *Traits* define common interfaces that types of token should implement. For example, the -//! [`fungible::Inspect`] trait specifies that implementations of this trait must contain methods -//! for accessing the total issuance of the token, the balance of individual accounts, etc. +//! [`frame_support::traits::fungible::Inspect`] trait specifies that implementations of this trait +//! must contain methods for accessing the total issuance of the token, the balance of individual +//! accounts, etc. //! //! *Trait implementations* are concrete implementations of these traits. For example, one of the -//! many traits [`pallet_balances`] implements is [`fungible::Inspect`]. +//! many traits [`pallet_balances`] implements is [`frame_support::traits::fungible::Inspect`]. //! //! The distinction between traits and trait implementations is helpful because it allows pallets //! and other logic to be generic over their dependencies, avoiding cumbersome and unwieldy tight @@ -82,9 +83,15 @@ //! //! ## Non-Fungible Tokens in Substrate //! -//! The [`pallet_uniques`] is recommended to use for all NFT use cases in Substrate. +//! [`pallet_uniques`] is recommended to use for all NFT use cases in Substrate. //! See the crate documentation for more info about this pallet. //! -//! The [`pallet_nfts`] is deprecatd and should not be used. +//! [`pallet_nfts`] is deprecated and should not be used. //! -//! akkk +//! # What Next? +//! +//! - If you are interested in implementing a single fungible token, continue reading the +//! [`frame_support::traits::fungible`] and [`pallet_balances`] docs. +//! - If you are interested in implementing a set of fungible tokens, continue reading the +//! [`frame_support::traits::fungibles`] trait and [`pallet_assets`] docs. +//! - If you are interested in implementing an NFT, continue reading the [`pallet_uniques`] docs. diff --git a/substrate/frame/balances/src/lib.rs b/substrate/frame/balances/src/lib.rs index eb21210c417e..2378bda479fa 100644 --- a/substrate/frame/balances/src/lib.rs +++ b/substrate/frame/balances/src/lib.rs @@ -157,6 +157,8 @@ //! //! Note, you may find the Balances pallet still functions with an ED of zero in some circumstances, //! however this is not a configuration which is generally supported, nor will it be. +//! +//! [`tokens_in_substrate`]: ../polkadot_sdk_docs/reference_docs/tokens_in_substrate/index.html #![cfg_attr(not(feature = "std"), no_std)] mod benchmarking; diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index 3df983fcb561..8320130db014 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -41,9 +41,75 @@ //! funds must be removed from an account before it is known precisely what should be done with //! them. //! -//! # Holds vs. Freezes +//! ## Terminology //! -//! TODO: Differentiate between the two. +//! ### Total Balance +//! +//! The sum of an accounts free and held balances. +//! +//! ### Free Balance +//! +//! A portion of an accounts total balance that is not held. +//! +//! ### Held Balance +//! +//! A portion of a users total balance that is not free. +//! +//! Multiple holds stack rather than overlay. This means that if an account has +//! 3 locks for 100 units, the account can spend it's funds for any reason down to 300 units, at +//! which point the holds will start to come into play. +//! +//! Multiple holds are stack on top of another (cumulative) rather than overlay another. +//! +//! ### Frozen Balance +//! +//! An minimum amount a user should not be allowed to withdraw below. +//! +//! Multiple freezes overlay rather than stack on top of another. This means that if an account has +//! 3 locks for 100 units, the account can spend it's funds for any reason down to 100 units, at +//! which point the freezes will start to come into play. +//! +//! ### Minimum Balance (a.k.a. Existential Deposit, a.k.a. ED) +//! +//! The minimum amount of balance that an account must have to exist. +//! +//! ### Untouchable Balance +//! +//! The part of a users free balance they cannot spend, due to ED or Freeze/s. +//! +//! ### Spendable Balance +//! +//! The part of a users free balance they can spend. +//! +//! ## Visualising Balance Components Together 💫 +//! +//! ```ignore +//! |__total__________________________________| +//! |__on_hold__|_____________free____________| +//! |__________frozen___________| +//! |__on_hold__|__ed__| +//! |__untouchable__|__spendable__| +//! ``` +//! +//! ## Holds vs. Freezes +//! +//! Both holds and freezes are used to prevent an account from using some of its balance. +//! +//! The primary distinction between the two are that: +//! - Holds are cumulative (do not overlap) and are distinct from the free balance +//! - Freezes are not cumulative, and can overlap with each other or with holds +//! +//! ```ignore +//! |__total_____________________________| +//! |__hold_a__|__hold_b__|_____free_____| +//! |__on_hold____________| // <- the sum of all holds +//! |__freeze_a_______________| +//! |__freeze_b____| +//! |__freeze_c________| +//! |__frozen_________________| // <- the max of all freezes +//! ``` +//! +//! [`tokens_in_substrate`]: ../../../../polkadot_sdk_docs/reference_docs/tokens_in_substrate/index.html pub mod conformance_tests; pub mod freeze; From 3a0c39cea0f9eb82756fdaf9b754c9f06fd7c984 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 13:04:54 +1100 Subject: [PATCH 05/49] document pallets and traits --- docs/sdk/src/reference_docs/mod.rs | 2 +- .../src/reference_docs/tokens_in_substrate.rs | 28 ++++---- substrate/frame/assets/src/lib.rs | 13 +++- substrate/frame/balances/src/lib.rs | 71 +++++++------------ .../support/src/traits/tokens/currency.rs | 3 + .../support/src/traits/tokens/fungible/mod.rs | 63 +++++++++------- .../src/traits/tokens/fungibles/mod.rs | 8 ++- 7 files changed, 99 insertions(+), 89 deletions(-) diff --git a/docs/sdk/src/reference_docs/mod.rs b/docs/sdk/src/reference_docs/mod.rs index 66f7a29a21fc..fd50a361f079 100644 --- a/docs/sdk/src/reference_docs/mod.rs +++ b/docs/sdk/src/reference_docs/mod.rs @@ -32,7 +32,7 @@ pub mod glossary; /// Learn about the WASM meta-protocol of all Substrate-based chains. pub mod wasm_meta_protocol; -/// Learn about the token-related logic in Substrate and how to use it. +/// Learn about the token-related logic in Substrate and how to apply it to your usecase. pub mod tokens_in_substrate; /// Learn about the differences between smart contracts and a FRAME-based runtime. They are both diff --git a/docs/sdk/src/reference_docs/tokens_in_substrate.rs b/docs/sdk/src/reference_docs/tokens_in_substrate.rs index fa6004a7f39a..4cf7041bd205 100644 --- a/docs/sdk/src/reference_docs/tokens_in_substrate.rs +++ b/docs/sdk/src/reference_docs/tokens_in_substrate.rs @@ -18,31 +18,30 @@ //! # Tokens in Substrate //! //! This reference doc serves as a high-level overview of the token-related logic in Substrate and -//! how to use it. +//! how to properly apply it to your usecase. //! //! On completion of reading this doc, you should have a good understanding of //! - The distinction between token traits and trait implementations in Substrate, and why this //! distinction is helpful -//! - The token-related traits avaliable in Substrate -//! - The token-related trait implementations in Substrate +//! - Token-related traits avaliable in Substrate +//! - Token-related trait implementations in Substrate //! - How to choose the right trait or trait implementation for your use case //! - Where to go next //! //! ## Traits and Trait Implementations //! -//! Broardly speaking, token logic in Substrate can be divided into two categories: traits, and +//! Broardly speaking, token logic in Substrate can be divided into two categories: traits and //! trait implementations. //! -//! *Traits* define common interfaces that types of token should implement. For example, the -//! [`frame_support::traits::fungible::Inspect`] trait specifies that implementations of this trait -//! must contain methods for accessing the total issuance of the token, the balance of individual -//! accounts, etc. +//! **Traits** define common interfaces that types of token should implement. For example, the +//! [`frame_support::traits::fungible::Inspect`] trait specifies an interface for *inspecting* +//! token state such as the total issuance of the token, the balance of individual accounts, etc. //! -//! *Trait implementations* are concrete implementations of these traits. For example, one of the +//! **Trait implementations** are concrete implementations of these traits. For example, one of the //! many traits [`pallet_balances`] implements is [`frame_support::traits::fungible::Inspect`]. //! //! The distinction between traits and trait implementations is helpful because it allows pallets -//! and other logic to be generic over their dependencies, avoiding cumbersome and unwieldy tight +//! and other logic to be generic over their dependencies, avoiding cumbersome pallet tight //! coupling. //! //! To illustrate this with an example let's consider [`pallet_preimage`]. This pallet takes a @@ -50,12 +49,13 @@ //! pallet may use [`pallet_balances`] as a dependency, and directly call the methods exposed by //! [`pallet_balances`] to reserve and unreserve deposits. This approach works well, until someone //! has a usecase requiring that an asset from a different pallet such as [`pallet_assets`] is -//! used for the deposit. Rather than tightly couple [`pallet_preimage`] to [`pallet_balances`], +//! used for the deposit. Rather than tightly couple [`pallet_preimage`] to [`pallet_balances`] AND //! [`pallet_assets`], along with every other token type pallet a user could possibly specify, //! [`pallet_preimage`] does not specify a concrete pallet as a dependency but instead accepts any -//! dependency which implements the `Reservable` trait. This allows [`pallet_preimage`] to support -//! any arbitrary pallet implementing this trait, without needing any knowledge of what those -//! pallets may be or requiring changes to support new pallets which may be written. +//! dependency which implements the [`frame_support::traits::tokens::currency::ReservableCurrency`] +//! trait. This allows [`pallet_preimage`] to support any arbitrary pallet implementing this trait, +//! without needing any knowledge of what those pallets may be or requiring changes to support new +//! pallets which may be written in the future. //! //! ## Fungible Token Traits in Substrate //! diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs index 09d59ae1b8b5..e3adc47c1dd9 100644 --- a/substrate/frame/assets/src/lib.rs +++ b/substrate/frame/assets/src/lib.rs @@ -17,7 +17,16 @@ //! # Assets Pallet //! -//! A simple, secure module for dealing with fungible assets. +//! A simple, secure module for dealing with sets of assets implementing +//! [`fungible`](frame_support::traits::fungible) traits, via +//! [`fungibles`](frame_support::traits::fungibles) traits. +//! +//! The pallet makes heavy use of concepts such as Holds and Freezes from the +//! [`frame_support::traits::fungible`] traits, therefore you should read and understand those docs +//! as a prerequisite to understanding this pallet. +//! +//! See the [`tokens_in_substrate`] reference docs for more information about the place of the +//! Assets pallet in Substrate. //! //! ## Overview //! @@ -133,6 +142,8 @@ //! //! * [`System`](../frame_system/index.html) //! * [`Support`](../frame_support/index.html) +//! +//! [`tokens_in_substrate`]: ../polkadot_sdk_docs/reference_docs/tokens_in_substrate/index.html // This recursion limit is needed because we have too many benchmarks and benchmarking will fail if // we add more without this limit. diff --git a/substrate/frame/balances/src/lib.rs b/substrate/frame/balances/src/lib.rs index 2378bda479fa..88478ab3a2a1 100644 --- a/substrate/frame/balances/src/lib.rs +++ b/substrate/frame/balances/src/lib.rs @@ -18,14 +18,14 @@ //! # Balances Pallet //! //! The Balances pallet provides functionality for handling accounts and balances for a single -//! token. It implements the fungible assets paradigm using a single currency. +//! token. //! -//! See the [`tokens_in_substrate`] reference docs for more information about the place of -//! this palet in Substrate. +//! It makes heavy use of concepts such as Holds and Freezes from the +//! [`frame_support::traits::fungible`] traits, therefore you should read and understand those docs +//! as a prerequisite to understanding this pallet. //! -//! - [`Config`] -//! - [`Call`] -//! - [`Pallet`] +//! Also see the [`tokens_in_substrate`] reference docs for higher level information regarding the +//! place of this palet in Substrate. //! //! ## Overview //! @@ -42,42 +42,30 @@ //! //! ### Terminology //! -//! - **Existential Deposit:** The minimum balance required to create or keep an account open. This -//! prevents "dust accounts" from filling storage. When the free plus the reserved balance (i.e. -//! the total balance) fall below this, then the account is said to be dead; and it loses its -//! functionality as well as any prior history and all information on it is removed from the -//! chain's state. No account should ever have a total balance that is strictly between 0 and the -//! existential deposit (exclusive). If this ever happens, it indicates either a bug in this -//! pallet or an erroneous raw mutation of storage. -//! -//! - **Total Issuance:** The total number of units in existence in a system. -//! //! - **Reaping an account:** The act of removing an account by resetting its nonce. Happens after //! its total balance has become zero (or, strictly speaking, less than the Existential Deposit). //! -//! - **Free Balance:** The portion of a balance that is not reserved. The free balance is the only -//! balance that matters for most operations. -//! -//! - **Reserved Balance:** Reserved balance still belongs to the account holder, but is suspended. -//! Reserved balance can still be slashed, but only after all the free balance has been slashed. +//! ### Implementations //! -//! - **Imbalance:** A condition when some funds were credited or debited without equal and opposite -//! accounting (i.e. a difference between total issuance and account balances). Functions that -//! result in an imbalance will return an object of the `Imbalance` trait that can be managed within -//! your runtime logic. (If an imbalance is simply dropped, it should automatically maintain any -//! book-keeping such as total issuance.) +//! The Balances pallet provides implementations for the following [`fungible`] traits. If these +//! traits provide the functionality that you need, then you can avoid coupling with the Balances +//! pallet. //! -//! - **Lock:** A freeze on a specified amount of an account's free balance until a specified block -//! number. Multiple locks always operate over the same funds, so they "overlay" rather than -//! "stack". +//! - [`fungible::Inspect`] +//! - [`fungible::Mutate`] +//! - [`fungible::Unbalanced`] +//! - [`fungible::Balanced`] +//! - [`fungible::BalancedHold`] +//! - [`fungible::InspectHold`] +//! - [`fungible::MutateHold`] +//! - [`fungible::InspectFreeze`] +//! - [`fungible::MutateFreeze`] +//! - [`fungible::Imbalance`] //! -//! ### Implementations +//! It also implements the following [`Currency`] related traits, however they are deprecated and +//! will eventually be removed. //! -//! The Balances pallet provides implementations for the following traits. If these traits provide -//! the functionality that you need, then you can avoid coupling with the Balances pallet. -//! -//! - [`Currency`]: Functions for dealing with a -//! fungible assets system. +//! - [`Currency`]: Functions for dealing with a fungible assets system. //! - [`ReservableCurrency`] //! - [`NamedReservableCurrency`](frame_support::traits::NamedReservableCurrency): //! Functions for dealing with assets that can be reserved from an account. @@ -87,14 +75,6 @@ //! imbalances between total issuance in the system and account balances. Must be used when a //! function creates new funds (e.g. a reward) or destroys some funds (e.g. a system fee). //! -//! ## Interface -//! -//! ### Dispatchable Functions -//! -//! - `transfer_allow_death` - Transfer some liquid free balance to another account. -//! - `force_set_balance` - Set the balances of a given account. The origin of this call must be -//! root. -//! //! ## Usage //! //! The following examples show how to use the Balances pallet in your custom pallet. @@ -155,8 +135,9 @@ //! * Total issued balanced of all accounts should be less than `Config::Balance::max_value()`. //! * Existential Deposit is set to a value greater than zero. //! -//! Note, you may find the Balances pallet still functions with an ED of zero in some circumstances, -//! however this is not a configuration which is generally supported, nor will it be. +//! Note, you may find the Balances pallet still functions with an ED of zero when the +//! `insecure_zero_ed` cargo feature is enabled. However this is not a configuration which is +//! generally supported, nor will it be. //! //! [`tokens_in_substrate`]: ../polkadot_sdk_docs/reference_docs/tokens_in_substrate/index.html diff --git a/substrate/frame/support/src/traits/tokens/currency.rs b/substrate/frame/support/src/traits/tokens/currency.rs index 8b773115011d..bb23d67816a4 100644 --- a/substrate/frame/support/src/traits/tokens/currency.rs +++ b/substrate/frame/support/src/traits/tokens/currency.rs @@ -16,6 +16,9 @@ // limitations under the License. //! The Currency trait and associated types. +//! +//! Note Currency and related traits are deprecated, instead +//! [`fungible`](frame_support::traits::fungible) traits should be used. use super::{ imbalance::{Imbalance, SignedImbalance}, diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index 8320130db014..41b97bf15652 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -17,7 +17,7 @@ //! The traits for dealing with a single fungible token class and any associated types. //! -//! See the [`tokens_in_substrate`] reference docs for more information about the place of +//! Also see the [`tokens_in_substrate`] reference docs for more information about the place of //! `fungible` traits in Substrate. //! //! # Avaliable Traits @@ -43,43 +43,47 @@ //! //! ## Terminology //! -//! ### Total Balance +//! - **Total Issuance**: The total number of units in existence in a system. //! -//! The sum of an accounts free and held balances. +//! - **Total Balance**: The sum of an accounts free and held balances. //! -//! ### Free Balance +//! - **Free Balance**: A portion of an accounts total balance that is not held. //! -//! A portion of an accounts total balance that is not held. +//! - **Held Balance**: Held balance still belongs to the account holder, but is suspended. It can +//! be slashed, but only after all the free balance has been slashed. //! -//! ### Held Balance +//! Multiple holds stack rather than overlay. This means that if an account has +//! 3 locks for 100 units, the account can spend it's funds for any reason down to 300 units, at +//! which point the holds will start to come into play. //! -//! A portion of a users total balance that is not free. +//! - **Frozen Balance**: A freeze on a specified amount of an account's free balance until a +//! specified block number. //! -//! Multiple holds stack rather than overlay. This means that if an account has -//! 3 locks for 100 units, the account can spend it's funds for any reason down to 300 units, at -//! which point the holds will start to come into play. +//! Multiple freezes always operate over the same funds, so they "overlay" rather than +//! "stack". This means that if an account has 3 freezes for 100 units, the account can spend it's +//! funds for any reason down to 100 units, at which point the freezes will start to come into +//! play. //! -//! Multiple holds are stack on top of another (cumulative) rather than overlay another. +//! - **Minimum Balance (a.k.a. Existential Deposit, a.k.a. ED)**: The minimum balance required to +//! create or keep an account open. This is to prevent "dust accounts" from filling storage. When +//! the free plus the held balance (i.e. the total balance) fall below this, then the account is +//! said to be dead; and it loses its functionality as well as any prior history and all +//! information on it is removed from the chain's state. No account should ever have a total +//! balance that is strictly between 0 and the existential deposit (exclusive). If this ever +//! happens, it indicates either a bug in this pallet or an erroneous raw mutation of storage. //! -//! ### Frozen Balance +//! - **Untouchable Balance**: The part of a users free balance they cannot spend, due to ED or +//! Freeze/s. //! -//! An minimum amount a user should not be allowed to withdraw below. +//! - **Spendable Balance**: The part of a users free balance they can spend. //! -//! Multiple freezes overlay rather than stack on top of another. This means that if an account has -//! 3 locks for 100 units, the account can spend it's funds for any reason down to 100 units, at -//! which point the freezes will start to come into play. +//! - **Imbalance**: A condition when some funds were credited or debited without equal and opposite +//! accounting (i.e. a difference between total issuance and account balances). Functions that +//! result in an imbalance will return an object of the [`imbalance::Credit`] or +//! [`imbalance::Debt`] traits that can be managed within your runtime logic. //! -//! ### Minimum Balance (a.k.a. Existential Deposit, a.k.a. ED) -//! -//! The minimum amount of balance that an account must have to exist. -//! -//! ### Untouchable Balance -//! -//! The part of a users free balance they cannot spend, due to ED or Freeze/s. -//! -//! ### Spendable Balance -//! -//! The part of a users free balance they can spend. +//! If an imbalance is simply dropped, it should automatically maintain any book-keeping such as +//! total issuance. //! //! ## Visualising Balance Components Together 💫 //! @@ -109,6 +113,11 @@ //! |__frozen_________________| // <- the max of all freezes //! ``` //! +//! ## Sets of Tokens +//! +//! For managing sets of tokens, see the [`fungibles`](`frame_support::traits::fungibles`) trait +//! which is a wrapper around this trait but supporting multiple asset instances. +//! //! [`tokens_in_substrate`]: ../../../../polkadot_sdk_docs/reference_docs/tokens_in_substrate/index.html pub mod conformance_tests; diff --git a/substrate/frame/support/src/traits/tokens/fungibles/mod.rs b/substrate/frame/support/src/traits/tokens/fungibles/mod.rs index 1db0706ba4fd..f3d8a1b5a032 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/mod.rs @@ -15,7 +15,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! The traits for sets of fungible tokens and any associated types. +//! The traits for *sets* of [`fungible`](`frame_support::traits::fungible`) tokens and any +//! associated types. +//! +//! Also see the [`tokens_in_substrate`] reference docs for more information about the place of +//! `fungible` traits in Substrate. +//! +//! [`tokens_in_substrate`]: ../../../../polkadot_sdk_docs/reference_docs/tokens_in_substrate/index.html pub mod approvals; mod enumerable; From 5d4e2d4cf83766bb88af63ce8fd24ad2c7e1d696 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:48:08 +1100 Subject: [PATCH 06/49] Update docs/sdk/src/reference_docs/tokens_in_substrate.rs Co-authored-by: Bill Laboon --- docs/sdk/src/reference_docs/tokens_in_substrate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/tokens_in_substrate.rs b/docs/sdk/src/reference_docs/tokens_in_substrate.rs index 4cf7041bd205..437d78a60675 100644 --- a/docs/sdk/src/reference_docs/tokens_in_substrate.rs +++ b/docs/sdk/src/reference_docs/tokens_in_substrate.rs @@ -30,7 +30,7 @@ //! //! ## Traits and Trait Implementations //! -//! Broardly speaking, token logic in Substrate can be divided into two categories: traits and +//! Broadly speaking, token logic in Substrate can be divided into two categories: traits and //! trait implementations. //! //! **Traits** define common interfaces that types of token should implement. For example, the From f0e9ce57bcc679ba3aee4f239b47a949ee1f56ab Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:48:21 +1100 Subject: [PATCH 07/49] Update substrate/frame/support/src/traits/tokens/fungible/mod.rs Co-authored-by: Bill Laboon --- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index 41b97bf15652..78376464b8b0 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -72,7 +72,7 @@ //! balance that is strictly between 0 and the existential deposit (exclusive). If this ever //! happens, it indicates either a bug in this pallet or an erroneous raw mutation of storage. //! -//! - **Untouchable Balance**: The part of a users free balance they cannot spend, due to ED or +//! - **Untouchable Balance**: The part of a user's free balance they cannot spend, due to ED or //! Freeze/s. //! //! - **Spendable Balance**: The part of a users free balance they can spend. From 304b6a705e493e48f8000cb6fe9e1fa648cc392d Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:48:27 +1100 Subject: [PATCH 08/49] Update substrate/frame/support/src/traits/tokens/fungible/mod.rs Co-authored-by: Bill Laboon --- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index 78376464b8b0..4708e510c78a 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -75,7 +75,7 @@ //! - **Untouchable Balance**: The part of a user's free balance they cannot spend, due to ED or //! Freeze/s. //! -//! - **Spendable Balance**: The part of a users free balance they can spend. +//! - **Spendable Balance**: The part of a user's free balance they can spend. //! //! - **Imbalance**: A condition when some funds were credited or debited without equal and opposite //! accounting (i.e. a difference between total issuance and account balances). Functions that From bacaa728503986057442de4ac23801085d5eb014 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:48:40 +1100 Subject: [PATCH 09/49] Update substrate/frame/support/src/traits/tokens/fungible/mod.rs Co-authored-by: Bill Laboon --- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index 4708e510c78a..4361b28d8074 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -53,7 +53,7 @@ //! be slashed, but only after all the free balance has been slashed. //! //! Multiple holds stack rather than overlay. This means that if an account has -//! 3 locks for 100 units, the account can spend it's funds for any reason down to 300 units, at +//! 3 locks for 100 units, the account can spend its funds for any reason down to 300 units, at //! which point the holds will start to come into play. //! //! - **Frozen Balance**: A freeze on a specified amount of an account's free balance until a From 25c1cb3672ff66fcc173e5c41e95bc605d157e32 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:48:46 +1100 Subject: [PATCH 10/49] Update substrate/frame/support/src/traits/tokens/fungible/mod.rs Co-authored-by: Bill Laboon --- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index 4361b28d8074..49f61f5747db 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -60,7 +60,7 @@ //! specified block number. //! //! Multiple freezes always operate over the same funds, so they "overlay" rather than -//! "stack". This means that if an account has 3 freezes for 100 units, the account can spend it's +//! "stack". This means that if an account has 3 freezes for 100 units, the account can spend its //! funds for any reason down to 100 units, at which point the freezes will start to come into //! play. //! From e86c7a9da42f969076eb4bd58e6fc9d2997c3044 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:48:53 +1100 Subject: [PATCH 11/49] Update substrate/frame/support/src/traits/tokens/fungible/mod.rs Co-authored-by: Bill Laboon --- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index 49f61f5747db..c883a9ce2229 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -45,7 +45,7 @@ //! //! - **Total Issuance**: The total number of units in existence in a system. //! -//! - **Total Balance**: The sum of an accounts free and held balances. +//! - **Total Balance**: The sum of an account's free and held balances. //! //! - **Free Balance**: A portion of an accounts total balance that is not held. //! From 41a3cb8ed3d547ecd52a296b0efdb65e4d915390 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:48:59 +1100 Subject: [PATCH 12/49] Update substrate/frame/support/src/traits/tokens/fungible/mod.rs Co-authored-by: Bill Laboon --- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index c883a9ce2229..d673ce322784 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -47,7 +47,7 @@ //! //! - **Total Balance**: The sum of an account's free and held balances. //! -//! - **Free Balance**: A portion of an accounts total balance that is not held. +//! - **Free Balance**: A portion of an account's total balance that is not held. //! //! - **Held Balance**: Held balance still belongs to the account holder, but is suspended. It can //! be slashed, but only after all the free balance has been slashed. From f389aa7cd35f77805095f7d4e2a18678ce8d2d34 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:49:06 +1100 Subject: [PATCH 13/49] Update docs/sdk/src/reference_docs/mod.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/mod.rs b/docs/sdk/src/reference_docs/mod.rs index 004810551db7..564be156669f 100644 --- a/docs/sdk/src/reference_docs/mod.rs +++ b/docs/sdk/src/reference_docs/mod.rs @@ -32,7 +32,7 @@ pub mod glossary; /// Learn about the WASM meta-protocol of all Substrate-based chains. pub mod wasm_meta_protocol; -/// Learn about the token-related logic in Substrate and how to apply it to your usecase. +/// Learn about the token-related logic in Substrate and how to apply it to your use case. pub mod tokens_in_substrate; /// Learn about the differences between smart contracts and a FRAME-based runtime. They are both From 9ff81e1ddafeaf95300106d80e58723cc899d3ca Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:49:14 +1100 Subject: [PATCH 14/49] Update docs/sdk/src/reference_docs/tokens_in_substrate.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/tokens_in_substrate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/tokens_in_substrate.rs b/docs/sdk/src/reference_docs/tokens_in_substrate.rs index 437d78a60675..e98712764e0b 100644 --- a/docs/sdk/src/reference_docs/tokens_in_substrate.rs +++ b/docs/sdk/src/reference_docs/tokens_in_substrate.rs @@ -18,7 +18,7 @@ //! # Tokens in Substrate //! //! This reference doc serves as a high-level overview of the token-related logic in Substrate and -//! how to properly apply it to your usecase. +//! how to properly apply it to your use case. //! //! On completion of reading this doc, you should have a good understanding of //! - The distinction between token traits and trait implementations in Substrate, and why this From c8d04a9c25272fedd66ccee5d0e865095f06b400 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:49:20 +1100 Subject: [PATCH 15/49] Update docs/sdk/src/reference_docs/tokens_in_substrate.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/tokens_in_substrate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/tokens_in_substrate.rs b/docs/sdk/src/reference_docs/tokens_in_substrate.rs index e98712764e0b..852d6d688b9e 100644 --- a/docs/sdk/src/reference_docs/tokens_in_substrate.rs +++ b/docs/sdk/src/reference_docs/tokens_in_substrate.rs @@ -20,7 +20,7 @@ //! This reference doc serves as a high-level overview of the token-related logic in Substrate and //! how to properly apply it to your use case. //! -//! On completion of reading this doc, you should have a good understanding of +//! On completion of reading this doc, you should have a good understanding of: //! - The distinction between token traits and trait implementations in Substrate, and why this //! distinction is helpful //! - Token-related traits avaliable in Substrate From 34d33a3d5de8f5a217f8e89c499d84deadc7f144 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:49:40 +1100 Subject: [PATCH 16/49] Update docs/sdk/src/reference_docs/tokens_in_substrate.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/tokens_in_substrate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/tokens_in_substrate.rs b/docs/sdk/src/reference_docs/tokens_in_substrate.rs index 852d6d688b9e..a1e977123569 100644 --- a/docs/sdk/src/reference_docs/tokens_in_substrate.rs +++ b/docs/sdk/src/reference_docs/tokens_in_substrate.rs @@ -33,7 +33,7 @@ //! Broadly speaking, token logic in Substrate can be divided into two categories: traits and //! trait implementations. //! -//! **Traits** define common interfaces that types of token should implement. For example, the +//! **Traits** define common interfaces that types of tokens should implement. For example, the //! [`frame_support::traits::fungible::Inspect`] trait specifies an interface for *inspecting* //! token state such as the total issuance of the token, the balance of individual accounts, etc. //! From 39227f2ea94ddb7eb7f7f5ccca3e2e4a21eb444b Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:49:48 +1100 Subject: [PATCH 17/49] Update docs/sdk/src/reference_docs/tokens_in_substrate.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/tokens_in_substrate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/tokens_in_substrate.rs b/docs/sdk/src/reference_docs/tokens_in_substrate.rs index a1e977123569..099d836db15a 100644 --- a/docs/sdk/src/reference_docs/tokens_in_substrate.rs +++ b/docs/sdk/src/reference_docs/tokens_in_substrate.rs @@ -48,7 +48,7 @@ //! deposit in exchange for storing some preimage for use later. A naive implementation of the //! pallet may use [`pallet_balances`] as a dependency, and directly call the methods exposed by //! [`pallet_balances`] to reserve and unreserve deposits. This approach works well, until someone -//! has a usecase requiring that an asset from a different pallet such as [`pallet_assets`] is +//! has a use case requiring that an asset from a different pallet such as [`pallet_assets`] is //! used for the deposit. Rather than tightly couple [`pallet_preimage`] to [`pallet_balances`] AND //! [`pallet_assets`], along with every other token type pallet a user could possibly specify, //! [`pallet_preimage`] does not specify a concrete pallet as a dependency but instead accepts any From fc1002728f8750dc35289a75acaa7c500a4a3cc0 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:50:02 +1100 Subject: [PATCH 18/49] Update docs/sdk/src/reference_docs/tokens_in_substrate.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/tokens_in_substrate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/tokens_in_substrate.rs b/docs/sdk/src/reference_docs/tokens_in_substrate.rs index 099d836db15a..d9f1a307fae6 100644 --- a/docs/sdk/src/reference_docs/tokens_in_substrate.rs +++ b/docs/sdk/src/reference_docs/tokens_in_substrate.rs @@ -50,7 +50,7 @@ //! [`pallet_balances`] to reserve and unreserve deposits. This approach works well, until someone //! has a use case requiring that an asset from a different pallet such as [`pallet_assets`] is //! used for the deposit. Rather than tightly couple [`pallet_preimage`] to [`pallet_balances`] AND -//! [`pallet_assets`], along with every other token type pallet a user could possibly specify, +//! [`pallet_assets`], along with every other token-handling pallet a user could possibly specify, //! [`pallet_preimage`] does not specify a concrete pallet as a dependency but instead accepts any //! dependency which implements the [`frame_support::traits::tokens::currency::ReservableCurrency`] //! trait. This allows [`pallet_preimage`] to support any arbitrary pallet implementing this trait, From 4ad31f5c536e1b080859632c989838fb960e9cd3 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:51:19 +1100 Subject: [PATCH 19/49] Update docs/sdk/src/reference_docs/tokens_in_substrate.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/tokens_in_substrate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/tokens_in_substrate.rs b/docs/sdk/src/reference_docs/tokens_in_substrate.rs index d9f1a307fae6..91ba002af39c 100644 --- a/docs/sdk/src/reference_docs/tokens_in_substrate.rs +++ b/docs/sdk/src/reference_docs/tokens_in_substrate.rs @@ -60,7 +60,7 @@ //! ## Fungible Token Traits in Substrate //! //! The [`frame_support::traits::fungible`] crate contains the latest set of Substrate -//! fungible token traits, and is recommended to use for all new logic requiring a fungible tokens. +//! fungible token traits, and is recommended to use for all new logic requiring a fungible token. //! See the crate documentation for more info about these fungible traits. //! //! [`frame_support::traits::fungibles`] provides very similar functionality to From e56bcbf15a4799c026bd025cd06fa0d115051673 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:51:32 +1100 Subject: [PATCH 20/49] Update substrate/frame/balances/src/lib.rs Co-authored-by: Francisco Aguirre --- substrate/frame/balances/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/balances/src/lib.rs b/substrate/frame/balances/src/lib.rs index 88478ab3a2a1..82ef03deae7b 100644 --- a/substrate/frame/balances/src/lib.rs +++ b/substrate/frame/balances/src/lib.rs @@ -48,7 +48,7 @@ //! ### Implementations //! //! The Balances pallet provides implementations for the following [`fungible`] traits. If these -//! traits provide the functionality that you need, then you can avoid coupling with the Balances +//! traits provide the functionality that you need, then you should avoid tight coupling with the Balances //! pallet. //! //! - [`fungible::Inspect`] From 58aca9742408180ed1ea0ec89dbecd5e3d6561b3 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:51:55 +1100 Subject: [PATCH 21/49] Update substrate/frame/support/src/traits/tokens/fungible/mod.rs Co-authored-by: Francisco Aguirre --- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index d673ce322784..7abd47a7e883 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -70,7 +70,7 @@ //! said to be dead; and it loses its functionality as well as any prior history and all //! information on it is removed from the chain's state. No account should ever have a total //! balance that is strictly between 0 and the existential deposit (exclusive). If this ever -//! happens, it indicates either a bug in this pallet or an erroneous raw mutation of storage. +//! happens, it indicates either a bug in the implementation of this trait or an erroneous raw mutation of storage. //! //! - **Untouchable Balance**: The part of a user's free balance they cannot spend, due to ED or //! Freeze/s. From ca849d04a1353e95f3b9a780981dcf77b4fc16ba Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:52:01 +1100 Subject: [PATCH 22/49] Update substrate/frame/support/src/traits/tokens/fungible/mod.rs Co-authored-by: Francisco Aguirre --- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index 7abd47a7e883..5bafc046fea9 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -73,7 +73,7 @@ //! happens, it indicates either a bug in the implementation of this trait or an erroneous raw mutation of storage. //! //! - **Untouchable Balance**: The part of a user's free balance they cannot spend, due to ED or -//! Freeze/s. +//! Freeze(s). //! //! - **Spendable Balance**: The part of a user's free balance they can spend. //! From 610135222215faef3fd517e9819665d9d3fa2ba0 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Mar 2024 21:52:17 +1100 Subject: [PATCH 23/49] Update docs/sdk/src/reference_docs/tokens_in_substrate.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/tokens_in_substrate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/tokens_in_substrate.rs b/docs/sdk/src/reference_docs/tokens_in_substrate.rs index 91ba002af39c..5fe467647bdf 100644 --- a/docs/sdk/src/reference_docs/tokens_in_substrate.rs +++ b/docs/sdk/src/reference_docs/tokens_in_substrate.rs @@ -74,7 +74,7 @@ //! //! [`pallet_balances`] implements [`frame_support::traits::fungible`], and is the most commonly //! used fungible implementation in Substrate. Most of the time, it's used for managing the native -//! token of the blockchain network. +//! token of the blockchain network it's used in. //! //! [`pallet_assets`] implements [`frame_support::traits::fungibles`], and is another popular //! fungible token implementation. It supports the creation and management of multiple assets in a From 566dd5d994f7fcda3f7612602dc8b69748896087 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 19 Mar 2024 16:16:02 +1100 Subject: [PATCH 24/49] rename frame tokens --- .../{tokens_in_substrate.rs => frame_tokens.rs} | 4 ++-- docs/sdk/src/reference_docs/mod.rs | 6 +++--- substrate/frame/assets/src/lib.rs | 4 ++-- substrate/frame/balances/src/lib.rs | 4 ++-- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 4 ++-- substrate/frame/support/src/traits/tokens/fungibles/mod.rs | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) rename docs/sdk/src/reference_docs/{tokens_in_substrate.rs => frame_tokens.rs} (98%) diff --git a/docs/sdk/src/reference_docs/tokens_in_substrate.rs b/docs/sdk/src/reference_docs/frame_tokens.rs similarity index 98% rename from docs/sdk/src/reference_docs/tokens_in_substrate.rs rename to docs/sdk/src/reference_docs/frame_tokens.rs index 5fe467647bdf..f7adb549a7c9 100644 --- a/docs/sdk/src/reference_docs/tokens_in_substrate.rs +++ b/docs/sdk/src/reference_docs/frame_tokens.rs @@ -15,9 +15,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! # Tokens in Substrate +//! # FRAME Tokens //! -//! This reference doc serves as a high-level overview of the token-related logic in Substrate and +//! This reference doc serves as a high-level overview of the token-related logic in FRAME, and //! how to properly apply it to your use case. //! //! On completion of reading this doc, you should have a good understanding of: diff --git a/docs/sdk/src/reference_docs/mod.rs b/docs/sdk/src/reference_docs/mod.rs index 564be156669f..1d83b78afd2d 100644 --- a/docs/sdk/src/reference_docs/mod.rs +++ b/docs/sdk/src/reference_docs/mod.rs @@ -32,9 +32,6 @@ pub mod glossary; /// Learn about the WASM meta-protocol of all Substrate-based chains. pub mod wasm_meta_protocol; -/// Learn about the token-related logic in Substrate and how to apply it to your use case. -pub mod tokens_in_substrate; - /// Learn about the differences between smart contracts and a FRAME-based runtime. They are both /// "code stored onchain", but how do they differ? pub mod runtime_vs_smart_contract; @@ -79,6 +76,9 @@ pub mod development_environment_advice; // TODO: @shawntabrizi @ggwpez https://github.com/paritytech/polkadot-sdk-docs/issues/50 pub mod frame_benchmarking_weight; +/// Learn about the token-related logic in FRAME and how to apply it to your use case. +pub mod frame_tokens; + /// Learn about chain specification file and the genesis state of the blockchain. // TODO: @michalkucharczyk https://github.com/paritytech/polkadot-sdk-docs/issues/51 pub mod chain_spec_genesis; diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs index 234bfa6eab24..af888d3eff55 100644 --- a/substrate/frame/assets/src/lib.rs +++ b/substrate/frame/assets/src/lib.rs @@ -25,7 +25,7 @@ //! [`frame_support::traits::fungible`] traits, therefore you should read and understand those docs //! as a prerequisite to understanding this pallet. //! -//! See the [`tokens_in_substrate`] reference docs for more information about the place of the +//! See the [`frame_tokens`] reference docs for more information about the place of the //! Assets pallet in Substrate. //! //! ## Overview @@ -143,7 +143,7 @@ //! * [`System`](../frame_system/index.html) //! * [`Support`](../frame_support/index.html) //! -//! [`tokens_in_substrate`]: ../polkadot_sdk_docs/reference_docs/tokens_in_substrate/index.html +//! [`frame_tokens`]: ../polkadot_sdk_docs/reference_docs/frame_tokens/index.html // This recursion limit is needed because we have too many benchmarks and benchmarking will fail if // we add more without this limit. diff --git a/substrate/frame/balances/src/lib.rs b/substrate/frame/balances/src/lib.rs index 14dd2db1defc..ba14a5d978cd 100644 --- a/substrate/frame/balances/src/lib.rs +++ b/substrate/frame/balances/src/lib.rs @@ -24,7 +24,7 @@ //! [`frame_support::traits::fungible`] traits, therefore you should read and understand those docs //! as a prerequisite to understanding this pallet. //! -//! Also see the [`tokens_in_substrate`] reference docs for higher level information regarding the +//! Also see the [`frame_tokens`] reference docs for higher level information regarding the //! place of this palet in Substrate. //! //! ## Overview @@ -139,7 +139,7 @@ //! `insecure_zero_ed` cargo feature is enabled. However this is not a configuration which is //! generally supported, nor will it be. //! -//! [`tokens_in_substrate`]: ../polkadot_sdk_docs/reference_docs/tokens_in_substrate/index.html +//! [`frame_tokens`]: ../polkadot_sdk_docs/reference_docs/frame_tokens/index.html #![cfg_attr(not(feature = "std"), no_std)] mod benchmarking; diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index 5bafc046fea9..fdb14c5bdab0 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -17,7 +17,7 @@ //! The traits for dealing with a single fungible token class and any associated types. //! -//! Also see the [`tokens_in_substrate`] reference docs for more information about the place of +//! Also see the [`frame_tokens`] reference docs for more information about the place of //! `fungible` traits in Substrate. //! //! # Avaliable Traits @@ -118,7 +118,7 @@ //! For managing sets of tokens, see the [`fungibles`](`frame_support::traits::fungibles`) trait //! which is a wrapper around this trait but supporting multiple asset instances. //! -//! [`tokens_in_substrate`]: ../../../../polkadot_sdk_docs/reference_docs/tokens_in_substrate/index.html +//! [`frame_tokens`]: ../../../../polkadot_sdk_docs/reference_docs/frame_tokens/index.html pub mod conformance_tests; pub mod freeze; diff --git a/substrate/frame/support/src/traits/tokens/fungibles/mod.rs b/substrate/frame/support/src/traits/tokens/fungibles/mod.rs index f3d8a1b5a032..0ca4522ec98f 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/mod.rs @@ -18,10 +18,10 @@ //! The traits for *sets* of [`fungible`](`frame_support::traits::fungible`) tokens and any //! associated types. //! -//! Also see the [`tokens_in_substrate`] reference docs for more information about the place of +//! Also see the [`frame_tokens`] reference docs for more information about the place of //! `fungible` traits in Substrate. //! -//! [`tokens_in_substrate`]: ../../../../polkadot_sdk_docs/reference_docs/tokens_in_substrate/index.html +//! [`frame_tokens`]: ../../../../polkadot_sdk_docs/reference_docs/frame_tokens/index.html pub mod approvals; mod enumerable; From c0eab837aa4c74c2f4ef7b7e7a91be57f4e1bef0 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 19 Mar 2024 16:18:16 +1100 Subject: [PATCH 25/49] rustfmt --- substrate/frame/balances/src/lib.rs | 4 ++-- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/substrate/frame/balances/src/lib.rs b/substrate/frame/balances/src/lib.rs index ba14a5d978cd..ef53ecf6ceb5 100644 --- a/substrate/frame/balances/src/lib.rs +++ b/substrate/frame/balances/src/lib.rs @@ -48,8 +48,8 @@ //! ### Implementations //! //! The Balances pallet provides implementations for the following [`fungible`] traits. If these -//! traits provide the functionality that you need, then you should avoid tight coupling with the Balances -//! pallet. +//! traits provide the functionality that you need, then you should avoid tight coupling with the +//! Balances pallet. //! //! - [`fungible::Inspect`] //! - [`fungible::Mutate`] diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index fdb14c5bdab0..60224f6dd608 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -70,7 +70,8 @@ //! said to be dead; and it loses its functionality as well as any prior history and all //! information on it is removed from the chain's state. No account should ever have a total //! balance that is strictly between 0 and the existential deposit (exclusive). If this ever -//! happens, it indicates either a bug in the implementation of this trait or an erroneous raw mutation of storage. +//! happens, it indicates either a bug in the implementation of this trait or an erroneous raw +//! mutation of storage. //! //! - **Untouchable Balance**: The part of a user's free balance they cannot spend, due to ED or //! Freeze(s). From b884b43e86586c5f019c7c5989e19f694bb71cc8 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 19 Mar 2024 17:39:36 +1100 Subject: [PATCH 26/49] address comments --- .../reference_docs/frame_pallet_coupling.rs | 2 +- docs/sdk/src/reference_docs/frame_tokens.rs | 79 +++++++++++++------ 2 files changed, 55 insertions(+), 26 deletions(-) diff --git a/docs/sdk/src/reference_docs/frame_pallet_coupling.rs b/docs/sdk/src/reference_docs/frame_pallet_coupling.rs index cca7f9feb3f4..be464bbbf835 100644 --- a/docs/sdk/src/reference_docs/frame_pallet_coupling.rs +++ b/docs/sdk/src/reference_docs/frame_pallet_coupling.rs @@ -143,7 +143,7 @@ //! For example, all pallets in `polkadot-sdk` that needed to work with currencies could have been //! tightly coupled with [`pallet_balances`]. But, `polkadot-sdk` also provides [`pallet_assets`] //! (and more implementations by the community), therefore all pallets use traits to loosely couple -//! with balances or assets pallet. More on this in [`crate::reference_docs::frame_currency`]. +//! with balances or assets pallet. More on this in [`crate::reference_docs::frame_tokens`]. //! //! ## Further References //! diff --git a/docs/sdk/src/reference_docs/frame_tokens.rs b/docs/sdk/src/reference_docs/frame_tokens.rs index f7adb549a7c9..2a31b5bbdc0f 100644 --- a/docs/sdk/src/reference_docs/frame_tokens.rs +++ b/docs/sdk/src/reference_docs/frame_tokens.rs @@ -21,16 +21,33 @@ //! how to properly apply it to your use case. //! //! On completion of reading this doc, you should have a good understanding of: -//! - The distinction between token traits and trait implementations in Substrate, and why this +//! - The distinction between token traits and trait implementations in FRAME, and why this //! distinction is helpful -//! - Token-related traits avaliable in Substrate -//! - Token-related trait implementations in Substrate +//! - Token-related traits avaliable in FRAME +//! - Token-related trait implementations in FRAME //! - How to choose the right trait or trait implementation for your use case //! - Where to go next //! +//! ## Getting Started +//! +//! The most ubiquitous way to add a token to a FRAME runtime with [`pallet_balances`]. Read +//! more about pallets [here](crate::polkadot_sdk::frame_runtime#pallets). +//! +//! You may then write custom pallets that interact with [`pallet_balances`]. The fastest way to +//! get started with that is by +//! [tightly coupling](crate::reference_docs::frame_pallet_coupling#tight-coupling-pallets) your +//! custom pallet to [`pallet_balances`]. +//! +//! However, to keep pallets flexible and modular, it is often prefered to +//! [loosely couple](crate::reference_docs::frame_pallet_coupling#loosely--coupling-pallets). +//! +//! To achieve +//! [loose coupling](crate::reference_docs::frame_pallet_coupling#loosely--coupling-pallets), +//! we seperate token logic into traits and trait implementations. +//! //! ## Traits and Trait Implementations //! -//! Broadly speaking, token logic in Substrate can be divided into two categories: traits and +//! Broadly speaking, token logic in FRAME can be divided into two categories: traits and //! trait implementations. //! //! **Traits** define common interfaces that types of tokens should implement. For example, the @@ -38,28 +55,40 @@ //! token state such as the total issuance of the token, the balance of individual accounts, etc. //! //! **Trait implementations** are concrete implementations of these traits. For example, one of the -//! many traits [`pallet_balances`] implements is [`frame_support::traits::fungible::Inspect`]. +//! many traits [`pallet_balances`] implements is [`frame_support::traits::fungible::Inspect`]*. //! //! The distinction between traits and trait implementations is helpful because it allows pallets -//! and other logic to be generic over their dependencies, avoiding cumbersome pallet tight -//! coupling. +//! and other logic to be generic over their dependencies, avoiding tight coupling. //! //! To illustrate this with an example let's consider [`pallet_preimage`]. This pallet takes a //! deposit in exchange for storing some preimage for use later. A naive implementation of the -//! pallet may use [`pallet_balances`] as a dependency, and directly call the methods exposed by -//! [`pallet_balances`] to reserve and unreserve deposits. This approach works well, until someone -//! has a use case requiring that an asset from a different pallet such as [`pallet_assets`] is -//! used for the deposit. Rather than tightly couple [`pallet_preimage`] to [`pallet_balances`] AND -//! [`pallet_assets`], along with every other token-handling pallet a user could possibly specify, -//! [`pallet_preimage`] does not specify a concrete pallet as a dependency but instead accepts any -//! dependency which implements the [`frame_support::traits::tokens::currency::ReservableCurrency`] -//! trait. This allows [`pallet_preimage`] to support any arbitrary pallet implementing this trait, -//! without needing any knowledge of what those pallets may be or requiring changes to support new -//! pallets which may be written in the future. -//! -//! ## Fungible Token Traits in Substrate -//! -//! The [`frame_support::traits::fungible`] crate contains the latest set of Substrate +//! pallet may use [`pallet_balances`] in a tightly coupled manner, directly calling methods +//! on the pallet to reserve and unreserve deposits. This approach works well, +//! until someone has a use case requiring that an asset from a different pallet such as +//! [`pallet_assets`] is used for the deposit. Rather than tightly couple [`pallet_preimage`] to +//! [`pallet_balances`], [`pallet_assets`], and every other token-handling pallet a user +//! could possibly specify, [`pallet_preimage`] does not specify a concrete pallet as a dependency +//! but instead accepts any dependency which implements the +//! [`frame_support::traits::tokens::currency::ReservableCurrency`] trait. This allows +//! [`pallet_preimage`] to support any arbitrary pallet implementing this trait, without needing any +//! knowledge of what those pallets may be or requiring changes to support new pallets which may be +//! written in the future. +//! +//! Read more about coupling, and the benefits to loose coupling +//! [here](crate::reference_docs::frame_pallet_coupling). +//! +//! ##### *Rust Advanced Tip +//! +//! The knowledge that [`pallet_balances`] implements [`frame_support::traits::fungible::Inspect`] +//! is not some arcane knowledge that you have to know by heart or memorize. One can +//! simply look at the list of the implementors of any trait in the Rust Doc to find all +//! implementors (e.g. +//! ), +//! or use the `rust-analyzer` `Implementations` action. +//! +//! ## Fungible Token Traits in FRAME +//! +//! The [`frame_support::traits::fungible`] crate contains the latest set of FRAME //! fungible token traits, and is recommended to use for all new logic requiring a fungible token. //! See the crate documentation for more info about these fungible traits. //! @@ -70,10 +99,10 @@ //! used in the codebase, however this trait is deprecated and existing logic is in the process of //! being migrated to [`frame_support::traits::fungible`] ([tracking issue](https://github.com/paritytech/polkadot-sdk/issues/226)). //! -//! ## Fungible Token Trait Implementations in Substrate +//! ## Fungible Token Trait Implementations in FRAME //! //! [`pallet_balances`] implements [`frame_support::traits::fungible`], and is the most commonly -//! used fungible implementation in Substrate. Most of the time, it's used for managing the native +//! used fungible implementation in FRAME. Most of the time, it's used for managing the native //! token of the blockchain network it's used in. //! //! [`pallet_assets`] implements [`frame_support::traits::fungibles`], and is another popular @@ -81,9 +110,9 @@ //! single crate, making it a good choice when a network requires more assets in //! addition to its native token. //! -//! ## Non-Fungible Tokens in Substrate +//! ## Non-Fungible Tokens in FRAME //! -//! [`pallet_uniques`] is recommended to use for all NFT use cases in Substrate. +//! [`pallet_uniques`] is recommended to use for all NFT use cases in FRAME. //! See the crate documentation for more info about this pallet. //! //! [`pallet_nfts`] is deprecated and should not be used. From 32a86a03a59b80b1a8ac3b756515b314575e488b Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 19 Mar 2024 17:40:30 +1100 Subject: [PATCH 27/49] Update substrate/frame/assets/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- substrate/frame/assets/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs index af888d3eff55..c3a2b77c7fae 100644 --- a/substrate/frame/assets/src/lib.rs +++ b/substrate/frame/assets/src/lib.rs @@ -26,7 +26,7 @@ //! as a prerequisite to understanding this pallet. //! //! See the [`frame_tokens`] reference docs for more information about the place of the -//! Assets pallet in Substrate. +//! Assets pallet in FRAME. //! //! ## Overview //! From 1b27d16c5d419d5b36f959d2825e8b0b46b0d507 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 19 Mar 2024 17:40:37 +1100 Subject: [PATCH 28/49] Update substrate/frame/balances/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- substrate/frame/balances/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/balances/src/lib.rs b/substrate/frame/balances/src/lib.rs index ef53ecf6ceb5..af64fb46761a 100644 --- a/substrate/frame/balances/src/lib.rs +++ b/substrate/frame/balances/src/lib.rs @@ -25,7 +25,7 @@ //! as a prerequisite to understanding this pallet. //! //! Also see the [`frame_tokens`] reference docs for higher level information regarding the -//! place of this palet in Substrate. +//! place of this palet in FRAME. //! //! ## Overview //! From 7ac73c5f27e48ad96b8cb18e77c46668de5c4b03 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Wed, 20 Mar 2024 20:16:41 +1100 Subject: [PATCH 29/49] link back to parent doc --- substrate/frame/support/src/traits/tokens/fungible/freeze.rs | 3 +++ substrate/frame/support/src/traits/tokens/fungible/hold.rs | 3 +++ .../frame/support/src/traits/tokens/fungible/imbalance.rs | 2 ++ .../frame/support/src/traits/tokens/fungible/item_of.rs | 5 +++++ .../frame/support/src/traits/tokens/fungible/regular.rs | 2 ++ .../frame/support/src/traits/tokens/fungible/union_of.rs | 2 ++ .../frame/support/src/traits/tokens/fungibles/approvals.rs | 2 ++ .../frame/support/src/traits/tokens/fungibles/enumerable.rs | 4 ++++ .../frame/support/src/traits/tokens/fungibles/freeze.rs | 2 ++ substrate/frame/support/src/traits/tokens/fungibles/hold.rs | 2 ++ .../frame/support/src/traits/tokens/fungibles/imbalance.rs | 2 ++ .../frame/support/src/traits/tokens/fungibles/lifetime.rs | 2 ++ .../frame/support/src/traits/tokens/fungibles/metadata.rs | 2 ++ .../frame/support/src/traits/tokens/fungibles/regular.rs | 2 ++ substrate/frame/support/src/traits/tokens/fungibles/roles.rs | 2 ++ .../frame/support/src/traits/tokens/fungibles/union_of.rs | 2 ++ 16 files changed, 39 insertions(+) diff --git a/substrate/frame/support/src/traits/tokens/fungible/freeze.rs b/substrate/frame/support/src/traits/tokens/fungible/freeze.rs index 8b542ee4c606..0968ffeef80e 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/freeze.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/freeze.rs @@ -16,6 +16,9 @@ // limitations under the License. //! The traits for putting freezes within a single fungible token class. +//! +//! See the [`crate::traits::fungible`] doc for more information about fungible traits +//! including the place of the Freezes in FRAME. use scale_info::TypeInfo; use sp_arithmetic::{ diff --git a/substrate/frame/support/src/traits/tokens/fungible/hold.rs b/substrate/frame/support/src/traits/tokens/fungible/hold.rs index 6da652d2998d..6aeb94b03299 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/hold.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/hold.rs @@ -16,6 +16,9 @@ // limitations under the License. //! The traits for putting holds within a single fungible token class. +//! +//! See the [`crate::traits::fungible`] doc for more information about fungible traits +//! including the place of the Holds in FRAME. use crate::{ ensure, diff --git a/substrate/frame/support/src/traits/tokens/fungible/imbalance.rs b/substrate/frame/support/src/traits/tokens/fungible/imbalance.rs index 0e2510219700..020dffe28c85 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/imbalance.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/imbalance.rs @@ -17,6 +17,8 @@ //! The imbalance type and its associates, which handles keeps everything adding up properly with //! unbalanced operations. +//! +//! See the [`crate::traits::fungible`] doc for more information about fungible traits. use super::{super::Imbalance as ImbalanceT, Balanced, *}; use crate::traits::{ diff --git a/substrate/frame/support/src/traits/tokens/fungible/item_of.rs b/substrate/frame/support/src/traits/tokens/fungible/item_of.rs index 37749d396009..5374cc52bab7 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/item_of.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/item_of.rs @@ -16,6 +16,11 @@ // limitations under the License. //! Adapter to use `fungibles::*` implementations as `fungible::*`. +//! +//! This allows for a `fungibles` asset, e.g. from the `pallet_assets` pallet, to be used when a +//! `fungible` asset is expected. +//! +//! See the [`crate::traits::fungible`] doc for more information about fungible traits. use super::*; use crate::traits::{ diff --git a/substrate/frame/support/src/traits/tokens/fungible/regular.rs b/substrate/frame/support/src/traits/tokens/fungible/regular.rs index 0157b08bd137..4ed31dcf9fb1 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/regular.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/regular.rs @@ -16,6 +16,8 @@ // limitations under the License. //! `Inspect` and `Mutate` traits for working with regular balances. +//! +//! See the [`crate::traits::fungible`] doc for more information about fungible traits. use crate::{ ensure, diff --git a/substrate/frame/support/src/traits/tokens/fungible/union_of.rs b/substrate/frame/support/src/traits/tokens/fungible/union_of.rs index 33711d7a16cc..575b771a6144 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/union_of.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/union_of.rs @@ -17,6 +17,8 @@ //! Types to combine some `fungible::*` and `fungibles::*` implementations into one union //! `fungibles::*` implementation. +//! +//! See the [`crate::traits::fungible`] doc for more information about fungible traits. use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::traits::{ diff --git a/substrate/frame/support/src/traits/tokens/fungibles/approvals.rs b/substrate/frame/support/src/traits/tokens/fungibles/approvals.rs index 7a80279b0198..09e3d20756a2 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/approvals.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/approvals.rs @@ -16,6 +16,8 @@ // limitations under the License. //! Inspect and Mutate traits for Asset approvals +//! +//! See the [`crate::traits::fungibles`] doc for more information about fungibles traits. use crate::dispatch::DispatchResult; pub trait Inspect: super::Inspect { diff --git a/substrate/frame/support/src/traits/tokens/fungibles/enumerable.rs b/substrate/frame/support/src/traits/tokens/fungibles/enumerable.rs index 08bb784a7dbf..81dbb93b0b8d 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/enumerable.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/enumerable.rs @@ -15,6 +15,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +//! Contains an interface for enumerating assets in existence or owned by a given account. +//! +//! See the [`crate::traits::fungibles`] doc for more information about fungibles traits. + /// Interface for enumerating assets in existence or owned by a given account. pub trait Inspect: super::Inspect { type AssetsIterator; diff --git a/substrate/frame/support/src/traits/tokens/fungibles/freeze.rs b/substrate/frame/support/src/traits/tokens/fungibles/freeze.rs index b07d20d6c41c..244f70058994 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/freeze.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/freeze.rs @@ -16,6 +16,8 @@ // limitations under the License. //! The traits for putting freezes within a single fungible token class. +//! +//! See the [`crate::traits::fungibles`] doc for more information about fungibles traits. use crate::{ensure, traits::tokens::Fortitude}; use scale_info::TypeInfo; diff --git a/substrate/frame/support/src/traits/tokens/fungibles/hold.rs b/substrate/frame/support/src/traits/tokens/fungibles/hold.rs index 1efd1594213c..ef3fef7a300d 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/hold.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/hold.rs @@ -16,6 +16,8 @@ // limitations under the License. //! The traits for putting holds within a single fungible token class. +//! +//! See the [`crate::traits::fungibles`] doc for more information about fungibles traits. use crate::{ ensure, diff --git a/substrate/frame/support/src/traits/tokens/fungibles/imbalance.rs b/substrate/frame/support/src/traits/tokens/fungibles/imbalance.rs index 54c1e900b6e3..bb0d83721a48 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/imbalance.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/imbalance.rs @@ -17,6 +17,8 @@ //! The imbalance type and its associates, which handles keeps everything adding up properly with //! unbalanced operations. +//! +//! See the [`crate::traits::fungibles`] doc for more information about fungibles traits. use super::*; use crate::traits::{ diff --git a/substrate/frame/support/src/traits/tokens/fungibles/lifetime.rs b/substrate/frame/support/src/traits/tokens/fungibles/lifetime.rs index 0e195a52318b..49f6c846ccdd 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/lifetime.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/lifetime.rs @@ -16,6 +16,8 @@ // limitations under the License. //! Traits for creating and destroying assets. +//! +//! See the [`crate::traits::fungibles`] doc for more information about fungibles traits. use sp_runtime::{DispatchError, DispatchResult}; diff --git a/substrate/frame/support/src/traits/tokens/fungibles/metadata.rs b/substrate/frame/support/src/traits/tokens/fungibles/metadata.rs index ab310119e584..ab722426dadf 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/metadata.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/metadata.rs @@ -16,6 +16,8 @@ // limitations under the License. //! Inspect and Mutate traits for Asset metadata +//! +//! See the [`crate::traits::fungibles`] doc for more information about fungibles traits. use crate::dispatch::DispatchResult; use sp_std::vec::Vec; diff --git a/substrate/frame/support/src/traits/tokens/fungibles/regular.rs b/substrate/frame/support/src/traits/tokens/fungibles/regular.rs index 8cc97802da66..b30e0ae3a2a3 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/regular.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/regular.rs @@ -16,6 +16,8 @@ // limitations under the License. //! `Inspect` and `Mutate` traits for working with regular balances. +//! +//! See the [`crate::traits::fungibles`] doc for more information about fungibles traits. use sp_std::marker::PhantomData; diff --git a/substrate/frame/support/src/traits/tokens/fungibles/roles.rs b/substrate/frame/support/src/traits/tokens/fungibles/roles.rs index 5cd1228afbce..4f95ad8368c2 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/roles.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/roles.rs @@ -16,6 +16,8 @@ // limitations under the License. //! Inspect traits for Asset roles +//! +//! See the [`crate::traits::fungibles`] doc for more information about fungibles traits. pub trait Inspect: super::Inspect { // Get owner for an AssetId. diff --git a/substrate/frame/support/src/traits/tokens/fungibles/union_of.rs b/substrate/frame/support/src/traits/tokens/fungibles/union_of.rs index 9d2a783df2a4..c8a1ec37e781 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/union_of.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/union_of.rs @@ -16,6 +16,8 @@ // limitations under the License. //! Type to combine two `fungibles::*` implementations into one union `fungibles::*` implementation. +//! +//! See the [`crate::traits::fungibles`] doc for more information about fungibles traits. use frame_support::traits::{ tokens::{ From af05963937547832a6bb4d265c88e3d2e93e1e9d Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Wed, 20 Mar 2024 20:20:23 +1100 Subject: [PATCH 30/49] add note regarding ItemOf --- substrate/frame/support/src/traits/tokens/fungibles/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/substrate/frame/support/src/traits/tokens/fungibles/mod.rs b/substrate/frame/support/src/traits/tokens/fungibles/mod.rs index 0ca4522ec98f..2122fdeaed3f 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/mod.rs @@ -18,6 +18,9 @@ //! The traits for *sets* of [`fungible`](`frame_support::traits::fungible`) tokens and any //! associated types. //! +//! Individual tokens in the `fungibles` set may be used when a `fungible` trait is expected using +//! [`crate::traits::tokens::fungible::ItemOf`]. +//! //! Also see the [`frame_tokens`] reference docs for more information about the place of //! `fungible` traits in Substrate. //! From 28ef429cdae307edd20d56a82d0da709d0855207 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Wed, 20 Mar 2024 20:26:57 +1100 Subject: [PATCH 31/49] remove frame_currency --- docs/sdk/src/reference_docs/frame_currency.rs | 8 -------- docs/sdk/src/reference_docs/mod.rs | 3 --- 2 files changed, 11 deletions(-) delete mode 100644 docs/sdk/src/reference_docs/frame_currency.rs diff --git a/docs/sdk/src/reference_docs/frame_currency.rs b/docs/sdk/src/reference_docs/frame_currency.rs deleted file mode 100644 index 6987d51aec82..000000000000 --- a/docs/sdk/src/reference_docs/frame_currency.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! FRAME Currency Abstractions and Traits -//! -//! Notes: -//! -//! - History, `Currency` trait. -//! - `Hold` and `Freeze` with diagram. -//! - `HoldReason` and `FreezeReason` -//! - This footgun: diff --git a/docs/sdk/src/reference_docs/mod.rs b/docs/sdk/src/reference_docs/mod.rs index 1d83b78afd2d..3e4f936faa6f 100644 --- a/docs/sdk/src/reference_docs/mod.rs +++ b/docs/sdk/src/reference_docs/mod.rs @@ -66,9 +66,6 @@ pub mod metadata; /// Learn about how frame-system handles `account-ids`, nonces, consumers and providers. pub mod frame_system_accounts; -/// Learn about the currency-related abstractions provided in FRAME. -pub mod frame_currency; - /// Advice for configuring your development environment for Substrate development. pub mod development_environment_advice; From d59f203f55a4d8f168cafc0d0dea3f827f2893ea Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 21 Mar 2024 08:18:59 +0700 Subject: [PATCH 32/49] add additional notes on holds and freezes --- .../frame/support/src/traits/tokens/fungible/mod.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index 60224f6dd608..748eeaa1bdf6 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -96,7 +96,7 @@ //! |__untouchable__|__spendable__| //! ``` //! -//! ## Holds vs. Freezes +//! ## Holds and Freezes //! //! Both holds and freezes are used to prevent an account from using some of its balance. //! @@ -114,6 +114,17 @@ //! |__frozen_________________| // <- the max of all freezes //! ``` //! +//! Holds are designed to be infallibly slashed, meaning that any logic using a `Freeze` +//! must handle the possibility of the frozen amount being reduced, potentially to zero. A +//! permissionless function should be provided in order to allow bookkeeping to be updated in this +//! instance. E.g. some balance is frozen when it is used for voting, one could use held balance for +//! voting, but nothing prevents this frozen balance from being reduced if the overlapping hold is +//! slashed. +//! +//! Every Hold and Freeze is accompanied by a unique `Reason`, making it clear for each instance +//! what the originating pallet and purpose is. These reasons are amalgomated into a single enum +//! `RuntimeHoldReason` and `RuntimeFreezeReason` respectively, when the runtime is compiled. +//! //! ## Sets of Tokens //! //! For managing sets of tokens, see the [`fungibles`](`frame_support::traits::fungibles`) trait From cbc875220b67e700afe133c78bfd884a9445a911 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 21 Mar 2024 08:39:33 +0700 Subject: [PATCH 33/49] further freeze vs hold discussion --- .../support/src/traits/tokens/fungible/freeze.rs | 14 +++++++------- .../support/src/traits/tokens/fungible/hold.rs | 4 ++-- .../support/src/traits/tokens/fungible/mod.rs | 9 +++++++++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/substrate/frame/support/src/traits/tokens/fungible/freeze.rs b/substrate/frame/support/src/traits/tokens/fungible/freeze.rs index 0968ffeef80e..96efbc6ab89e 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/freeze.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/freeze.rs @@ -38,7 +38,7 @@ pub trait Inspect: super::Inspect { /// An identifier for a freeze. type Id: codec::Encode + TypeInfo + 'static; - /// Amount of funds held in reserve by `who` for the given `id`. + /// Amount of funds frozen in reserve by `who` for the given `id`. fn balance_frozen(id: &Self::Id, who: &AccountId) -> Self::Balance; /// The amount of the balance which can become frozen. Defaults to `total_balance()`. @@ -48,11 +48,11 @@ pub trait Inspect: super::Inspect { /// Returns `true` if it's possible to introduce a freeze for the given `id` onto the /// account of `who`. This will be true as long as the implementor supports as many - /// concurrent freeze locks as there are possible values of `id`. + /// concurrent freezes as there are possible values of `id`. fn can_freeze(id: &Self::Id, who: &AccountId) -> bool; } -/// Trait for introducing, altering and removing locks to freeze an account's funds so they never +/// Trait for introducing, altering and removing freezes for an account for its funds never /// go below a set minimum. pub trait Mutate: Inspect { /// Prevent actions which would reduce the balance of the account of `who` below the given @@ -69,16 +69,16 @@ pub trait Mutate: Inspect { /// counteract any pre-existing freezes in place for `who` under the `id`. Also unlike /// `set_freeze`, in the case that `amount` is zero, this is no-op and never fails. /// - /// Note that more funds can be locked than the total balance, if desired. + /// Note that more funds can be frozen than the total balance, if desired. fn extend_freeze(id: &Self::Id, who: &AccountId, amount: Self::Balance) -> DispatchResult; - /// Remove an existing lock. + /// Remove an existing freeze. fn thaw(id: &Self::Id, who: &AccountId) -> DispatchResult; /// Attempt to alter the amount frozen under the given `id` to `amount`. /// /// Fail if the account of `who` has fewer freezable funds than `amount`, unless `fortitude` is - /// `Fortitude::Force`. + /// [`Fortitude::Force`]. fn set_frozen( id: &Self::Id, who: &AccountId, @@ -94,7 +94,7 @@ pub trait Mutate: Inspect { /// the amount frozen under `id`. Do nothing otherwise. /// /// Fail if the account of `who` has fewer freezable funds than `amount`, unless `fortitude` is - /// `Fortitude::Force`. + /// [`Fortitude::Force`]. fn ensure_frozen( id: &Self::Id, who: &AccountId, diff --git a/substrate/frame/support/src/traits/tokens/fungible/hold.rs b/substrate/frame/support/src/traits/tokens/fungible/hold.rs index 6aeb94b03299..28ece25c91d4 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/hold.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/hold.rs @@ -217,8 +217,8 @@ pub trait Mutate: /// /// The actual amount released is returned with `Ok`. /// - /// If `precision` is `BestEffort`, then the amount actually unreserved and returned as the - /// inner value of `Ok` may be smaller than the `amount` passed. + /// If `precision` is [`Precision::BestEffort`], then the amount actually unreserved and + /// returned as the inner value of `Ok` may be smaller than the `amount` passed. /// /// NOTE! The inner of the `Ok` result variant returns the *actual* amount released. This is the /// opposite of the `ReservableCurrency::unreserve()` result, which gives the amount not able diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index 748eeaa1bdf6..b87fc489e70c 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -125,6 +125,15 @@ //! what the originating pallet and purpose is. These reasons are amalgomated into a single enum //! `RuntimeHoldReason` and `RuntimeFreezeReason` respectively, when the runtime is compiled. //! +//! ### Should I use a Hold or Freeze? +//! +//! If you require a balance to be infaillibly slashed, then you should use Holds. +//! +//! If you require setting a minimum account balance amount, then you should use a Freezes. Note +//! Freezes do not carry the same guarantees as Holds. Although the account cannot voluntarily +//! reduce their balance below the largest freeze, if Holds on the account are slashed then the +//! balance could drop below the freeze amount. +//! //! ## Sets of Tokens //! //! For managing sets of tokens, see the [`fungibles`](`frame_support::traits::fungibles`) trait From dd1497457d9666b0921563b4deb5d140287186dd Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 22 Mar 2024 21:48:02 +1100 Subject: [PATCH 34/49] Update substrate/frame/balances/src/lib.rs Co-authored-by: Sebastian Kunert --- substrate/frame/balances/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/balances/src/lib.rs b/substrate/frame/balances/src/lib.rs index af64fb46761a..82d5bde52013 100644 --- a/substrate/frame/balances/src/lib.rs +++ b/substrate/frame/balances/src/lib.rs @@ -43,7 +43,7 @@ //! ### Terminology //! //! - **Reaping an account:** The act of removing an account by resetting its nonce. Happens after -//! its total balance has become zero (or, strictly speaking, less than the Existential Deposit). +//! its total balance has become less than the Existential Deposit. //! //! ### Implementations //! From 1986c080901f31f26f40235cce5df34794344894 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 20:03:09 +1100 Subject: [PATCH 35/49] Update docs/sdk/src/reference_docs/frame_tokens.rs Co-authored-by: Sebastian Kunert --- docs/sdk/src/reference_docs/frame_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/frame_tokens.rs b/docs/sdk/src/reference_docs/frame_tokens.rs index 2a31b5bbdc0f..36e0d8638c56 100644 --- a/docs/sdk/src/reference_docs/frame_tokens.rs +++ b/docs/sdk/src/reference_docs/frame_tokens.rs @@ -30,7 +30,7 @@ //! //! ## Getting Started //! -//! The most ubiquitous way to add a token to a FRAME runtime with [`pallet_balances`]. Read +//! The most ubiquitous way to add a token to a FRAME runtime is [`pallet_balances`]. Read //! more about pallets [here](crate::polkadot_sdk::frame_runtime#pallets). //! //! You may then write custom pallets that interact with [`pallet_balances`]. The fastest way to From b6924b25f55531bdfffe3590d4eee1fb142e2e5a Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 20:08:20 +1100 Subject: [PATCH 36/49] Update docs/sdk/src/reference_docs/frame_tokens.rs Co-authored-by: Sebastian Kunert --- docs/sdk/src/reference_docs/frame_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/frame_tokens.rs b/docs/sdk/src/reference_docs/frame_tokens.rs index 36e0d8638c56..42d57b181247 100644 --- a/docs/sdk/src/reference_docs/frame_tokens.rs +++ b/docs/sdk/src/reference_docs/frame_tokens.rs @@ -61,7 +61,7 @@ //! and other logic to be generic over their dependencies, avoiding tight coupling. //! //! To illustrate this with an example let's consider [`pallet_preimage`]. This pallet takes a -//! deposit in exchange for storing some preimage for use later. A naive implementation of the +//! deposit in exchange for storing a preimage for later use. A naive implementation of the //! pallet may use [`pallet_balances`] in a tightly coupled manner, directly calling methods //! on the pallet to reserve and unreserve deposits. This approach works well, //! until someone has a use case requiring that an asset from a different pallet such as From 193ae2b188cd5e4b12bdad1f5ac26b25dfce309c Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 16:20:29 +0700 Subject: [PATCH 37/49] address comments --- docs/sdk/src/reference_docs/frame_tokens.rs | 52 +++++++++++---------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/docs/sdk/src/reference_docs/frame_tokens.rs b/docs/sdk/src/reference_docs/frame_tokens.rs index 42d57b181247..f3df1dcce060 100644 --- a/docs/sdk/src/reference_docs/frame_tokens.rs +++ b/docs/sdk/src/reference_docs/frame_tokens.rs @@ -51,11 +51,13 @@ //! trait implementations. //! //! **Traits** define common interfaces that types of tokens should implement. For example, the -//! [`frame_support::traits::fungible::Inspect`] trait specifies an interface for *inspecting* -//! token state such as the total issuance of the token, the balance of individual accounts, etc. +//! [`fungible::Inspect`](`frame_support::traits::fungible::Inspect`) trait specifies an interface +//! for *inspecting* token state such as the total issuance of the token, the balance of individual +//! accounts, etc. //! //! **Trait implementations** are concrete implementations of these traits. For example, one of the -//! many traits [`pallet_balances`] implements is [`frame_support::traits::fungible::Inspect`]*. +//! many traits [`pallet_balances`] implements is +//! [`fungible::Inspect`](`frame_support::traits::fungible::Inspect`)*. //! //! The distinction between traits and trait implementations is helpful because it allows pallets //! and other logic to be generic over their dependencies, avoiding tight coupling. @@ -69,45 +71,45 @@ //! [`pallet_balances`], [`pallet_assets`], and every other token-handling pallet a user //! could possibly specify, [`pallet_preimage`] does not specify a concrete pallet as a dependency //! but instead accepts any dependency which implements the -//! [`frame_support::traits::tokens::currency::ReservableCurrency`] trait. This allows -//! [`pallet_preimage`] to support any arbitrary pallet implementing this trait, without needing any -//! knowledge of what those pallets may be or requiring changes to support new pallets which may be -//! written in the future. +//! [`currency::ReservableCurrency`](`frame_support::traits::tokens::currency::ReservableCurrency`) +//! trait. This allows [`pallet_preimage`] to support any arbitrary pallet implementing this trait, +//! without needing any knowledge of what those pallets may be or requiring changes to support new +//! pallets which may be written in the future. //! //! Read more about coupling, and the benefits to loose coupling //! [here](crate::reference_docs::frame_pallet_coupling). //! //! ##### *Rust Advanced Tip //! -//! The knowledge that [`pallet_balances`] implements [`frame_support::traits::fungible::Inspect`] -//! is not some arcane knowledge that you have to know by heart or memorize. One can -//! simply look at the list of the implementors of any trait in the Rust Doc to find all -//! implementors (e.g. +//! The knowledge that [`pallet_balances`] implements +//! [`fungible::Inspect`](`frame_support::traits::fungible::Inspect`) is not some arcane knowledge +//! that you have to know by heart or memorize. One can simply look at the list of the implementors +//! of any trait in the Rust Doc to find all implementors (e.g. //! ), //! or use the `rust-analyzer` `Implementations` action. //! //! ## Fungible Token Traits in FRAME //! -//! The [`frame_support::traits::fungible`] crate contains the latest set of FRAME +//! The [`fungible`](`frame_support::traits::fungible`) crate contains the latest set of FRAME //! fungible token traits, and is recommended to use for all new logic requiring a fungible token. //! See the crate documentation for more info about these fungible traits. //! -//! [`frame_support::traits::fungibles`] provides very similar functionality to -//! [`frame_support::traits::fungible`], except it supports managing multiple tokens. +//! [`fungibles`](`frame_support::traits::fungibles`) provides very similar functionality to +//! [`fungible`](`frame_support::traits::fungible`), except it supports managing multiple tokens. //! -//! You may notice the trait [`frame_support::traits::Currency`] with similar functionality is also -//! used in the codebase, however this trait is deprecated and existing logic is in the process of -//! being migrated to [`frame_support::traits::fungible`] ([tracking issue](https://github.com/paritytech/polkadot-sdk/issues/226)). +//! You may notice the trait [`Currency`](`frame_support::traits::Currency`) with similar +//! functionality is also used in the codebase, however this trait is deprecated and existing logic +//! is in the process of being migrated to [`fungible`](`frame_support::traits::fungible`) ([tracking issue](https://github.com/paritytech/polkadot-sdk/issues/226)). //! //! ## Fungible Token Trait Implementations in FRAME //! -//! [`pallet_balances`] implements [`frame_support::traits::fungible`], and is the most commonly -//! used fungible implementation in FRAME. Most of the time, it's used for managing the native -//! token of the blockchain network it's used in. +//! [`pallet_balances`] implements [`fungible`](`frame_support::traits::fungible`), and is the most +//! commonly used fungible implementation in FRAME. Most of the time, it's used for managing the +//! native token of the blockchain network it's used in. //! -//! [`pallet_assets`] implements [`frame_support::traits::fungibles`], and is another popular -//! fungible token implementation. It supports the creation and management of multiple assets in a -//! single crate, making it a good choice when a network requires more assets in +//! [`pallet_assets`] implements [`fungibles`](`frame_support::traits::fungibles`), and is another +//! popular fungible token implementation. It supports the creation and management of multiple +//! assets in a single crate, making it a good choice when a network requires more assets in //! addition to its native token. //! //! ## Non-Fungible Tokens in FRAME @@ -120,7 +122,7 @@ //! # What Next? //! //! - If you are interested in implementing a single fungible token, continue reading the -//! [`frame_support::traits::fungible`] and [`pallet_balances`] docs. +//! [`fungible`](`frame_support::traits::fungible`) and [`pallet_balances`] docs. //! - If you are interested in implementing a set of fungible tokens, continue reading the -//! [`frame_support::traits::fungibles`] trait and [`pallet_assets`] docs. +//! [`fungibles`](`frame_support::traits::fungibles`) trait and [`pallet_assets`] docs. //! - If you are interested in implementing an NFT, continue reading the [`pallet_uniques`] docs. From 2248dfb5299712b99c86330d7d58bf80e068cdc8 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 20:21:04 +1100 Subject: [PATCH 38/49] Update substrate/frame/support/src/traits/tokens/fungible/mod.rs Co-authored-by: Sebastian Kunert --- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index b87fc489e70c..c809c67962c6 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -66,8 +66,8 @@ //! //! - **Minimum Balance (a.k.a. Existential Deposit, a.k.a. ED)**: The minimum balance required to //! create or keep an account open. This is to prevent "dust accounts" from filling storage. When -//! the free plus the held balance (i.e. the total balance) fall below this, then the account is -//! said to be dead; and it loses its functionality as well as any prior history and all +//! the free plus the held balance (i.e. the total balance) falls below this, then the account is +//! said to be dead. It loses its functionality as well as any prior history and all //! information on it is removed from the chain's state. No account should ever have a total //! balance that is strictly between 0 and the existential deposit (exclusive). If this ever //! happens, it indicates either a bug in the implementation of this trait or an erroneous raw From 7894ca0db8d5a92cb70a7e0e0d70b2f5d817c002 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 20:24:21 +1100 Subject: [PATCH 39/49] Update substrate/frame/support/src/traits/tokens/fungible/mod.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index c809c67962c6..8bf64bd21955 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -53,7 +53,7 @@ //! be slashed, but only after all the free balance has been slashed. //! //! Multiple holds stack rather than overlay. This means that if an account has -//! 3 locks for 100 units, the account can spend its funds for any reason down to 300 units, at +//! 3 holds for 100 units, the account can spend its funds for any reason down to 300 units, at //! which point the holds will start to come into play. //! //! - **Frozen Balance**: A freeze on a specified amount of an account's free balance until a From a4fd664bada75acf350dc415bcd82fa3e1053946 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 16:35:49 +0700 Subject: [PATCH 40/49] address comments --- docs/sdk/src/reference_docs/frame_tokens.rs | 7 ++++--- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/sdk/src/reference_docs/frame_tokens.rs b/docs/sdk/src/reference_docs/frame_tokens.rs index f3df1dcce060..4ad5d1fc7001 100644 --- a/docs/sdk/src/reference_docs/frame_tokens.rs +++ b/docs/sdk/src/reference_docs/frame_tokens.rs @@ -72,9 +72,10 @@ //! could possibly specify, [`pallet_preimage`] does not specify a concrete pallet as a dependency //! but instead accepts any dependency which implements the //! [`currency::ReservableCurrency`](`frame_support::traits::tokens::currency::ReservableCurrency`) -//! trait. This allows [`pallet_preimage`] to support any arbitrary pallet implementing this trait, -//! without needing any knowledge of what those pallets may be or requiring changes to support new -//! pallets which may be written in the future. +//! trait, namely via its [`Config::Currency`](`pallet_preimage::pallet::Config::Currency`) +//! associated type. This allows [`pallet_preimage`] to support any arbitrary pallet implementing +//! this trait, without needing any knowledge of what those pallets may be or requiring changes to +//! support new pallets which may be written in the future. //! //! Read more about coupling, and the benefits to loose coupling //! [here](crate::reference_docs::frame_pallet_coupling). diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index b87fc489e70c..c3bd247900be 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -47,7 +47,9 @@ //! //! - **Total Balance**: The sum of an account's free and held balances. //! -//! - **Free Balance**: A portion of an account's total balance that is not held. +//! - **Free Balance**: A portion of an account's total balance that is not held. Note this is +//! distinct from the Spendable Balance, which represents how much Balance the user can actually +//! transfer. //! //! - **Held Balance**: Held balance still belongs to the account holder, but is suspended. It can //! be slashed, but only after all the free balance has been slashed. @@ -76,7 +78,8 @@ //! - **Untouchable Balance**: The part of a user's free balance they cannot spend, due to ED or //! Freeze(s). //! -//! - **Spendable Balance**: The part of a user's free balance they can spend. +//! - **Spendable Balance**: The part of a user's free balance they can actually transfer, after +//! accounting for Holds and Freezes. //! //! - **Imbalance**: A condition when some funds were credited or debited without equal and opposite //! accounting (i.e. a difference between total issuance and account balances). Functions that From ed3bfff552e1fecf1923f5a67bbef2b136456df7 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 16:41:27 +0700 Subject: [PATCH 41/49] fmt --- .../frame/support/src/traits/tokens/fungible/mod.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index 1de849ab63d3..36979098f793 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -69,11 +69,10 @@ //! - **Minimum Balance (a.k.a. Existential Deposit, a.k.a. ED)**: The minimum balance required to //! create or keep an account open. This is to prevent "dust accounts" from filling storage. When //! the free plus the held balance (i.e. the total balance) falls below this, then the account is -//! said to be dead. It loses its functionality as well as any prior history and all -//! information on it is removed from the chain's state. No account should ever have a total -//! balance that is strictly between 0 and the existential deposit (exclusive). If this ever -//! happens, it indicates either a bug in the implementation of this trait or an erroneous raw -//! mutation of storage. +//! said to be dead. It loses its functionality as well as any prior history and all information +//! on it is removed from the chain's state. No account should ever have a total balance that is +//! strictly between 0 and the existential deposit (exclusive). If this ever happens, it indicates +//! either a bug in the implementation of this trait or an erroneous raw mutation of storage. //! //! - **Untouchable Balance**: The part of a user's free balance they cannot spend, due to ED or //! Freeze(s). From 3521ea205121c17c58e54a804b3aedfca95921d5 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 16:45:07 +0700 Subject: [PATCH 42/49] add note about removing hold/freeze reasons --- substrate/frame/support/src/traits/tokens/fungible/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index 36979098f793..4a0cda2dbc7b 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -127,6 +127,10 @@ //! what the originating pallet and purpose is. These reasons are amalgomated into a single enum //! `RuntimeHoldReason` and `RuntimeFreezeReason` respectively, when the runtime is compiled. //! +//! Note that `Hold` and `Freeze` reasons should remain in your runtime for as long as storage +//! could exist in your runtime with those reasons, otherwise your runtime state could become +//! undecodable. +//! //! ### Should I use a Hold or Freeze? //! //! If you require a balance to be infaillibly slashed, then you should use Holds. From 5654274a0a7a1390a5242221119b01193247c494 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 21:29:37 +1100 Subject: [PATCH 43/49] Update docs/sdk/src/reference_docs/frame_tokens.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/frame_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/frame_tokens.rs b/docs/sdk/src/reference_docs/frame_tokens.rs index 4ad5d1fc7001..bb3fb2f10307 100644 --- a/docs/sdk/src/reference_docs/frame_tokens.rs +++ b/docs/sdk/src/reference_docs/frame_tokens.rs @@ -43,7 +43,7 @@ //! //! To achieve //! [loose coupling](crate::reference_docs::frame_pallet_coupling#loosely--coupling-pallets), -//! we seperate token logic into traits and trait implementations. +//! we separate token logic into traits and trait implementations. //! //! ## Traits and Trait Implementations //! From 1774c51d4601c46a1e606582e34bd415d765231d Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 21:30:02 +1100 Subject: [PATCH 44/49] Update docs/sdk/src/reference_docs/frame_tokens.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/frame_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/frame_tokens.rs b/docs/sdk/src/reference_docs/frame_tokens.rs index bb3fb2f10307..6e3e8ccac797 100644 --- a/docs/sdk/src/reference_docs/frame_tokens.rs +++ b/docs/sdk/src/reference_docs/frame_tokens.rs @@ -42,7 +42,7 @@ //! [loosely couple](crate::reference_docs::frame_pallet_coupling#loosely--coupling-pallets). //! //! To achieve -//! [loose coupling](crate::reference_docs::frame_pallet_coupling#loosely--coupling-pallets), +//! loose coupling, //! we separate token logic into traits and trait implementations. //! //! ## Traits and Trait Implementations From 1e67f42d40a1e89e4c25058da3ba129de2c96b36 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 21:30:13 +1100 Subject: [PATCH 45/49] Update docs/sdk/src/reference_docs/frame_tokens.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/frame_tokens.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/frame_tokens.rs b/docs/sdk/src/reference_docs/frame_tokens.rs index 6e3e8ccac797..f4d3a9562602 100644 --- a/docs/sdk/src/reference_docs/frame_tokens.rs +++ b/docs/sdk/src/reference_docs/frame_tokens.rs @@ -57,7 +57,8 @@ //! //! **Trait implementations** are concrete implementations of these traits. For example, one of the //! many traits [`pallet_balances`] implements is -//! [`fungible::Inspect`](`frame_support::traits::fungible::Inspect`)*. +//! [`fungible::Inspect`](`frame_support::traits::fungible::Inspect`)*. It provides the concrete way of inspecting the total issuance, balance of accounts, etc. +//! There can be many implementations of the same traits. //! //! The distinction between traits and trait implementations is helpful because it allows pallets //! and other logic to be generic over their dependencies, avoiding tight coupling. From 77d9fc9cede8c926a0339373959f87c2e89d3d74 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 21:30:19 +1100 Subject: [PATCH 46/49] Update docs/sdk/src/reference_docs/frame_tokens.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/frame_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/frame_tokens.rs b/docs/sdk/src/reference_docs/frame_tokens.rs index f4d3a9562602..4bfdb76c89e8 100644 --- a/docs/sdk/src/reference_docs/frame_tokens.rs +++ b/docs/sdk/src/reference_docs/frame_tokens.rs @@ -78,7 +78,7 @@ //! this trait, without needing any knowledge of what those pallets may be or requiring changes to //! support new pallets which may be written in the future. //! -//! Read more about coupling, and the benefits to loose coupling +//! Read more about coupling, and the benefits of loose coupling //! [here](crate::reference_docs::frame_pallet_coupling). //! //! ##### *Rust Advanced Tip From c7cca8ac04095fda96770ff7db07b6ea30a8fae6 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 21:32:10 +1100 Subject: [PATCH 47/49] Update docs/sdk/src/reference_docs/frame_tokens.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/frame_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/reference_docs/frame_tokens.rs b/docs/sdk/src/reference_docs/frame_tokens.rs index 4bfdb76c89e8..a10ad569a2a0 100644 --- a/docs/sdk/src/reference_docs/frame_tokens.rs +++ b/docs/sdk/src/reference_docs/frame_tokens.rs @@ -127,4 +127,4 @@ //! [`fungible`](`frame_support::traits::fungible`) and [`pallet_balances`] docs. //! - If you are interested in implementing a set of fungible tokens, continue reading the //! [`fungibles`](`frame_support::traits::fungibles`) trait and [`pallet_assets`] docs. -//! - If you are interested in implementing an NFT, continue reading the [`pallet_uniques`] docs. +//! - If you are interested in implementing an NFT, continue reading the [`pallet_nfts`] docs. From 0cb5e77db1deed1bd305668d2c246e9093dc4db0 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 26 Mar 2024 17:33:15 +0700 Subject: [PATCH 48/49] fix nft docs --- docs/sdk/src/reference_docs/frame_tokens.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/sdk/src/reference_docs/frame_tokens.rs b/docs/sdk/src/reference_docs/frame_tokens.rs index a10ad569a2a0..03b1aa5afbaf 100644 --- a/docs/sdk/src/reference_docs/frame_tokens.rs +++ b/docs/sdk/src/reference_docs/frame_tokens.rs @@ -57,8 +57,9 @@ //! //! **Trait implementations** are concrete implementations of these traits. For example, one of the //! many traits [`pallet_balances`] implements is -//! [`fungible::Inspect`](`frame_support::traits::fungible::Inspect`)*. It provides the concrete way of inspecting the total issuance, balance of accounts, etc. -//! There can be many implementations of the same traits. +//! [`fungible::Inspect`](`frame_support::traits::fungible::Inspect`)*. It provides the concrete way +//! of inspecting the total issuance, balance of accounts, etc. There can be many implementations of +//! the same traits. //! //! The distinction between traits and trait implementations is helpful because it allows pallets //! and other logic to be generic over their dependencies, avoiding tight coupling. @@ -116,10 +117,11 @@ //! //! ## Non-Fungible Tokens in FRAME //! -//! [`pallet_uniques`] is recommended to use for all NFT use cases in FRAME. +//! [`pallet_nfts`] is recommended to use for all NFT use cases in FRAME. //! See the crate documentation for more info about this pallet. //! -//! [`pallet_nfts`] is deprecated and should not be used. +//! [`pallet_uniques`] is deprecated and should not be used. +//! //! //! # What Next? //! From 0f33d96cb80720a684c6419273a89f947b3d8194 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 29 Mar 2024 20:08:36 +1100 Subject: [PATCH 49/49] Update docs/sdk/src/reference_docs/frame_tokens.rs Co-authored-by: Francisco Aguirre --- docs/sdk/src/reference_docs/frame_tokens.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/sdk/src/reference_docs/frame_tokens.rs b/docs/sdk/src/reference_docs/frame_tokens.rs index 03b1aa5afbaf..c9d34e2091d8 100644 --- a/docs/sdk/src/reference_docs/frame_tokens.rs +++ b/docs/sdk/src/reference_docs/frame_tokens.rs @@ -41,8 +41,7 @@ //! However, to keep pallets flexible and modular, it is often prefered to //! [loosely couple](crate::reference_docs::frame_pallet_coupling#loosely--coupling-pallets). //! -//! To achieve -//! loose coupling, +//! To achieve loose coupling, //! we separate token logic into traits and trait implementations. //! //! ## Traits and Trait Implementations