I'm fairly new to solidity and especially token contracts, so please correct me if I'm missing something obvious.

I am currently working on my own implementation of ERC721 token (using ERC721URIStorage too), and I'm thinking about the best way to get tokenID given a wallet address. Suppose a DApp is connected to user wallet, using the address I'd like to be able to query the tokenID so that I can perform other tokenID based queries and reads without reimplementing them all. Essentially I need a reverse ownerOf() function here. As far as I understand there is no function I can use in base openzeppelin implementation of ERC721 that could do that.

Is the best way to go just implementing my own function that'd access the _owners mapping of the base contract or is there a more elegant solution?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.