Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undeclared Identifier tokensOfOwner (ERC721AQueryable.sol) #460

Closed
batmanbury opened this issue May 4, 2023 · 2 comments
Closed

Undeclared Identifier tokensOfOwner (ERC721AQueryable.sol) #460

batmanbury opened this issue May 4, 2023 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@batmanbury
Copy link

batmanbury commented May 4, 2023

General information

Description Value
Project version 2.4.5
Operating system and version macOS Monterey 12.5.1
NodeJS version 16.13.1
NPM version 8.1.2
Yarn version 1.22.19
Truffle version 5.8.4

Describe the bug

I added a function to the contract file, which uses tokensOfOwner from ERC721AQueryable.sol, which is clearly imported at the top of the YourNftToken.sol file:

import "erc721a/contracts/extensions/ERC721AQueryable.sol";

And here is my new function, checking for ownership of an NFT in a wallet:

  function checkNFTOwnership(address walletAddress) public view returns (uint256) {
    uint256[] memory tokenIds = tokensOfOwner(walletAddress);
    for (uint i = 0; i < tokenIds.length; i++) {
      uint256 tokenId = tokenIds[i];
      if (_exists(tokenId) && ownerOf(tokenId) == walletAddress) {
        // Check if the NFT belongs to this collection
        if (tokenId >= _startTokenId() && tokenId < _startTokenId() + maxSupply) {
          return tokenId;
        }
      }
    }
    return 0;
  }

But my VSCode editor is underlining the use of this, and I am unable to deploy. All dependencies have been installed, and I have no errors otherwise. I clearly see the file containing tokensOfOwners inside node_modules after installation.

Expected behavior

tokensOfOwners function should be imported correctly

Screenshots

image

Screen Shot 2023-05-03 at 10 47 35 PM

@liarco
Copy link
Member

liarco commented May 4, 2023

Hi @batmanbury,
At the moment I actively maintain my projects by fixing bugs that people report here on GitHub. This is not a bug since you are using the function the wrong way. (That function is external so it's not meant to be called inside your own contract)

For anything regarding custom implementations/features or previews of future updates I provide this kind of support to holders of ODC tokens only (https://opendevs.io/). This helps me focusing my resources on people who support my work and it allows me to work on new tools to bring out in the future with less distractions.

If you are already a holder you can follow the instructions on the website to join our private Discord channel and ask your questions there. We can help you with implementing the features you need. 💪

I hope this helps and I wish you a wonderful day! ☀️

@liarco liarco closed this as completed May 4, 2023
@liarco liarco added the duplicate This issue or pull request already exists label May 4, 2023
@batmanbury
Copy link
Author

Thanks @liarco !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants