pub fn _total_supply(
    total_supply_key: StorageKey<StorageMap<AssetId, u64>>,
    asset: AssetId,
) -> Option<u64> 
Expand description

Returns the total supply of coins for an asset.

Arguments

  • total_supply_key: [StorageKey<StorageMap<AssetId, u64>>] - The location in storage which the StorageMap that stores the total supply of assets is stored.
  • asset: [AssetId] - The asset of which to query the total supply.

Returns

  • [Option] - The total supply of an asset.

Number of Storage Accesses

  • Reads: 1

Examples

use sway_libs::asset::base::_total_supply;

storage {
    total_supply: StorageMap<AssetId, u64> = StorageMap {},
}

fn foo(asset_id: AssetId) {
    let supply = _total_supply(storage.total_supply, asset_id);
    assert(supply.unwrap_or(0) != 0);
}