pub fn _set_name(
name_key: StorageKey<StorageMap<AssetId, StorageString>>,
asset: AssetId,
name: String,
) Expand description
Unconditionally sets the name of an asset.
Additional Information
NOTE: This does not check whether the asset id provided is valid or already exists.
Arguments
name_key: [StorageKey<StorageMap<AssetId, StorageKey>>] - The location in storage which theStorageMapthat stores the names of assets is stored.asset: [AssetId] - The asset of which to set the name.name: [String] - The name of the asset.
Reverts
- When passing an empty string.
Number of Storage Accesses
- Writes:
2
Examples
use asset::base::{_set_name, _name};
use std::string::String;
storage {
name: StorageMap<AssetId, StorageString> = StorageMap {},
}
fn foo(asset: AssetId) {
let name = String::from_ascii_str("Ether");
_set_name(storage.name, asset, name);
assert(_name(storage.name, asset).unwrap() == name);
}