-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathtest_proposal_multiple.sh
executable file
·200 lines (135 loc) · 8.55 KB
/
test_proposal_multiple.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
BIN=neutrond
CHAIN_ID_1=test-1
NEUTRON_DIR=${NEUTRON_DIR:-../neutron}
HOME_1=${NEUTRON_DIR}/data/test-1/
USERNAME_1=demowallet1
USERNAME_2=demowallet3
USERNAME_3=rly1
# DAO addresses
VAULT_ADDRESS=neutron14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s5c2epq
VOTE_ADDRESS=neutron1zwv6feuzhy6a9wekh96cd57lsarmqlwxdypdsplw6zhfncqw6ftqqgmq2a
CORE_ADDRESS=neutron1nc5tatafv6eyq7llkr2gv50ff9e22mnf70qgjlv737ktmt4eswrqcd0mrx
PROPOSE_MULTIPLE_ADDRESS=neutron1pvrwmjuusn9wh34j7y520g8gumuy9xtl3gvprlljfdpwju3x7ucsj3fj40
PRE_PROPOSE_MULTIPLE_ADDRESS=neutron10qt8wg0n7z740ssvf3urmvgtjhxpyp74hxqvqt7z226gykuus7eqjqrsug
#
# send funds to contract to send them back
RES=$(${BIN} tx bank send ${USERNAME_1} ${CORE_ADDRESS} 1000untrn -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
bank->send from wallet 1:
"
echo $RES
# STAKING
# bond funds from wallet 1
RES=$(${BIN} tx wasm execute $VAULT_ADDRESS "{\"bond\": {}}" --amount 1000untrn --from ${USERNAME_1} -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
staking from wallet 1:
"
echo $RES
# bond funds from wallet 2
RES=$(${BIN} tx wasm execute $VAULT_ADDRESS "{\"bond\": {}}" --amount 1000untrn --from ${USERNAME_2} -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
staking from wallet 2:
"
echo $RES
# bond funds from wallet 3
RES=$(${BIN} tx wasm execute $VAULT_ADDRESS "{\"bond\": {}}" --amount 1000untrn --from ${USERNAME_3} -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
staking from wallet 3:
"
echo $RES
# PROPOSAL 1 (to pick 1 option)
#propose proposal we're going to pass
PARAM_CHANGES="[{\"subspace\":\"icahost\",\"key\":\"HostEnabled\",\"value\":\"false\"}]"
PARAM_CHANGE_PROPOSAL="{\"param_change_proposal\":{\"title\":\"title\",\"description\":\"description\",\"param_changes\":$PARAM_CHANGES}}"
PARAM_CHANGES_2="[{\"subspace\":\"icahost\",\"key\":\"HostEnabled\",\"value\":\"true\"}]"
PARAM_CHANGE_PROPOSAL_2="{\"param_change_proposal\":{\"title\":\"title2\",\"description\":\"description2\",\"param_changes\":$PARAM_CHANGES_2}}"
MSGS="[{\"custom\":{\"submit_admin_proposal\":{\"admin_proposal\": $PARAM_CHANGE_PROPOSAL}}}]"
MSGS_2="[{\"custom\":{\"submit_admin_proposal\":{\"admin_proposal\": $PARAM_CHANGE_PROPOSAL_2}}}]"
CHOICES="{\"options\": [{\"description\": \"choice1\", \"msgs\": $MSGS}, {\"description\": \"choice2\", \"msgs\": $MSGS_2}]}"
PROPOSE="{\"title\": \"TEST\", \"description\": \"BOTTOMTTEXT\", \"choices\": $CHOICES}"
PROP="{\"propose\": {\"msg\": {\"propose\": $PROPOSE}}}"
RES=$(${BIN} tx wasm execute $PRE_PROPOSE_MULTIPLE_ADDRESS "$PROP" --amount 1000untrn --from ${USERNAME_1} -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
propose proposal to be passed:
"
echo $RES
#### vote option 1 from wallet 1
RES=$(${BIN} tx wasm execute $PROPOSE_MULTIPLE_ADDRESS "{\"vote\": {\"proposal_id\": 1, \"vote\": {\"option_id\": 1}}}" --from ${USERNAME_1} -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
vote option 1 from wallet1:
"
echo $RES
#### vote option 0 from wallet 2
RES=$(${BIN} tx wasm execute $PROPOSE_MULTIPLE_ADDRESS "{\"vote\": {\"proposal_id\": 1, \"vote\": {\"option_id\": 0}}}" --from ${USERNAME_2} -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
vote option 0 from wallet 2:
"
echo $RES
#### vote option 1 from wallet 3
RES=$(${BIN} tx wasm execute $PROPOSE_MULTIPLE_ADDRESS "{\"vote\": {\"proposal_id\": 1, \"vote\": {\"option_id\": 1}}}" --from ${USERNAME_3} -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
vote option 1 from wallet 3:
"
echo $RES
RES=$(${BIN} tx wasm execute $PROPOSE_MULTIPLE_ADDRESS "{\"execute\": {\"proposal_id\": 1}}" --from ${USERNAME_1} -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
execute proposal:
"
echo $RES
# PROPOSAL 2 (to pick "none of the above" option)
#propose proposal we're going to pass
PARAM_CHANGES="[{\"subspace\":\"icahost\",\"key\":\"HostEnabled\",\"value\":\"false\"}]"
PARAM_CHANGE_PROPOSAL="{\"param_change_proposal\":{\"title\":\"title\",\"description\":\"description\",\"param_changes\":$PARAM_CHANGES}}"
PARAM_CHANGES_2="[{\"subspace\":\"icahost\",\"key\":\"HostEnabled\",\"value\":\"true\"}]"
PARAM_CHANGE_PROPOSAL_2="{\"param_change_proposal\":{\"title\":\"title2\",\"description\":\"description2\",\"param_changes\":$PARAM_CHANGES_2}}"
MSGS="[{\"custom\":{\"submit_admin_proposal\":{\"admin_proposal\": $PARAM_CHANGE_PROPOSAL}}}]"
MSGS_2="[{\"custom\":{\"submit_admin_proposal\":{\"admin_proposal\": $PARAM_CHANGE_PROPOSAL_2}}}]"
CHOICES="{\"options\": [{\"description\": \"choice1\", \"msgs\": $MSGS}, {\"description\": \"choice2\", \"msgs\": $MSGS_2}]}"
PROPOSE="{\"title\": \"TEST\", \"description\": \"BOTTOMTTEXT\", \"choices\": $CHOICES}"
PROP="{\"propose\": {\"msg\": {\"propose\": $PROPOSE}}}"
RES=$(${BIN} tx wasm execute $PRE_PROPOSE_MULTIPLE_ADDRESS "$PROP" --amount 1000untrn --from ${USERNAME_1} -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
propose proposal to be not passed:
"
echo $RES
#### vote option 2 from wallet 1
RES=$(${BIN} tx wasm execute $PROPOSE_MULTIPLE_ADDRESS "{\"vote\": {\"proposal_id\": 2, \"vote\": {\"option_id\": 2}}}" --from ${USERNAME_1} -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
vote option 2 from wallet1:
"
echo $RES
#### vote option 0 from wallet 2
RES=$(${BIN} tx wasm execute $PROPOSE_MULTIPLE_ADDRESS "{\"vote\": {\"proposal_id\": 2, \"vote\": {\"option_id\": 0}}}" --from ${USERNAME_2} -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
vote option 0 from wallet 2:
"
echo $RES
#### vote option 2 from wallet 3
RES=$(${BIN} tx wasm execute $PROPOSE_MULTIPLE_ADDRESS "{\"vote\": {\"proposal_id\": 2, \"vote\": {\"option_id\": 2}}}" --from ${USERNAME_3} -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
vote option 2 from wallet 3:
"
echo $RES
RES=$(${BIN} tx wasm execute $PROPOSE_MULTIPLE_ADDRESS "{\"execute\": {\"proposal_id\": 2}}" --from ${USERNAME_1} -y --chain-id ${CHAIN_ID_1} --output json --broadcast-mode=block --gas-prices 0.0025untrn --gas 1000000 --keyring-backend test --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
execute proposal (should fail because not passed):
"
echo $RES
RES=$(${BIN} q wasm contract-state smart $CORE_ADDRESS "{\"total_power_at_height\": {}}" --chain-id ${CHAIN_ID_1} --output json --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
total voting power, should be 3000:
"
echo $RES
RES=$(${BIN} q wasm contract-state smart $PROPOSE_MULTIPLE_ADDRESS "{\"proposal\": {\"proposal_id\": 1}}" --chain-id ${CHAIN_ID_1} --output json --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
should be status:executed"
echo $RES
RES=$(${BIN} q wasm contract-state smart $PROPOSE_MULTIPLE_ADDRESS "{\"proposal\": {\"proposal_id\": 2}}" --chain-id ${CHAIN_ID_1} --output json --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo "
should be status:rejected"
echo $RES
sleep 5
echo "
list archived adminmodule proposals (should still be one param change proposal (first choice of proposal#1))"
RES=$(${BIN} q adminmodule archivedproposals --chain-id ${CHAIN_ID_1} --home ${HOME_1} --node tcp://127.0.0.1:16657)
echo $RES