1

I have this contract,

pragma solidity >=0.8.11;

import "https://github.com/iotaledger/wasp/blob/develop/packages/vm/core/evm/iscmagic/ISC.sol";

contract ProofContract {

    event NftEvent(IRC27NFT nft);

    function getNft() public {
        IRC27NFT memory nft = ISC.sandbox.getIRC27NFTData("0x96864d73590cd67651de5744c9239fe4bea653e88a4ba2a97fc9a333cb5c891a");
        emit NftEvent(nft);
    }
}

How do I pass the id of the NFT? I get this error enter image description here

Credit goes to alvorgar-dev

1 Answer 1

1

This is possible with the so called magic contract:

EVM and ISC are inherently very different platforms. Some EVM-specific actions (e.g., manipulating Ethereum tokens) are disabled, and EVM contracts can access ISC-specific functionality through the ISC Magic Contract.
The Magic contract is an EVM contract deployed by default on every ISC chain, in the EVM genesis block, at address 0x1074000000000000000000000000000000000000. The implementation of the Magic contract is baked-in in the evm core contract); i.e. it is not a pure-Solidity contract.
The Magic contract has several methods, which are categorized into specialized interfaces: ISCSandbox, ISCAccounts, ISCUtil and so on. You can access these interfaces from any Solidity contract by importing the ISC library.
The Magic contract also provides proxy ERC20 contracts to manipulate ISC base tokens and native tokens on L2.

Source

asNFTID from ISCTypes.sol calls:
NFTID.wrap(bytes32(tokenID))

So if you have the tokensID as bytes32 instead of uint256, you could call that directly

Here's an example of usage: https://github.com/iotaledger/wasp/blob/develop/packages/vm/core/evm/iscmagic/ERC721NFTs.sol#L63

Credit goes to Jorge on the IOTA Discord

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.