Skip to content

Commit

Permalink
Display estimate of total amount of tokens and recipients
Browse files Browse the repository at this point in the history
  • Loading branch information
praskoson committed Jun 8, 2021
1 parent a37ff44 commit 9f934bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion tools/flat-distributor/flat-distributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,13 @@ def transfer(input_path, interactive, drop_amount,
f"Running airdrop for the Token Mint: {bcolors.OKGREEN}{mint}{bcolors.ENDC}")
drop = amount_prompt(drop_amount)
print(
f"Airdrop amount: {bcolors.OKGREEN}{drop:,.{decimals}f}{bcolors.ENDC}\n")
f"Airdrop amount: {bcolors.OKGREEN}{drop:,.{decimals}f}{bcolors.ENDC}")

try:
with open(input_path) as f:
address_list = f.read().splitlines()
print(f'Airdropping to {bcolors.OKGREEN}{len(address_list)} users{bcolors.ENDC}')
print(f'Estimated total tokens to be distributed: {bcolors.OKGREEN}{(len(address_list) * drop):,f}{bcolors.ENDC}\n')
except (OSError, IOError) as e:
sys.exit(f"Error opening address list files.\n{e.strerror}")

Expand Down
3 changes: 2 additions & 1 deletion tools/proportional-distributor/proportional-distributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,15 @@ def transfer(input_path, interactive, drop_amount,
f"Running airdrop for the Token Mint: {bcolors.OKGREEN}{mint}{bcolors.ENDC}")
total_drop = amount_prompt(drop_amount)
print(
f"Airdrop amount: {bcolors.OKGREEN}{total_drop:,.{decimals}f}{bcolors.ENDC}\n")
f"Total airdrop amount: {bcolors.OKGREEN}{total_drop:,.{decimals}f}{bcolors.ENDC}")

accounts = OrderedDict()
try:
with open(input_path) as f:
for line in f:
address, balance = line.split(',')
accounts[address.strip()] = float(balance.strip())
print(f'Airdropping to {bcolors.OKGREEN}{len(accounts)}{bcolors.ENDC} users\n')

except (OSError, IOError, IndexError, ValueError) as e:
sys.exit(f"Error opening or reading address/exclusion files: {str(e)}")
Expand Down

0 comments on commit 9f934bb

Please sign in to comment.