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

added support for querying the address from an NFT ID, closes #820 #878

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

theghostmac
Copy link

This implementation follows these steps:

  1. Query the NFT contract to get the current owner of the token.
  2. Check if the token is staked in this contract by iterating through STAKED_NFTS_PER_OWNER map.
  3. If the token is staked, it returns the staker’s address.
  4. If the token is not staked, it returns the owner from the NFT contract. So this way, whether the NFT is staked or not, the owner/staker can be queried.
  5. Write tests for:
    1. Querying the owner of a staked NFT.
    2. Querying the owner of an unstaked NFT.
    3. Querying a non-existent nFT.
    4. Querying the owner of an NFT after unstacking
    5. Querying owners for multiple staked NFTs from different users.

@ismellike
Copy link
Contributor

We might want to use an IndexedMap instead to avoid using O(n) lookup on staked tokens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants