-
Notifications
You must be signed in to change notification settings - Fork 13
/
airdrop.sh
executable file
·35 lines (30 loc) · 1.14 KB
/
airdrop.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
SYMBOL="IQ"
ISSUER="everipediaiq"
SNAPSHOT_FILE="iq_snapshot.csv"
echo "Creating token..."
CREATED=$(cleos get table $ISSUER $SYMBOL stat | grep $SYMBOL)
if [[ -z $CREATED ]]; then
echo "Creating..."
cleos push action $ISSUER create "[\"$ISSUER\", \"100000000000.000 $SYMBOL\"]" -p $ISSUER@active
else
echo "Token exists. Skipping create"
fi
ISSUANCE=$(cleos get table $ISSUER $ISSUER accounts | grep $SYMBOL)
if [[ -z $ISSUANCE ]]; then
echo "Issuing..."
cleos push action $ISSUER issue "[\"$ISSUER\", \"10000000000.000 $SYMBOL\", \"initial supply\"]" -p $ISSUER@active
else
echo "Token already issued. Skipping issue"
fi
for line in $(cat $SNAPSHOT_FILE); do
ACCOUNT=$(echo $line | tr "," "\n" | head -2 | tail -1)
AMOUNT=$(echo $line | tr "," "\n" | tail -1)
CURRENT_BALANCE=$(cleos get table $ISSUER $ACCOUNT accounts | grep $SYMBOL)
if [[ -z $CURRENT_BALANCE ]]; then
echo "Airdropping $AMOUNT $SYMBOL to $ACCOUNT"
cleos push action $ISSUER transfer "[\"$ISSUER\", \"$ACCOUNT\", \"$AMOUNT $SYMBOL\", \"airdrop\"]" -p $ISSUER@active
else
echo "Skipping $ACCOUNT"
fi
done