HomePhabricator

[Cashtab] Token burn functionality

Description

[Cashtab] Token burn functionality

Summary:
Adding a new feature in the Token Details screen to allow the wallet holder to burn specific amount of eTokens from their address via the TokenType1.generateBurnOpReturn() api call.

  • new burnEtoken() function created in useBCH.js to burn eTokens via the generateBurnOpReturn() api
  • sendToken.js updated with the burn UI
  • added useBCH.js unit tests to test parsing of eToken burning transactions and burning of invalid eToken IDs
  • Burn notification added to Notifications.js

Manifest: T2189

Test Plan:
npm start

Frontend

  • navigate to the eToken info screen and click the Burn button without inputting the burn amount and verify the burn amount defaults to 1
  • attempt to input 0 or below, or above the eToken balance in the wallet and verify validation error is displayed
  • click on the max button and ensure the entirety of the token balance is inserted into the burn amount input
  • test with a valid burn amount and ensure the burn confirmation dialogue shows the correct eToken burn amount and eToken ticker
  • ensure clicking confirm on the burn confirmation dialogue with an incorrect phrase results in validation error
  • ensure a correct burn confirmation phrase results in the completion of the burn transaction
  • verify burn option is not displayed on a fresh wallet with no eTokens since the token details screen is not accessible.
  • verify cross browser compatibility across Chrome and Firefox

Backend

  • test a burn amount of minimum (> 0) value and ensure the user's eToken balance decrements accordingly
  • test burn amount which is within the token's decimal amount and ensure transaction is successful
  • test burn amount which exceeds the token's decimal amount and ensure transaction is still successful, with the token balance updated to a figure that is rounded to the token's designated decimal point
  • ensure the Total Burned figure is a correct tally of all previous burn transactions up to this point
  • test burn amount which is the entire eToken balance and stay on that same eToken screen, and ensure the user is redirected to the Wallet screen and the eToken is no longer displayed in the eTokens list
  • test the customized dust error message by reducing XEC balance to below dust
  • ensure burn function works for eTokens which existed in the wallet prior to this diff
  • ensure burn function works for newly created eTokens

Regression

  • ensure a normal send eToken transaction completes successfully
  • ensure a normal create eToken transaction completes successfully and is displayed correctly in the eTokens list

Extension/Mobile

  • Verify send-token and burn confirmation dialogues are displayed correctly in reduced dimensions

Reviewers: bytesofman, #bitcoin_abc

Reviewed By: bytesofman, #bitcoin_abc

Subscribers: aimal

Differential Revision: https://reviews.bitcoinabc.org/D10912

Details

Provenance
emackAuthored on Jan 27 2022, 13:58
emackPushed on Mar 22 2022, 23:31
Reviewer
Restricted Project
Differential Revision
D10912: [Cashtab] Token burn functionality
Parents
rABC779919230ef7: Fix the build on some platforms by using an explicit cast for Univalue type
Branches
Unknown
Tags
Unknown