Allow other pallets to check asset ids. (#12666)

* Make it easier for other pallets to check asset ids.

* Avoid boxing

* cargo fmt
This commit is contained in:
Squirrel
2022-11-11 14:22:17 +00:00
committed by GitHub
parent bd2166de79
commit ba12f3af9d
5 changed files with 63 additions and 3 deletions
@@ -283,3 +283,14 @@ impl<T: Config<I>, I: 'static> fungibles::roles::Inspect<<T as SystemConfig>::Ac
Asset::<T, I>::get(asset).map(|x| x.freezer)
}
}
impl<T: Config<I>, I: 'static> fungibles::InspectEnumerable<T::AccountId> for Pallet<T, I> {
type AssetsIterator = KeyPrefixIterator<<T as Config<I>>::AssetId>;
/// Returns an iterator of the assets in existence.
///
/// NOTE: iterating this list invokes a storage read per item.
fn asset_ids() -> Self::AssetsIterator {
Asset::<T, I>::iter_keys()
}
}