How do we get an assetId from a different contract that uses a particular SRC20?
Contract A has token A and B. How do I get token A or token B? Similar to IERC20(tokena).balanceOf(ContractA)
.
Do we need to know their subId? When can we use the default subId?
It is confusing where in SRC6 Example it uses, new
:
/// Returns the vault shares assetid for the given assets assetid and the vaults sub id
fn vault_assetid() -> AssetId {
let share_asset_id = AssetId::new(ContractId::this(), PRE_CALCULATED_SHARE_VAULT_SUB_ID);
share_asset_id
}
While in other pages of the documentation from
is used to get assetId? In the case where the b256
value of an asset is already known, you may call the from()
function with the b256
value.
let asset_id: AssetId = AssetId::from(0x0000000000000000000000000000000000000000000000000000000000000000);
Side Question:
Should we replace PRE_CALCULATED_SHARE_VAULT_SUB_ID with any SubID such as b256 = Bytes32::zeroed();
?