-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpopulate.sh
executable file
·139 lines (101 loc) · 4.79 KB
/
populate.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
source ./conf_private.sh
source ./conf_dac.sh
source ./conf.sh
source ./functions.sh
echo -e "\n\n----------------- POPULATING DAC -------------------\n\n";
dacaccounts="$dacextra $dacowner $dactokens $dacauthority $daccustodian $dacservice $dacmultisigs"
for act in $dacaccounts
do
create_act $act $EOSIO_PUB
#run_cmd "system newaccount --stake-cpu \"10.0000 EOS\" --stake-net \"10.0000 EOS\" --transfer --buy-ram-kbytes 1024 eosio $act $EOSIO_PUB"
#sleep 1;
#cleos --wallet-url $WALLET_URL -u $API_URL get account $act;
done
run_cmd "transfer eosio $dacowner \"100000.0000 EOS\""
run_cmd "set contract "$dactokens" "$DACCONTRACTS/eosdactoken/eosdactoken" -p eosdactokens"
run_cmd "get code $dactokens"
run_cmd "push action $dactokens newmemterms terms.json -p $dactokens"
echo "[$daccustodian]" > token_config.json
run_cmd "push action $dactokens updateconfig token_config.json -p $dactokens"
rm -f token_config.json
cleos --wallet-url $WALLET_URL -u $API_URL push action $dactokens create '["eosdactokens", "10000000000.0000 EOSDAC", 0]' -p $dactokens
cleos --wallet-url $WALLET_URL -u $API_URL push action $dactokens issue '["eosdactokens", "1000000000.0000 EOSDAC", "Issue"]' -p $dactokens
run_cmd "set contract $daccustodian "$DACCONTRACTS/daccustodian" -p $daccustodian"
run_cmd "get code $daccustodian"
run_cmd "get table $daccustodian daccustodian config"
run_cmd "push action $daccustodian updateconfig dac_config.json -p $daccustodian"
run_cmd "get table $daccustodian $daccustodian config"
run_cmd "set contract $dacservice "$DACCONTRACTS/dacservice" -p $dacservice"
run_cmd "get code $dacservice"
# Set dacmultisigs contract
run_cmd "set contract $dacmultisigs "$DACCONTRACTS/eosdacmultis" -p $dacmultisigs"
run_cmd "get code $dacmultisigs"
# Developer accounts
create_devs() {
create_act evilmikehere EOS54NkNpEt9aotyBvEZVfj54NuFAebaDLnyg2GtJ6pyvBoxxg9Aw
run_cmd "transfer eosio evilmikehere \"10000000.0000 EOS\""
run_cmd "transfer -c eosdactokens eosdactokens evilmikehere \"100000000.0000 EOSDAC\""
create_act kasperkasper EOS5JLKQDsJwqh6vVTbqVnHsHDk6He1Xo6nsQSy3536B1gx3FGzZJ
run_cmd "transfer eosio kasperkasper \"10000000.0000 EOS\""
run_cmd "transfer -c eosdactokens eosdactokens kasperkasper \"10000000.0000 EOSDAC\""
create_act dallasdallas EOS5kt3N8qEwwRYYvWWZaJvsoz9iuVurLRhw36vckmSesHdm8A9su
run_cmd "transfer eosio dallasdallas \"10000000.0000 EOS\""
run_cmd "transfer -c eosdactokens eosdactokens dallasdallas \"10000000.0000 EOSDAC\""
create_act lukedactest1 EOS8YE3xbMVSiDxrJCK3qRsxT8e7ThfvpxdmwaXgeMAn5VYJxE26G
run_cmd "transfer eosio lukedactest1 \"5000000.0000 EOS\""
run_cmd "transfer -c eosdactokens eosdactokens lukedactest1 \"5000000.0000 EOSDAC\""
create_act lukedactest2 EOS5qhoS2McrhC6mkW2gN4eDPZZJhf3EQEvUf1gZoRxJTJXoNrFVk
run_cmd "transfer eosio lukedactest2 \"5000000.0000 EOS\""
run_cmd "transfer -c eosdactokens eosdactokens lukedactest2 \"5000000.0000 EOSDAC\""
create_act tiktiktiktik EOS5yMoSRtLecubsQmTVSmdurCAnh6etwRsVDNoXx697Jr193GRKp
run_cmd "transfer eosio tiktiktiktik \"10000000.0000 EOS\""
run_cmd "transfer -c eosdactokens eosdactokens tiktiktiktik \"10000000.0000 EOSDAC\""
}
create_devs
# Get the terms to hash it for registration
CONSTITUTION=$(cleos -u $API_URL get table eosdactokens eosdactokens memberterms | jq '.rows[0].terms' | tr -d '"')
wget -O constitution.md $CONSTITUTION
ARCH=$( uname )
if [ "$ARCH" == "Darwin" ]; then
CON_MD5=$(md5 constitution.md | cut -d' ' -f4)
else
CON_MD5=$(md5sum constitution.md | cut -d' ' -f1)
fi
rm -f constitution.md
# Build this array for random voting later
CUST_ACCTS=()
# Custodian accounts
for x in {a..z}
do
CUST="eosdaccusta$x"
CUST_ACTS+=($CUST)
create_act $CUST $EOSIO_PUB
run_cmd "transfer -c eosdactokens eosdactokens $CUST \"100000.0000 EOSDAC\""
run_cmd "push action eosdactokens memberreg '[\"$CUST\", \"$CON_MD5\"]' -p $CUST"
run_cmd "transfer -c eosdactokens $CUST daccustodian \"35000.0000 EOSDAC\" \"daccustodian\""
run_cmd "push action daccustodian nominatecand '[\"$CUST\", \"10.0000 EOS\"]' -p $CUST"
done
# Voter accounts
for x in {a..z}
do
for y in {a..z}
do
VOT="eosdacvote$x$y"
create_act $VOT $EOSIO_PUB
run_cmd "transfer -c eosdactokens eosdactokens $VOT \"300000.0000 EOSDAC\""
run_cmd "push action eosdactokens memberreg '[\"$VOT\", \"$CON_MD5\"]' -p $VOT"
# random votes
numbers=$(jot -r 5 0 26)
votes=()
while read -r number; do
vote=${CUST_ACTS[$number]}
echo $vote
votes+=($vote)
done <<< "$numbers"
votes_arr=($(tr ' ' '\n' <<< "${votes[@]}" | sort -u | tr '\n' ' '))
json=$(jq -n --arg va "${votes_arr}" --arg v "${VOT}" '[$v, ($va | split(" ")) ]')
echo $json > vote_data.json
run_cmd "push action daccustodian votecust ./vote_data.json -p $VOT"
done
done