NFT Redemption - UI and utility function.

Status
Completed
Assign
Pradhumna Pancholi
type
Redemption w/ NFT
effort points
Start Date
Apr 7, 2022
End Date
priority
high
tags
NFT redemption
Github PR
The task encapsulates the process of adding UI and utility functions to allow NFT redemption.
It is divided into three parts.
 
Requirements:
  1. Endpoint to receive redeemable NFTs added by the admin.
  1. DB for redeemed NFTs.
 
Potential Complexity.
  1. What if users have multiple redeemable NFTs?
 
  1. Theme-extension-app UI
    1. Add a “Redeem NFT” button on the token options modal.
      Connect to user wallet and derive user’s address.
  1. Redeem function - handled on the server-side.
    1. Check if the product(s) in cart is redeemable via NFT. If yes, return the contract address. If no, return “No redeemable NFT”.
      Use Moralis to fetch all the NFTs held by the address. Call “redeem” function that will be implemented on the server with this array of NFTs
      Compare users’ NFTs with the redeemable NFT. If we don’t have a match, return the error “No redeemable NFT”. Otherwise, continue to the next step.
      Call our NFTs DB (we will be storing our redeemed token id with respect to the address here) to check if that token id has been already used to redeem. If a match is found, return the error “NFT already redeemed”. Otherwise, continue to the next step.
  1. Redeem
    1. Check for the product that is allowed to be redeemed by the NFT in the user’s cart.
      Generate coupon code and redirect the user to the checkout page with the code applied.
      —- steps under this needs to be discussed—
      Once the purchase is successful, add the token id to redeemed DB. (Potential problem, what if the user doesn’t check out right away. Adding redeem DB to be updated after purchase can allow them to generate multiple coupons with the same NFT - Copy the codes - and use them all later to buy multiple products with the same NFT. On the other hand, if we add the token id to redeemed DB before generating the coupon code will allow bypassing this flaw. Although, it can lead to bad UX if they for some reason didn’t check out right away. This seems to be an edge case scenario that can be taken care of as every coupon generated is tracked and we can add this id to its record)
 

NFT Redemption - UI and utility function.

Status
Completed
Assign
Pradhumna Pancholi
type
Redemption w/ NFT
effort points
Start Date
Apr 7, 2022
End Date
priority
high
tags
NFT redemption
Github PR
The task encapsulates the process of adding UI and utility functions to allow NFT redemption.
It is divided into three parts.
 
Requirements:
  1. Endpoint to receive redeemable NFTs added by the admin.
  1. DB for redeemed NFTs.
 
Potential Complexity.
  1. What if users have multiple redeemable NFTs?
 
  1. Theme-extension-app UI
    1. Add a “Redeem NFT” button on the token options modal.
      Connect to user wallet and derive user’s address.
  1. Redeem function - handled on the server-side.
    1. Check if the product(s) in cart is redeemable via NFT. If yes, return the contract address. If no, return “No redeemable NFT”.
      Use Moralis to fetch all the NFTs held by the address. Call “redeem” function that will be implemented on the server with this array of NFTs
      Compare users’ NFTs with the redeemable NFT. If we don’t have a match, return the error “No redeemable NFT”. Otherwise, continue to the next step.
      Call our NFTs DB (we will be storing our redeemed token id with respect to the address here) to check if that token id has been already used to redeem. If a match is found, return the error “NFT already redeemed”. Otherwise, continue to the next step.
  1. Redeem
    1. Check for the product that is allowed to be redeemed by the NFT in the user’s cart.
      Generate coupon code and redirect the user to the checkout page with the code applied.
      —- steps under this needs to be discussed—
      Once the purchase is successful, add the token id to redeemed DB. (Potential problem, what if the user doesn’t check out right away. Adding redeem DB to be updated after purchase can allow them to generate multiple coupons with the same NFT - Copy the codes - and use them all later to buy multiple products with the same NFT. On the other hand, if we add the token id to redeemed DB before generating the coupon code will allow bypassing this flaw. Although, it can lead to bad UX if they for some reason didn’t check out right away. This seems to be an edge case scenario that can be taken care of as every coupon generated is tracked and we can add this id to its record)
Â