diff --git a/frame/assets/src/functions.rs b/frame/assets/src/functions.rs index e02cc7c8bb213..73804fc832c99 100644 --- a/frame/assets/src/functions.rs +++ b/frame/assets/src/functions.rs @@ -55,7 +55,12 @@ impl, I: 'static> Pallet { /// Get the total supply of an asset `id`. pub fn total_supply(id: T::AssetId) -> T::Balance { - Asset::::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 { + Asset::::get(id).map(|x| x.supply) } pub(super) fn new_account(