@@ -54,6 +54,68 @@ func TestXionSendPlatformFee(t *testing.T) {
54
54
require .NoError (t , err )
55
55
56
56
cdc := codec .NewProtoCodec (xion .Config ().EncodingConfig .InterfaceRegistry )
57
+ config := types .GetConfig ()
58
+ config .SetBech32PrefixForAccount ("xion" , "xionpub" )
59
+
60
+ setPlatformMinimumsMsg := xiontypes.MsgSetPlatformMinimum {
61
+ Authority : authtypes .NewModuleAddress ("gov" ).String (),
62
+ Minimums : types.Coins {types.Coin {Amount : math .NewInt (10 ), Denom : "uxion" }},
63
+ }
64
+
65
+ msg , err := cdc .MarshalInterfaceJSON (& setPlatformMinimumsMsg )
66
+ require .NoError (t , err )
67
+
68
+ _ , err = xion .GetNode ().ExecTx (ctx ,
69
+ xionUser .KeyName (),
70
+ "xion" , "send" , xionUser .KeyName (),
71
+ "--chain-id" , xion .Config ().ChainID ,
72
+ recipientKeyAddress , fmt .Sprintf ("%d%s" , 100 , xion .Config ().Denom ),
73
+ )
74
+ // platform minimums unset, so this should fail
75
+ require .Error (t , err )
76
+
77
+ prop := cosmos.TxProposalv1 {
78
+ Messages : []json.RawMessage {msg },
79
+ Metadata : "" ,
80
+ Deposit : "100uxion" ,
81
+ Title : "Set platform percentage to 5%" ,
82
+ Summary : "Ups the platform fee to 5% for the integration test" ,
83
+ }
84
+ paramChangeTx , err := xion .SubmitProposal (ctx , xionUser .KeyName (), prop )
85
+ require .NoError (t , err )
86
+ t .Logf ("Platform percentage change proposal submitted with ID %s in transaction %s" , paramChangeTx .ProposalID , paramChangeTx .TxHash )
87
+
88
+ proposalID , err := strconv .Atoi (paramChangeTx .ProposalID )
89
+ require .NoError (t , err )
90
+
91
+ require .Eventuallyf (t , func () bool {
92
+ proposalInfo , err := xion .GovQueryProposal (ctx , uint64 (proposalID ))
93
+ if err != nil {
94
+ require .NoError (t , err )
95
+ } else {
96
+ if proposalInfo .Status == govv1beta1 .StatusVotingPeriod {
97
+ return true
98
+ }
99
+ t .Logf ("Waiting for proposal to enter voting status VOTING, current status: %s" , proposalInfo .Status )
100
+ }
101
+ return false
102
+ }, time .Second * 11 , time .Second , "failed to reach status VOTING after 11s" )
103
+
104
+ err = xion .VoteOnProposalAllValidators (ctx , uint64 (proposalID ), cosmos .ProposalVoteYes )
105
+ require .NoError (t , err )
106
+
107
+ require .Eventuallyf (t , func () bool {
108
+ proposalInfo , err := xion .GovQueryProposal (ctx , uint64 (proposalID ))
109
+ if err != nil {
110
+ require .NoError (t , err )
111
+ } else {
112
+ if proposalInfo .Status == govv1beta1 .StatusPassed {
113
+ return true
114
+ }
115
+ t .Logf ("Waiting for proposal to enter voting status PASSED, current status: %s" , proposalInfo .Status )
116
+ }
117
+ return false
118
+ }, time .Second * 11 , time .Second , "failed to reach status PASSED after 11s" )
57
119
58
120
_ , err = xion .GetNode ().ExecTx (ctx ,
59
121
xionUser .KeyName (),
@@ -74,29 +136,26 @@ func TestXionSendPlatformFee(t *testing.T) {
74
136
"balance never correctly changed" )
75
137
76
138
// step 2: update the platform percentage to 5%
77
- config := types .GetConfig ()
78
- config .SetBech32PrefixForAccount ("xion" , "xionpub" )
79
139
80
140
setPlatformPercentageMsg := xiontypes.MsgSetPlatformPercentage {
81
141
Authority : authtypes .NewModuleAddress ("gov" ).String (),
82
142
PlatformPercentage : 500 ,
83
143
}
84
-
85
- msg , err := cdc .MarshalInterfaceJSON (& setPlatformPercentageMsg )
144
+ msg , err = cdc .MarshalInterfaceJSON (& setPlatformPercentageMsg )
86
145
require .NoError (t , err )
87
146
88
- prop : = cosmos.TxProposalv1 {
147
+ prop = cosmos.TxProposalv1 {
89
148
Messages : []json.RawMessage {msg },
90
149
Metadata : "" ,
91
150
Deposit : "100uxion" ,
92
151
Title : "Set platform percentage to 5%" ,
93
152
Summary : "Ups the platform fee to 5% for the integration test" ,
94
153
}
95
- paramChangeTx , err : = xion .SubmitProposal (ctx , xionUser .KeyName (), prop )
154
+ paramChangeTx , err = xion .SubmitProposal (ctx , xionUser .KeyName (), prop )
96
155
require .NoError (t , err )
97
156
t .Logf ("Platform percentage change proposal submitted with ID %s in transaction %s" , paramChangeTx .ProposalID , paramChangeTx .TxHash )
98
157
99
- proposalID , err : = strconv .Atoi (paramChangeTx .ProposalID )
158
+ proposalID , err = strconv .Atoi (paramChangeTx .ProposalID )
100
159
require .NoError (t , err )
101
160
102
161
require .Eventuallyf (t , func () bool {
0 commit comments