ERC1155, ERC721 or ERC20?


Just wanted to run a concept by everyone and see if it is viable/if any developers would be interested in helping out. For this project we have two tokens: a game “card” (NFT) and a reward “token” (Fungible). How this works is that you obtain a card, which has the ability of allowing you to redeem tokens upon meeting all of the requirements. Certain cards will allow you to redeem more tokens. Here’s where we’re stuck.

First - What is the most effective way of allowing only the owner of said card to redeem the tokens?

  • Token whitelist for specific wallet id’s?
  • Airdrops?

Second - Is it possible for us to set up a system where we can trade in the card for the specific amount of tokens, but not burn the card so that others can use it and redeem it as well?

Thanks for your time and I look forward to your responses.

Hit me up on Telegram @PeterRoyHere

For the first part, you could go for a Merkle Proof whitelisting (Openzeppelin has an implementation of this here).

  1. Generate a merkle tree using token # of the Card and the amount of Token it allows its holder to claim. Store the root hash of the Merkle Tree in the contract.
  2. For each Card ID, you can store a "proof" (You can generate merkle proofs hash using this library) in a database or your web3 frontend code.
  3. Make a call to the "Token Claim" function with the proof and the amount the user wishes to claim, and the Card Token # the user is claiming to have. The function will verify that the user does hold the Card ID (using ownerOf(tokenId) and then verify that the proof allows the given ID using verify(proof, root, leaf). Once the claim is made, you can add the tokenID to a "claimed" mapping.

The second part can also work similar to the procedure mentioned above. Sounds like an NFT staking contract. Have the contract store those Cards (or send them to another "Treasury" contract that knows what to do with them). Make sure you future-proof it by having a way to get those cards back by the user who submitted them, after, say X days.

Into the contract: Card.transferFrom(msg.sender, address(this), id); and out of the contract: Card.transferFrom(address(this), msg.sender, id);. The "Approval" can be made in the frontend for the transfers.

Hello, As a senior blockchain developer, I am veryinterested in your posting.
can we work together?