4
4
public class EnergyCost {
5
5
6
6
private static EnergyCost instance = null ;
7
- /* backwards compatibility, remove eventually */
8
- private final int STEP = 1 ;
9
- /* backwards compatibility, remove eventually */
10
- private final int SSTORE = 300 ;
11
- private final int ZEROSTEP = 0 ;
12
- private final int QUICKSTEP = 2 ;
13
- private final int FASTESTSTEP = 3 ;
14
- private final int FASTSTEP = 5 ;
15
- private final int MIDSTEP = 8 ;
16
- private final int SLOWSTEP = 10 ;
17
- private final int EXTSTEP = 20 ;
18
- private final int GENESISENERGYLIMIT = 1000000 ;
19
- private final int MINENERGYLIMIT = 125000 ;
20
7
private final int BALANCE = 20 ;
21
8
private final int SHA3 = 30 ;
22
9
private final int SHA3_WORD = 6 ;
@@ -28,33 +15,18 @@ public class EnergyCost {
28
15
private final int RESET_SSTORE = 5000 ;
29
16
private final int REFUND_SSTORE = 15000 ;
30
17
private final int CREATE = 32000 ;
31
- private final int JUMPDEST = 1 ;
32
- private final int CREATE_DATA_BYTE = 5 ;
33
18
private final int CALL = 40 ;
34
19
private final int STIPEND_CALL = 2300 ;
35
- private final int VT_CALL = 9000 ; //value transfer call
36
- private final int NEW_ACCT_CALL = 25000 ; //new account call
20
+ private final int VT_CALL = 9000 ; // value transfer call
21
+ private final int NEW_ACCT_CALL = 25000 ; // new account call
37
22
private final int MEMORY = 3 ;
38
- private final int SUICIDE_REFUND = 24000 ;
39
- private final int QUAD_COEFF_DIV = 512 ;
40
23
private final int CREATE_DATA = 200 ;
41
- private final int TX_NO_ZERO_DATA = 68 ;
42
- private final int TX_ZERO_DATA = 4 ;
43
- private final int TRANSACTION = 21000 ;
44
- private final int TRANSACTION_CREATE_CONTRACT = 53000 ;
45
24
private final int LOG_ENERGY = 375 ;
46
25
private final int LOG_DATA_ENERGY = 8 ;
47
26
private final int LOG_TOPIC_ENERGY = 375 ;
48
27
private final int COPY_ENERGY = 3 ;
49
28
private final int EXP_ENERGY = 10 ;
50
29
private final int EXP_BYTE_ENERGY = 10 ;
51
- private final int IDENTITY = 15 ;
52
- private final int IDENTITY_WORD = 3 ;
53
- private final int RIPEMD160 = 600 ;
54
- private final int RIPEMD160_WORD = 120 ;
55
- private final int SHA256 = 60 ;
56
- private final int SHA256_WORD = 12 ;
57
- private final int EC_RECOVER = 3000 ;
58
30
private final int EXT_CODE_SIZE = 20 ;
59
31
private final int EXT_CODE_COPY = 20 ;
60
32
private final int EXT_CODE_HASH = 400 ;
@@ -73,235 +45,131 @@ public static EnergyCost getInstance() {
73
45
return instance ;
74
46
}
75
47
76
- public int getSTEP () {
77
- return STEP ;
78
- }
79
-
80
- public int getSSTORE () {
81
- return SSTORE ;
82
- }
83
-
84
- public int getZEROSTEP () {
85
- return ZEROSTEP ;
86
- }
87
-
88
- public int getQUICKSTEP () {
89
- return QUICKSTEP ;
90
- }
91
-
92
- public int getFASTESTSTEP () {
93
- return FASTESTSTEP ;
94
- }
95
-
96
- public int getFASTSTEP () {
97
- return FASTSTEP ;
98
- }
99
-
100
- public int getMIDSTEP () {
101
- return MIDSTEP ;
102
- }
103
-
104
- public int getSLOWSTEP () {
105
- return SLOWSTEP ;
106
- }
107
-
108
- public int getEXTSTEP () {
109
- return EXTSTEP ;
110
- }
111
-
112
- public int getGENESISENERGYLIMIT () {
113
- return GENESISENERGYLIMIT ;
114
- }
115
-
116
- public int getMINENERGYLIMIT () {
117
- return MINENERGYLIMIT ;
118
- }
119
-
120
- public int getBALANCE () {
48
+ public int getBalance () {
121
49
return BALANCE ;
122
50
}
123
51
124
- public int getSHA3 () {
52
+ public int getSha3 () {
125
53
return SHA3 ;
126
54
}
127
55
128
- public int getSHA3_WORD () {
56
+ public int getSha3Word () {
129
57
return SHA3_WORD ;
130
58
}
131
59
132
- public int getSLOAD () {
60
+ public int getSLoad () {
133
61
return SLOAD ;
134
62
}
135
63
136
- public int getSTOP () {
64
+ public int getStop () {
137
65
return STOP ;
138
66
}
139
67
140
- public int getSUICIDE () {
68
+ public int getSuicide () {
141
69
return SUICIDE ;
142
70
}
143
71
144
- public int getCLEAR_SSTORE () {
72
+ public int getClearSStore () {
145
73
return CLEAR_SSTORE ;
146
74
}
147
75
148
- public int getSET_SSTORE () {
76
+ public int getSetSStore () {
149
77
return SET_SSTORE ;
150
78
}
151
79
152
- public int getRESET_SSTORE () {
80
+ public int getResetSStore () {
153
81
return RESET_SSTORE ;
154
82
}
155
83
156
- public int getREFUND_SSTORE () {
84
+ public int getRefundSStore () {
157
85
return REFUND_SSTORE ;
158
86
}
159
87
160
- public int getCREATE () {
88
+ public int getCreate () {
161
89
return CREATE ;
162
90
}
163
91
164
- public int getJUMPDEST () {
165
- return JUMPDEST ;
166
- }
167
-
168
- public int getCREATE_DATA_BYTE () {
169
- return CREATE_DATA_BYTE ;
170
- }
171
-
172
- public int getCALL () {
92
+ public int getCall () {
173
93
return CALL ;
174
94
}
175
95
176
- public int getSTIPEND_CALL () {
96
+ public int getStipendCall () {
177
97
return STIPEND_CALL ;
178
98
}
179
99
180
- public int getVT_CALL () {
100
+ public int getVtCall () {
181
101
return VT_CALL ;
182
102
}
183
103
184
- public int getNEW_ACCT_CALL () {
104
+ public int getNewAcctCall () {
185
105
return NEW_ACCT_CALL ;
186
106
}
187
107
188
- public int getNEW_ACCT_SUICIDE () {
108
+ public int getNewAcctSuicide () {
189
109
return NEW_ACCT_SUICIDE ;
190
110
}
191
111
192
- public int getMEMORY () {
112
+ public int getMemory () {
193
113
return MEMORY ;
194
114
}
195
115
196
- public int getSUICIDE_REFUND () {
197
- return SUICIDE_REFUND ;
198
- }
199
-
200
- public int getQUAD_COEFF_DIV () {
201
- return QUAD_COEFF_DIV ;
202
- }
203
-
204
116
public int getCREATE_DATA () {
205
117
return CREATE_DATA ;
206
118
}
207
119
208
- public int getTX_NO_ZERO_DATA () {
209
- return TX_NO_ZERO_DATA ;
210
- }
211
-
212
- public int getTX_ZERO_DATA () {
213
- return TX_ZERO_DATA ;
214
- }
215
-
216
- public int getTRANSACTION () {
217
- return TRANSACTION ;
218
- }
219
-
220
- public int getTRANSACTION_CREATE_CONTRACT () {
221
- return TRANSACTION_CREATE_CONTRACT ;
222
- }
223
-
224
- public int getLOG_ENERGY () {
120
+ public int getLogEnergy () {
225
121
return LOG_ENERGY ;
226
122
}
227
123
228
- public int getLOG_DATA_ENERGY () {
124
+ public int getLogDataEnergy () {
229
125
return LOG_DATA_ENERGY ;
230
126
}
231
127
232
- public int getLOG_TOPIC_ENERGY () {
128
+ public int getLogTopicEnergy () {
233
129
return LOG_TOPIC_ENERGY ;
234
130
}
235
131
236
- public int getCOPY_ENERGY () {
132
+ public int getCopyEnergy () {
237
133
return COPY_ENERGY ;
238
134
}
239
135
240
- public int getEXP_ENERGY () {
136
+ public int getExpEnergy () {
241
137
return EXP_ENERGY ;
242
138
}
243
139
244
- public int getEXP_BYTE_ENERGY () {
140
+ public int getExpByteEnergy () {
245
141
return EXP_BYTE_ENERGY ;
246
142
}
247
143
248
- public int getIDENTITY () {
249
- return IDENTITY ;
250
- }
251
-
252
- public int getIDENTITY_WORD () {
253
- return IDENTITY_WORD ;
254
- }
255
-
256
- public int getRIPEMD160 () {
257
- return RIPEMD160 ;
258
- }
259
-
260
- public int getRIPEMD160_WORD () {
261
- return RIPEMD160_WORD ;
262
- }
263
-
264
- public int getSHA256 () {
265
- return SHA256 ;
266
- }
267
-
268
- public int getSHA256_WORD () {
269
- return SHA256_WORD ;
270
- }
271
-
272
- public int getEC_RECOVER () {
273
- return EC_RECOVER ;
274
- }
275
-
276
- public int getEXT_CODE_SIZE () {
144
+ public int getExtCodeSize () {
277
145
return EXT_CODE_SIZE ;
278
146
}
279
147
280
- public int getEXT_CODE_COPY () {
148
+ public int getExtCodeCopy () {
281
149
return EXT_CODE_COPY ;
282
150
}
283
151
284
- public int getEXT_CODE_HASH () {
152
+ public int getExtCodeHash () {
285
153
return EXT_CODE_HASH ;
286
154
}
287
155
288
- public int getFREEZE () {
156
+ public int getFreeze () {
289
157
return FREEZE ;
290
158
}
291
159
292
- public int getUNFREEZE () {
160
+ public int getUnfreeze () {
293
161
return UNFREEZE ;
294
162
}
295
163
296
- public int getFREEZE_EXPIRE_TIME () {
164
+ public int getFreezeExpireTime () {
297
165
return FREEZE_EXPIRE_TIME ;
298
166
}
299
167
300
- public int getVOTE_WITNESS () {
168
+ public int getVoteWitness () {
301
169
return VOTE_WITNESS ;
302
170
}
303
171
304
- public int getWITHDRAW_REWARD () {
172
+ public int getWithdrawReward () {
305
173
return WITHDRAW_REWARD ;
306
174
}
307
175
}
0 commit comments