Skip to content

Commit 7005bef

Browse files
Merge PR: add MsgContractMethodBlockedListProposalTest (#103)
* public class MsgContractMethodBlockedListProposalTest { * changed the class name * add obj get method * obj to json * add code * add ManageContractMethodBlockedListProposal * fix MsgContractMethodBlockedListProposalValue json encode Co-authored-by: xiangjianmeng <805442788@qq.com>
1 parent 5b47129 commit 7005bef

7 files changed

Lines changed: 414 additions & 17 deletions

File tree

okexchain-java-sdk.ipr

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,127 @@
5252
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
5353
<option name="MAXIMUM_HEAP_SIZE" value="128" />
5454
</component>
55+
<component name="Palette2">
56+
<group name="Swing">
57+
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
58+
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
59+
</item>
60+
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
61+
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
62+
</item>
63+
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
64+
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
65+
</item>
66+
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
67+
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
68+
</item>
69+
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
70+
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
71+
<initial-values>
72+
<property name="text" value="Button" />
73+
</initial-values>
74+
</item>
75+
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
76+
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
77+
<initial-values>
78+
<property name="text" value="RadioButton" />
79+
</initial-values>
80+
</item>
81+
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
82+
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
83+
<initial-values>
84+
<property name="text" value="CheckBox" />
85+
</initial-values>
86+
</item>
87+
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
88+
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
89+
<initial-values>
90+
<property name="text" value="Label" />
91+
</initial-values>
92+
</item>
93+
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
94+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
95+
<preferred-size width="150" height="-1" />
96+
</default-constraints>
97+
</item>
98+
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
99+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
100+
<preferred-size width="150" height="-1" />
101+
</default-constraints>
102+
</item>
103+
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
104+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
105+
<preferred-size width="150" height="-1" />
106+
</default-constraints>
107+
</item>
108+
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
109+
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
110+
<preferred-size width="150" height="50" />
111+
</default-constraints>
112+
</item>
113+
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
114+
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
115+
<preferred-size width="150" height="50" />
116+
</default-constraints>
117+
</item>
118+
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
119+
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
120+
<preferred-size width="150" height="50" />
121+
</default-constraints>
122+
</item>
123+
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
124+
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
125+
</item>
126+
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
127+
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
128+
<preferred-size width="150" height="50" />
129+
</default-constraints>
130+
</item>
131+
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
132+
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
133+
<preferred-size width="150" height="50" />
134+
</default-constraints>
135+
</item>
136+
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
137+
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
138+
<preferred-size width="150" height="50" />
139+
</default-constraints>
140+
</item>
141+
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
142+
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
143+
<preferred-size width="200" height="200" />
144+
</default-constraints>
145+
</item>
146+
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
147+
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
148+
<preferred-size width="200" height="200" />
149+
</default-constraints>
150+
</item>
151+
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
152+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
153+
</item>
154+
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
155+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
156+
</item>
157+
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
158+
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
159+
</item>
160+
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
161+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
162+
</item>
163+
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
164+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
165+
<preferred-size width="-1" height="20" />
166+
</default-constraints>
167+
</item>
168+
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
169+
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
170+
</item>
171+
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
172+
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
173+
</item>
174+
</group>
175+
</component>
55176
<component name="ProjectModuleManager">
56177
<modules>
57178
<module filepath="$PROJECT_DIR$/okexchain-java-sdk.iml" />

okexchain-java-sdk.iws

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
<project version="4">
33
<component name="ChangeListManager">
44
<list default="true" id="49e3a19a-6ae2-4ed1-af24-6dc7ea51f25b" name="Default Changelist" comment="">
5-
<change beforePath="$PROJECT_DIR$/okexchain-java-sdk.iml" beforeDir="false" afterPath="$PROJECT_DIR$/okexchain-java-sdk.iml" afterDir="false" />
6-
<change beforePath="$PROJECT_DIR$/okexchain-java-sdk.ipr" beforeDir="false" afterPath="$PROJECT_DIR$/okexchain-java-sdk.ipr" afterDir="false" />
75
<change beforePath="$PROJECT_DIR$/okexchain-java-sdk.iws" beforeDir="false" afterPath="$PROJECT_DIR$/okexchain-java-sdk.iws" afterDir="false" />
8-
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
9-
<change beforePath="$PROJECT_DIR$/src/main/java/com/okexchain/msg/MsgBase.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/okexchain/msg/MsgBase.java" afterDir="false" />
10-
<change beforePath="$PROJECT_DIR$/src/main/java/com/okexchain/utils/crypto/AddressUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/okexchain/utils/crypto/AddressUtil.java" afterDir="false" />
11-
<change beforePath="$PROJECT_DIR$/src/test/java/crypto/CryptoTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/crypto/CryptoTest.java" afterDir="false" />
6+
<change beforePath="$PROJECT_DIR$/src/main/java/com/okexchain/msg/common/Block_methods.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/okexchain/msg/common/Block_methods.java" afterDir="false" />
7+
<change beforePath="$PROJECT_DIR$/src/main/java/com/okexchain/msg/common/Contract_addresses.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/okexchain/msg/common/Contract_addresses.java" afterDir="false" />
8+
<change beforePath="$PROJECT_DIR$/src/main/java/com/okexchain/msg/gov/MsgContractMethodBlockedListProposal.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/okexchain/msg/gov/MsgContractMethodBlockedListProposal.java" afterDir="false" />
9+
<change beforePath="$PROJECT_DIR$/src/main/java/com/okexchain/msg/gov/MsgContractMethodBlockedListProposalValue.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/okexchain/msg/gov/MsgContractMethodBlockedListProposalValue.java" afterDir="false" />
10+
<change beforePath="$PROJECT_DIR$/src/test/java/com/okexchain/test/MsgContractMethodBlockedListProposalTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/com/okexchain/test/MsgContractMethodBlockedListProposalTest.java" afterDir="false" />
1211
</list>
1312
<option name="SHOW_DIALOG" value="false" />
1413
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -211,6 +210,9 @@
211210
<option name="ADD_LABEL_ON_UNIT_TEST_PASSED" value="true" />
212211
<option name="ADD_LABEL_ON_UNIT_TEST_FAILED" value="true" />
213212
</component>
213+
<component name="MacroExpansionManager">
214+
<option name="directoryName" value="h7qoih5q" />
215+
</component>
214216
<component name="PerforceConfiguration">
215217
<option name="PORT" value="magic:1666" />
216218
<option name="USER" value="" />
@@ -272,6 +274,12 @@
272274
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
273275
<property name="nodejs_package_manager_path" value="npm" />
274276
</component>
277+
<component name="RecentsManager">
278+
<key name="MoveFile.RECENT_KEYS">
279+
<recent name="$PROJECT_DIR$/src/main/java/com/okexchain/msg/gov" />
280+
<recent name="$PROJECT_DIR$/src/main/java/com/okexchain/msg/common" />
281+
</key>
282+
</component>
275283
<component name="RunManager" selected="Application.Test">
276284
<configuration selected="false" default="true" type="Applet" factoryName="Applet">
277285
<module name="" />
@@ -303,17 +311,6 @@
303311
<option name="Make" enabled="true" />
304312
</method>
305313
</configuration>
306-
<configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
307-
<option name="arquillianRunConfiguration">
308-
<value>
309-
<option name="containerStateName" value="" />
310-
</value>
311-
</option>
312-
<option name="TEST_OBJECT" value="class" />
313-
<method v="2">
314-
<option name="Make" enabled="true" />
315-
</method>
316-
</configuration>
317314
<configuration name="CryptoTest.generatePrivateKeyFromMnemonic" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
318315
<module name="okexchain-java-sdk" />
319316
<extension name="coverage">
@@ -412,6 +409,17 @@
412409
<option name="presentableId" value="Default" />
413410
<updated>1632384005056</updated>
414411
<workItem from="1632384006387" duration="2382000" />
412+
<workItem from="1642584324951" duration="1758000" />
413+
<workItem from="1642588366222" duration="531000" />
414+
<workItem from="1642642959693" duration="95000" />
415+
<workItem from="1642643279772" duration="9000" />
416+
<workItem from="1642643642133" duration="35000" />
417+
<workItem from="1642644140962" duration="202000" />
418+
<workItem from="1642648025379" duration="948000" />
419+
<workItem from="1642649623168" duration="2043000" />
420+
<workItem from="1642663352115" duration="2192000" />
421+
<workItem from="1642675924951" duration="31000" />
422+
<workItem from="1642730473910" duration="3321000" />
415423
</task>
416424
<servers />
417425
</component>
@@ -463,6 +471,7 @@
463471
</entry>
464472
</map>
465473
</option>
474+
<option name="oldMeFiltersMigrated" value="true" />
466475
</component>
467476
<component name="VssConfiguration">
468477
<CheckoutOptions>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Copyright 2022 bejson.com
3+
*/
4+
package com.okexchain.msg.common;
5+
6+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
7+
import com.fasterxml.jackson.annotation.JsonProperty;
8+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
9+
import com.google.gson.annotations.SerializedName;
10+
import lombok.Data;
11+
import org.apache.commons.lang3.builder.ToStringBuilder;
12+
import org.apache.commons.lang3.builder.ToStringStyle;
13+
14+
@Data
15+
@JsonIgnoreProperties(ignoreUnknown = true)
16+
@JsonPropertyOrder(alphabetic = true)
17+
public class Block_methods {
18+
19+
@JsonProperty("sign")
20+
@SerializedName("sign")
21+
private String sign;
22+
23+
@JsonProperty("extra")
24+
@SerializedName("extra")
25+
private String extra;
26+
27+
28+
@Override
29+
public String toString() {
30+
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
31+
.append("sign", this.sign)
32+
.append("extra", this.extra)
33+
.toString();
34+
}
35+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.okexchain.msg.common;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
6+
import com.google.gson.annotations.SerializedName;
7+
import lombok.Data;
8+
import org.apache.commons.lang3.builder.ToStringBuilder;
9+
import org.apache.commons.lang3.builder.ToStringStyle;
10+
11+
import java.util.List;
12+
@Data
13+
@JsonIgnoreProperties(ignoreUnknown = true)
14+
@JsonPropertyOrder(alphabetic = true)
15+
public class Contract_addresses {
16+
17+
@JsonProperty("address")
18+
@SerializedName("address")
19+
private String address;
20+
21+
22+
@JsonProperty("block_methods")
23+
@SerializedName("block_methods")
24+
private List<Block_methods> block_methods;
25+
26+
27+
@Override
28+
public String toString() {
29+
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
30+
.append("address", this.address)
31+
.append("block_methods", this.block_methods)
32+
.toString();
33+
}
34+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package com.okexchain.msg.gov;
2+
3+
import com.okexchain.msg.MsgBase;
4+
import com.okexchain.msg.common.Contract_addresses;
5+
import com.okexchain.msg.common.Message;
6+
import com.okexchain.msg.common.Token;
7+
import com.okexchain.utils.Utils;
8+
9+
10+
import java.util.ArrayList;
11+
import java.util.List;
12+
13+
14+
public class MsgContractMethodBlockedListProposal extends MsgBase {
15+
16+
public MsgContractMethodBlockedListProposal(){
17+
setMsgType("okexchain/gov/MsgSubmitProposal");
18+
}
19+
20+
21+
public Message produceContractMethodBlockedListProposal(String title,
22+
String description,
23+
List<Contract_addresses> contract_addresses_list,
24+
boolean isAdded,
25+
String denom,
26+
String amountDeposit){
27+
// proposal
28+
MsgContractMethodBlockedListProposalValue proposal = new MsgContractMethodBlockedListProposalValue();
29+
proposal.setTitle(title);
30+
proposal.setDescription(description);
31+
proposal.setContract_addresses(contract_addresses_list);
32+
proposal.setAdded(isAdded);
33+
34+
return produceContractMethodBlockedListProposal(proposal,denom, amountDeposit);
35+
}
36+
37+
38+
public Message produceContractMethodBlockedListProposal(MsgContractMethodBlockedListProposalValue proposal,
39+
String denom,
40+
String amountDeposit){
41+
// content
42+
Content<MsgContractMethodBlockedListProposalValue> content = new Content<>();
43+
content.setType("okexchain/evm/ManageContractMethodBlockedListProposal");
44+
content.setValue(proposal);
45+
46+
// submit
47+
List<Token> depositList = new ArrayList<>();
48+
Token deposit = new Token();
49+
deposit.setDenom(denom);
50+
deposit.setAmount(Utils.NewDecString(amountDeposit));
51+
depositList.add(deposit);
52+
53+
MsgSubmitProposalValue<Content<MsgContractMethodBlockedListProposalValue>> value = new MsgSubmitProposalValue<>();
54+
value.setContent(content);
55+
value.setInitialDeposit(depositList);
56+
value.setProposer(this.address);
57+
58+
Message<MsgSubmitProposalValue<Content<MsgContractMethodBlockedListProposalValue>>> msg = new Message<>();
59+
msg.setType(msgType);
60+
msg.setValue(value);
61+
return msg;
62+
}
63+
}

0 commit comments

Comments
 (0)