Skip to content

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