mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 18:01:04 +00:00
maybe_total_supply in pallet-assets (#10799)
* maybe_total_supply in pallet-assets * Update frame/assets/src/functions.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -55,7 +55,12 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
|||||||
|
|
||||||
/// Get the total supply of an asset `id`.
|
/// Get the total supply of an asset `id`.
|
||||||
pub fn total_supply(id: T::AssetId) -> T::Balance {
|
pub fn total_supply(id: T::AssetId) -> T::Balance {
|
||||||
Asset::<T, I>::get(id).map(|x| x.supply).unwrap_or_else(Zero::zero)
|
Self::maybe_total_supply(id).unwrap_or_default()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the total supply of an asset `id` if the asset exists.
|
||||||
|
pub fn maybe_total_supply(id: T::AssetId) -> Option<T::Balance> {
|
||||||
|
Asset::<T, I>::get(id).map(|x| x.supply)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn new_account(
|
pub(super) fn new_account(
|
||||||
|
|||||||
Reference in New Issue
Block a user