mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 15:21:08 +00:00
Assets: impl ContainsPair for asset and account IDs (#14119)
* Assets impl ContainsPair for asset and account IDs * clap version
This commit is contained in:
@@ -202,7 +202,10 @@ impl<AssetId, AccountId> AssetsCallback<AssetId, AccountId> 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<T: Config<I>, I: 'static> AccountTouch<T::AssetId, T::AccountId> for Pallet<T, I> {
|
||||
@@ -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<T: Config<I>, I: 'static> ContainsPair<T::AssetId, T::AccountId> for Pallet<T, I> {
|
||||
/// Check if an account with the given asset ID and account address exists.
|
||||
fn contains(asset: &T::AssetId, who: &T::AccountId) -> bool {
|
||||
Account::<T, I>::contains_key(asset, who)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sp_core::generate_feature_enabled_macro!(runtime_benchmarks_enabled, feature = "runtime-benchmarks", $);
|
||||
|
||||
Reference in New Issue
Block a user