If I have the contract_id
of the contract that minted a particular asset (associated with an Asset ID
), how can I verify whether that specific contract_id
minted the given Asset ID
?
This issue could be resolved if there was a method to derive the contract_id
of the minter contract directly from the Asset ID
.
Could you please guide me on how to achieve this?
P.S.: I need the contract_id
to call the SRC20 ABI functions.
#[storage(read, write), payable]
fn list_nft(nft_contract_id: ContractId, asset_id: AssetId, price: u64, quantity: u64, standard: NFTStandard) {
let sender = msg_sender().unwrap();
let amount = msg_amount();
let asset = msg_asset_id();
require(asset == asset_id && amount == quantity, "Asset or Amount is invalid");
require(price > 0, "Price is invalid");
let nft_b256: b256 = nft_contract_id.into();
let nft_contract = abi(SRC20, nft_b256);
let decimals = match nft_contract.decimals(asset_id) {
Some(d) => d,
None => {
require(false, "Contract ID is not valid");
0
},
};
require(decimals == 0, "Not valid NFT or Semi Fungible Asset");
match standard {
NFTStandard::NFT => require(quantity == 1, "Not valid NFT"),
_ => {},
}
- How can I validate that the
nft_contract_id
is the minter of a givenasset_id
?