Use as ERC721
About the ERC721NFTs
contract
The ERC721NFTs
contract is a hardcoded contract at address 0x1074030000000000000000000000000000000000
. Every L1 NFT owned by the chain can be accessed through it. In this example, we will show you how to use it by using transferFrom
.
Example Code
- ERC721 uses the
tokenID
for almost all interactions with it. So first, you should convert theNFTID
to atokenID
:
uint256 tokenID = uint256(NFTID.unwrap(nftID));
Token ID to NFT ID
You can use the ISCTypes.asNFTID() function to convert a Token ID to an NFT ID, by either using it on a token ID tokenID.asNFTID();
or passing it to function ISCTypes.asNFTID(tokenID)
.
- Transfer the token with ID
tokenID
, by using theERC20NFTs
contract, which is exposed in the library asISC.nfts
, and calling the standardtransferFrom
function:
ISC.nfts.transferFrom(msg.sender, _destination, tokenID);