pub fn _set_decimals(
    decimals_key: StorageKey<StorageMap<AssetId, u8>>,
    asset: AssetId,
    decimals: u8,
) 
Expand description

Unconditionally sets the decimals of an asset.

Additional Information

NOTE: This does not check whether the asset id provided is valid or already exists.

Arguments

  • decimals_key: [StorageKey<StorageMap<AssetId, u8>>] - The location in storage which the StorageMap that stores the decimals of assets is stored.
  • asset: [AssetId] - The asset of which to set the decimals.
  • decimal: [u8] - The decimals of the asset.

Number of Storage Accesses

  • Writes: 1

Examples

use sway_libs::asset::base::{_set_decimals, _decimals};

storage {
    decimals: StorageMap<AssetId, u8> = StorageMap {},
}

fn foo(asset: AssetId) {
    let decimals = 8u8;
    _set_decimals(storage.decimals, asset, decimals);
    assert(_decimals(storage.decimals, asset).unwrap() == decimals);
}