Page MenuHomePhabricator

[Cashtab] Airdrop Option - ignore airdrops below dust
ClosedPublic

Authored by emack on Mar 24 2022, 13:39.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABCb28ca29c09b4: [Cashtab] Airdrop Option - ignore airdrops below dust
Summary

As per T2140:
Option to parse the recipient airdrop amounts and filter out drops which are below dust (5.5 XEC).

Test Plan

Without ticking the 'ignore airdrops below min. payment dust' checkbox:

  • calculate an airdrop with at least 1 sub-dust airdrop and ensure the 'At least one airdrop is below the...' alert is displayed
  • calculate an airdrop with no sub-dust airdrops and ensure no such alert is displayed

Tick the 'ignore airdrops below min. payment dust' checkbox:

  • calculate an airdrop with at least 1 sub-dust airdrop and ensure it is not in the payment output list of airdrops
  • ensure this filtered payment output can be copied to clipboard
  • ensure this filtered payment output can be sent to the Send screen, sent successfully and block explorer showing the correct outputs
  • calculate an airdrop with no sub-dust airdrops and ensure no regression

Ensure no regression on routing from eToken Send screen to the airdrop screen.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emack requested review of this revision.Mar 24 2022, 13:39
bytesofman added inline comments.
web/cashtab/src/components/Airdrop/Airdrop.js
231 ↗(On Diff #32986)

I think this approach would be okay if we stopped here at features, but I think it would also be nice to eventually add an option to ignore balances below some custom level. That way an eToken creator could encourage people to hold some kind of arbitrary minimum balance of their eToken to be eligible for airdrops.

For the dust case, just popping out the dust values does not have a major impact on the size of the total airdrop. However, for a custom min threshold, there would be this impact.

So -- we'll have to run the calc twice, or start with a list of airdrop addresses and their eToken balance

Option A

  1. Get all addresses and their airdrop amount
  2. Remove all addresses where airdrop amount < dust
  3. Now, get all addresses and airdrop amount again (so that the dust amounts you ignored become distributed over the other addresses)

Option B

  1. Get all addresses and their eToken balance
  2. Remove all addresses with balances below minEligibleBalance
  3. Now, calculate addresses and airdrop amount

For the purposes of this specific diff...it's okay to land this diff using your current approach, but please create a task to solve the problem described above. This will eventually need to be the way it's done for dust, so it is probably less complicated in the long run to do it now.

407 ↗(On Diff #32986)

Use a switch

This revision now requires changes to proceed.Mar 30 2022, 17:15

Implemented extra pro rata calculation so airdrops below dust are filtered out, before a second pro rata calculation is carried out so the total airdrop amount is distributed corrected across the remaining recipients.

This revision is now accepted and ready to land.Mar 31 2022, 19:15