|
1 | 1 | //
|
2 | 2 | // ABIDecoderTests.swift
|
3 |
| -// |
| 3 | +// |
4 | 4 | //
|
5 | 5 | // Created by liugang zhang on 2023/3/16.
|
6 | 6 | //
|
@@ -50,321 +50,5 @@ final class ABIDecoderTests: XCTestCase {
|
50 | 50 | XCTAssert(resultArray.count == 2)
|
51 | 51 | }
|
52 | 52 |
|
53 |
| - public static let multiCall2 = """ |
54 |
| - [ |
55 |
| - { |
56 |
| - "inputs": [ |
57 |
| - { |
58 |
| - "components": [ |
59 |
| - { |
60 |
| - "internalType": "address", |
61 |
| - "name": "target", |
62 |
| - "type": "address" |
63 |
| - }, |
64 |
| - { |
65 |
| - "internalType": "bytes", |
66 |
| - "name": "callData", |
67 |
| - "type": "bytes" |
68 |
| - } |
69 |
| - ], |
70 |
| - "internalType": "struct Multicall2.Call[]", |
71 |
| - "name": "calls", |
72 |
| - "type": "tuple[]" |
73 |
| - } |
74 |
| - ], |
75 |
| - "name": "aggregate", |
76 |
| - "outputs": [ |
77 |
| - { |
78 |
| - "internalType": "uint256", |
79 |
| - "name": "blockNumber", |
80 |
| - "type": "uint256" |
81 |
| - }, |
82 |
| - { |
83 |
| - "internalType": "bytes[]", |
84 |
| - "name": "returnData", |
85 |
| - "type": "bytes[]" |
86 |
| - } |
87 |
| - ], |
88 |
| - "payable": false, |
89 |
| - "stateMutability": "view", |
90 |
| - "type": "function" |
91 |
| - }, |
92 |
| - { |
93 |
| - "inputs": [ |
94 |
| - { |
95 |
| - "components": [ |
96 |
| - { |
97 |
| - "internalType": "address", |
98 |
| - "name": "target", |
99 |
| - "type": "address" |
100 |
| - }, |
101 |
| - { |
102 |
| - "internalType": "bytes", |
103 |
| - "name": "callData", |
104 |
| - "type": "bytes" |
105 |
| - } |
106 |
| - ], |
107 |
| - "internalType": "struct Multicall2.Call[]", |
108 |
| - "name": "calls", |
109 |
| - "type": "tuple[]" |
110 |
| - } |
111 |
| - ], |
112 |
| - "name": "blockAndAggregate", |
113 |
| - "outputs": [ |
114 |
| - { |
115 |
| - "internalType": "uint256", |
116 |
| - "name": "blockNumber", |
117 |
| - "type": "uint256" |
118 |
| - }, |
119 |
| - { |
120 |
| - "internalType": "bytes32", |
121 |
| - "name": "blockHash", |
122 |
| - "type": "bytes32" |
123 |
| - }, |
124 |
| - { |
125 |
| - "components": [ |
126 |
| - { |
127 |
| - "internalType": "bool", |
128 |
| - "name": "success", |
129 |
| - "type": "bool" |
130 |
| - }, |
131 |
| - { |
132 |
| - "internalType": "bytes", |
133 |
| - "name": "returnData", |
134 |
| - "type": "bytes" |
135 |
| - } |
136 |
| - ], |
137 |
| - "internalType": "struct Multicall2.Result[]", |
138 |
| - "name": "returnData", |
139 |
| - "type": "tuple[]" |
140 |
| - } |
141 |
| - ], |
142 |
| - "stateMutability": "nonpayable", |
143 |
| - "type": "function" |
144 |
| - }, |
145 |
| - { |
146 |
| - "inputs": [ |
147 |
| - { |
148 |
| - "internalType": "uint256", |
149 |
| - "name": "blockNumber", |
150 |
| - "type": "uint256" |
151 |
| - } |
152 |
| - ], |
153 |
| - "name": "getBlockHash", |
154 |
| - "outputs": [ |
155 |
| - { |
156 |
| - "internalType": "bytes32", |
157 |
| - "name": "blockHash", |
158 |
| - "type": "bytes32" |
159 |
| - } |
160 |
| - ], |
161 |
| - "stateMutability": "view", |
162 |
| - "type": "function" |
163 |
| - }, |
164 |
| - { |
165 |
| - "inputs": [], |
166 |
| - "name": "getBlockNumber", |
167 |
| - "outputs": [ |
168 |
| - { |
169 |
| - "internalType": "uint256", |
170 |
| - "name": "blockNumber", |
171 |
| - "type": "uint256" |
172 |
| - } |
173 |
| - ], |
174 |
| - "stateMutability": "view", |
175 |
| - "type": "function" |
176 |
| - }, |
177 |
| - { |
178 |
| - "inputs": [], |
179 |
| - "name": "getCurrentBlockCoinbase", |
180 |
| - "outputs": [ |
181 |
| - { |
182 |
| - "internalType": "address", |
183 |
| - "name": "coinbase", |
184 |
| - "type": "address" |
185 |
| - } |
186 |
| - ], |
187 |
| - "stateMutability": "view", |
188 |
| - "type": "function" |
189 |
| - }, |
190 |
| - { |
191 |
| - "inputs": [], |
192 |
| - "name": "getCurrentBlockDifficulty", |
193 |
| - "outputs": [ |
194 |
| - { |
195 |
| - "internalType": "uint256", |
196 |
| - "name": "difficulty", |
197 |
| - "type": "uint256" |
198 |
| - } |
199 |
| - ], |
200 |
| - "stateMutability": "view", |
201 |
| - "type": "function" |
202 |
| - }, |
203 |
| - { |
204 |
| - "inputs": [], |
205 |
| - "name": "getCurrentBlockGasLimit", |
206 |
| - "outputs": [ |
207 |
| - { |
208 |
| - "internalType": "uint256", |
209 |
| - "name": "gaslimit", |
210 |
| - "type": "uint256" |
211 |
| - } |
212 |
| - ], |
213 |
| - "stateMutability": "view", |
214 |
| - "type": "function" |
215 |
| - }, |
216 |
| - { |
217 |
| - "inputs": [], |
218 |
| - "name": "getCurrentBlockTimestamp", |
219 |
| - "outputs": [ |
220 |
| - { |
221 |
| - "internalType": "uint256", |
222 |
| - "name": "timestamp", |
223 |
| - "type": "uint256" |
224 |
| - } |
225 |
| - ], |
226 |
| - "stateMutability": "view", |
227 |
| - "type": "function" |
228 |
| - }, |
229 |
| - { |
230 |
| - "inputs": [ |
231 |
| - { |
232 |
| - "internalType": "address", |
233 |
| - "name": "addr", |
234 |
| - "type": "address" |
235 |
| - } |
236 |
| - ], |
237 |
| - "name": "getEthBalance", |
238 |
| - "outputs": [ |
239 |
| - { |
240 |
| - "internalType": "uint256", |
241 |
| - "name": "balance", |
242 |
| - "type": "uint256" |
243 |
| - } |
244 |
| - ], |
245 |
| - "stateMutability": "view", |
246 |
| - "type": "function" |
247 |
| - }, |
248 |
| - { |
249 |
| - "inputs": [], |
250 |
| - "name": "getLastBlockHash", |
251 |
| - "outputs": [ |
252 |
| - { |
253 |
| - "internalType": "bytes32", |
254 |
| - "name": "blockHash", |
255 |
| - "type": "bytes32" |
256 |
| - } |
257 |
| - ], |
258 |
| - "stateMutability": "view", |
259 |
| - "type": "function" |
260 |
| - }, |
261 |
| - { |
262 |
| - "inputs": [ |
263 |
| - { |
264 |
| - "internalType": "bool", |
265 |
| - "name": "requireSuccess", |
266 |
| - "type": "bool" |
267 |
| - }, |
268 |
| - { |
269 |
| - "components": [ |
270 |
| - { |
271 |
| - "internalType": "address", |
272 |
| - "name": "target", |
273 |
| - "type": "address" |
274 |
| - }, |
275 |
| - { |
276 |
| - "internalType": "bytes", |
277 |
| - "name": "callData", |
278 |
| - "type": "bytes" |
279 |
| - } |
280 |
| - ], |
281 |
| - "internalType": "struct Multicall2.Call[]", |
282 |
| - "name": "calls", |
283 |
| - "type": "tuple[]" |
284 |
| - } |
285 |
| - ], |
286 |
| - "name": "tryAggregate", |
287 |
| - "outputs": [ |
288 |
| - { |
289 |
| - "components": [ |
290 |
| - { |
291 |
| - "internalType": "bool", |
292 |
| - "name": "success", |
293 |
| - "type": "bool" |
294 |
| - }, |
295 |
| - { |
296 |
| - "internalType": "bytes", |
297 |
| - "name": "returnData", |
298 |
| - "type": "bytes" |
299 |
| - } |
300 |
| - ], |
301 |
| - "internalType": "struct Multicall2.Result[]", |
302 |
| - "name": "returnData", |
303 |
| - "type": "tuple[]" |
304 |
| - } |
305 |
| - ], |
306 |
| - "payable": false, |
307 |
| - "stateMutability": "view", |
308 |
| - "type": "function" |
309 |
| - }, |
310 |
| - { |
311 |
| - "inputs": [ |
312 |
| - { |
313 |
| - "internalType": "bool", |
314 |
| - "name": "requireSuccess", |
315 |
| - "type": "bool" |
316 |
| - }, |
317 |
| - { |
318 |
| - "components": [ |
319 |
| - { |
320 |
| - "internalType": "address", |
321 |
| - "name": "target", |
322 |
| - "type": "address" |
323 |
| - }, |
324 |
| - { |
325 |
| - "internalType": "bytes", |
326 |
| - "name": "callData", |
327 |
| - "type": "bytes" |
328 |
| - } |
329 |
| - ], |
330 |
| - "internalType": "struct Multicall2.Call[]", |
331 |
| - "name": "calls", |
332 |
| - "type": "tuple[]" |
333 |
| - } |
334 |
| - ], |
335 |
| - "name": "tryBlockAndAggregate", |
336 |
| - "outputs": [ |
337 |
| - { |
338 |
| - "internalType": "uint256", |
339 |
| - "name": "blockNumber", |
340 |
| - "type": "uint256" |
341 |
| - }, |
342 |
| - { |
343 |
| - "internalType": "bytes32", |
344 |
| - "name": "blockHash", |
345 |
| - "type": "bytes32" |
346 |
| - }, |
347 |
| - { |
348 |
| - "components": [ |
349 |
| - { |
350 |
| - "internalType": "bool", |
351 |
| - "name": "success", |
352 |
| - "type": "bool" |
353 |
| - }, |
354 |
| - { |
355 |
| - "internalType": "bytes", |
356 |
| - "name": "returnData", |
357 |
| - "type": "bytes" |
358 |
| - } |
359 |
| - ], |
360 |
| - "internalType": "struct Multicall2.Result[]", |
361 |
| - "name": "returnData", |
362 |
| - "type": "tuple[]" |
363 |
| - } |
364 |
| - ], |
365 |
| - "stateMutability": "nonpayable", |
366 |
| - "type": "function" |
367 |
| - } |
368 |
| - ] |
369 |
| - """ |
| 53 | + public static let multiCall2 = "[{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"internalType\":\"struct Multicall2.Call[]\",\"name\":\"calls\",\"type\":\"tuple[]\"}],\"name\":\"aggregate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"returnData\",\"type\":\"bytes[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"internalType\":\"struct Multicall2.Call[]\",\"name\":\"calls\",\"type\":\"tuple[]\"}],\"name\":\"blockAndAggregate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Multicall2.Result[]\",\"name\":\"returnData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"getBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentBlockCoinbase\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"coinbase\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentBlockDifficulty\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"difficulty\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentBlockGasLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"gaslimit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentBlockTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"getEthBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"requireSuccess\",\"type\":\"bool\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"internalType\":\"struct Multicall2.Call[]\",\"name\":\"calls\",\"type\":\"tuple[]\"}],\"name\":\"tryAggregate\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Multicall2.Result[]\",\"name\":\"returnData\",\"type\":\"tuple[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"requireSuccess\",\"type\":\"bool\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"internalType\":\"struct Multicall2.Call[]\",\"name\":\"calls\",\"type\":\"tuple[]\"}],\"name\":\"tryBlockAndAggregate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Multicall2.Result[]\",\"name\":\"returnData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" |
370 | 54 | }
|
0 commit comments