diff --git a/Cargo.lock b/Cargo.lock index 289e0c2c02b8a..0e6e8e847a01b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5516,7 +5516,7 @@ dependencies = [ name = "node-template-release" version = "3.0.0" dependencies = [ - "clap 4.2.5", + "clap 4.2.7", "flate2", "fs_extra", "git2", diff --git a/frame/assets/src/lib.rs b/frame/assets/src/lib.rs index e6b59bba53836..c25f33ae3eaf9 100644 --- a/frame/assets/src/lib.rs +++ b/frame/assets/src/lib.rs @@ -202,7 +202,10 @@ impl AssetsCallback for () {} #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::{pallet_prelude::*, traits::AccountTouch}; + use frame_support::{ + pallet_prelude::*, + traits::{AccountTouch, ContainsPair}, + }; use frame_system::pallet_prelude::*; /// The current storage version. @@ -1645,7 +1648,7 @@ pub mod pallet { } } - /// Implements [AccountTouch] trait. + /// Implements [`AccountTouch`] trait. /// Note that a depositor can be any account, without any specific privilege. /// This implementation is supposed to be used only for creation of system accounts. impl, I: 'static> AccountTouch for Pallet { @@ -1659,6 +1662,14 @@ pub mod pallet { Self::do_touch(asset, who, depositor, false) } } + + /// Implements [`ContainsPair`] trait for a pair of asset and account IDs. + impl, I: 'static> ContainsPair for Pallet { + /// Check if an account with the given asset ID and account address exists. + fn contains(asset: &T::AssetId, who: &T::AccountId) -> bool { + Account::::contains_key(asset, who) + } + } } sp_core::generate_feature_enabled_macro!(runtime_benchmarks_enabled, feature = "runtime-benchmarks", $);