Function std::context::this_balance
pub fn this_balance(asset_id: AssetId) -> u64 Expand description
Get the balance of coin asset_id for the current contract.
Arguments
asset_id: [AssetId] - The asset of which the balance should be returned.
Returns
- [u64] - The amount of the asset which the contract holds.
Examples
use std::{context::this_balance, constants::DEFAULT_SUB_ID, asset::mint};
fn foo() {
mint(DEFAULT_SUB_ID, 50);
let asset_id = AssetId::default();
assert(this_balance(asset_id)) == 50);
}