pub fn _symbol(
    symbol_key: StorageKey<StorageMap<AssetId, StorageString>>,
    asset: AssetId,
) -> Option<String> 
Expand description

Returns the symbol of the asset, such as “ETH”.

Arguments

  • symbol_key: [StorageKey<StorageMap<AssetId, StorageKey>>] - The location in storage which the StorageMap that stores the symbols of assets is stored.
  • asset: [AssetId] - The asset of which to query the symbol.

Returns

  • [Option] - The symbol of asset.

Number of Storage Accesses

  • Reads: 1

Examples

use sway_libs::asset::base::_symbol;
use std::string::String;

storage {
    symbol: StorageMap<AssetId, StorageString> = StorageMap {},
}

fn foo(asset: AssetId) {
    let symbol = _symbol(storage.symbol, asset);
    assert(symbol.unwrap_or(String::new()).len() != 0);
}