I want to sell an NFT within my smart contract. But first, I want to check with a require
statement if the token (NFT) exists or not before moving on to the next steps. I have tried require(ownerOf(tokenId), "Token doesn't exists.");
but Remix says:
from solidity:
TypeError: No matching declaration found after argument-dependent lookup.
--> contracts/charMinter.sol:108:9:
|
108 | require(ownerOf(tokenId), "Token doesn't exists.");
| ^^^^^^^
Note: Candidate: function require(bool)
Note: Candidate: function require(bool, string memory)
I also tried require(tokenURI(tokenId), "Token doesn't exists.");
but I get the same error as above. Is there a way to check if a token exists or not?