forked from gofractally/Eden
-
Notifications
You must be signed in to change notification settings - Fork 2
/
election_opt_in_out.sh
executable file
·59 lines (46 loc) · 1.28 KB
/
election_opt_in_out.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
#!/usr/bin/env sh
set -xe
CLEOS="cleos -u https://waxtest.eosn.io"
CONTRACT="test2.edev"
PARTICIPATING=true
SET_PUB_KEY=true
PUB_KEY="EOS676NTBDHP5dTZW8KftWfj5YtU5HUcFd4MsGrSJdTiVpn1RV7Lm"
# PUBLIC KEY: EOS676NTBDHP5dTZW8KftWfj5YtU5HUcFd4MsGrSJdTiVpn1RV7Lm
# PRIVATE KEY: 5JuyKTpt9xrD5shspHJRC5qNwku8yEREt1UeUBB5hLxbU7S3Fvq
# PASSWORD: %yCLM7RDwidC
for PARMS in $(cat ./genesis_accounts_long_list); do
ACCOUNT_NAME=$(echo $PARMS | cut -d "," -f1);
AUTHORIZATION="[{
\"actor\": \"$ACCOUNT_NAME\",
\"permission\": \"active\"
}]"
ELECTOPT_ACTION_DATA="{
\"member\": \"$ACCOUNT_NAME\",
\"participating\": $PARTICIPATING
}"
ELECTOPT_ACTION="{
\"account\": $CONTRACT,
\"name\": \"electopt\",
\"authorization\": $AUTHORIZATION,
\"data\": $ELECTOPT_ACTION_DATA
}"
SETENCPUBKEY_ACTION_DATA="{
\"account\": \"$ACCOUNT_NAME\",
\"key\": \"$PUB_KEY\"
}"
SETENCPUBKEY_ACTION="{
\"account\": $CONTRACT,
\"name\": \"setencpubkey\",
\"authorization\": $AUTHORIZATION,
\"data\": $SETENCPUBKEY_ACTION_DATA
}"
if [ "$SET_PUB_KEY" = true ] ; then
$CLEOS push transaction "{
\"actions\": [$ELECTOPT_ACTION, $SETENCPUBKEY_ACTION]
}"
else
$CLEOS push transaction "{
\"actions\": [$ELECTOPT_ACTION]
}"
fi
done;