-
Notifications
You must be signed in to change notification settings - Fork 66
/
contract_function_selector.go
815 lines (715 loc) · 21.4 KB
/
contract_function_selector.go
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
package hiero
// SPDX-License-Identifier: Apache-2.0
import (
"golang.org/x/crypto/sha3"
)
// A selector for a function with a given name.
type ContractFunctionSelector struct {
function *string
params string
paramTypes []_Solidity
}
type _Solidity struct {
ty argument
array bool
}
type argument string
const (
aBool argument = "bool"
aString argument = "string"
aInt8 argument = "int8"
aInt16 argument = "int16"
aInt24 argument = "int24"
aInt32 argument = "int32"
aInt40 argument = "int40"
aInt48 argument = "int48"
aInt56 argument = "int56"
aInt64 argument = "int64"
aInt72 argument = "int72"
aInt80 argument = "int80"
aInt88 argument = "int88"
aInt96 argument = "int96"
aInt104 argument = "int104"
aInt112 argument = "int112"
aInt120 argument = "int120"
aInt128 argument = "int128"
aInt136 argument = "int136"
aInt144 argument = "int144"
aInt152 argument = "int152"
aInt160 argument = "int160"
aInt168 argument = "int168"
aInt176 argument = "int176"
aInt184 argument = "int184"
aInt192 argument = "int192"
aInt200 argument = "int200"
aInt208 argument = "int208"
aInt216 argument = "int216"
aInt224 argument = "int224"
aInt232 argument = "int232"
aInt240 argument = "int240"
aInt248 argument = "int248"
aInt256 argument = "int256"
aUint8 argument = "uint8"
aUint16 argument = "uint16"
aUint24 argument = "uint24"
aUint32 argument = "uint32"
aUint40 argument = "uint40"
aUint48 argument = "uint48"
aUint56 argument = "uint56"
aUint64 argument = "uint64"
aUint72 argument = "uint72"
aUint80 argument = "uint80"
aUint88 argument = "uint88"
aUint96 argument = "uint96"
aUint104 argument = "uint104"
aUint112 argument = "uint112"
aUint120 argument = "uint120"
aUint128 argument = "uint128"
aUint136 argument = "uint136"
aUint144 argument = "uint144"
aUint152 argument = "uint152"
aUint160 argument = "uint160"
aUint168 argument = "uint168"
aUint176 argument = "uint176"
aUint184 argument = "uint184"
aUint192 argument = "uint192"
aUint200 argument = "uint200"
aUint208 argument = "uint208"
aUint216 argument = "uint216"
aUint224 argument = "uint224"
aUint232 argument = "uint232"
aUint240 argument = "uint240"
aUint248 argument = "uint248"
aUint256 argument = "uint256"
aBytes argument = "bytes"
aBytes32 argument = "bytes32"
aFunction argument = "function"
aAddress argument = "address"
)
// NewContractFunctionSelector starts building a selector for a function with a given name.
func NewContractFunctionSelector(name string) ContractFunctionSelector {
var function *string
if name == "" {
function = nil
} else {
function = &name
}
return ContractFunctionSelector{
function: function,
params: "",
paramTypes: []_Solidity{},
}
}
// AddParam adds a parameter to the selector.
func (selector *ContractFunctionSelector) _AddParam(ty _Solidity) *ContractFunctionSelector {
if len(selector.paramTypes) > 0 {
selector.params += ","
}
selector.params += string(ty.ty)
if ty.array {
selector.params += "[]"
}
selector.paramTypes = append(selector.paramTypes, ty)
return selector
}
// AddFunction adds a function parameter to the selector.
func (selector *ContractFunctionSelector) AddFunction() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aFunction,
array: false,
})
}
// AddAddress adds an address parameter to the selector.
func (selector *ContractFunctionSelector) AddAddress() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aAddress,
array: false,
})
}
// AddBool adds a bool parameter to the selector.
func (selector *ContractFunctionSelector) AddBool() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aBool,
array: false,
})
}
// AddString adds a string parameter to the selector.
func (selector *ContractFunctionSelector) AddString() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aString,
array: false,
})
}
// AddInt8 adds an int8 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt8() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt8,
array: false,
})
}
// AddInt16 adds an int16 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt16() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt16,
array: false,
})
}
// AddInt24 adds an int24 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt24() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt24,
array: false,
})
}
// AddInt32 adds an int32 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt32() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt32,
array: false,
})
}
// AddInt40 adds an int40 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt40() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt40,
array: false,
})
}
// AddInt48 adds an int48 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt48() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt48,
array: false,
})
}
// AddInt56 adds an int56 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt56() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt56,
array: false,
})
}
// AddInt64 adds an int64 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt64() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt64,
array: false,
})
}
// AddInt72 adds an int72 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt72() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt72,
array: false,
})
}
// AddInt80 adds an int80 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt80() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt80,
array: false,
})
}
// AddInt88 adds an int88 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt88() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt88,
array: false,
})
}
// AddInt96 adds an int96 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt96() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt96,
array: false,
})
}
// AddInt104 adds an int104 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt104() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt104,
array: false,
})
}
// AddInt112 adds an int112 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt112() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt112,
array: false,
})
}
// AddInt120 adds an int120 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt120() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt120,
array: false,
})
}
// AddInt128 adds an int128 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt128() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt128,
array: false,
})
}
// AddInt136 adds an int136 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt136() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt136,
array: false,
})
}
// AddInt144 adds an int144 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt144() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt144,
array: false,
})
}
// AddInt152 adds an int152 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt152() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt152,
array: false,
})
}
// AddInt160 adds an int160 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt160() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt160,
array: false,
})
}
// AddInt168 adds an int168 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt168() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt168,
array: false,
})
}
// AddInt176 adds an int176 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt176() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt176,
array: false,
})
}
// AddInt184 adds an int184 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt184() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt184,
array: false,
})
}
// AddInt192 adds an int192 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt192() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt192,
array: false,
})
}
// AddInt200 adds an int200 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt200() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt200,
array: false,
})
}
// AddInt208 adds an int208 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt208() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt208,
array: false,
})
}
// AddInt216 adds an int216 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt216() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt216,
array: false,
})
}
// AddInt224 adds an int224 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt224() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt224,
array: false,
})
}
// AddInt232 adds an int232 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt232() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt232,
array: false,
})
}
// AddInt240 adds an int240 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt240() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt240,
array: false,
})
}
// AddInt248 adds an int248 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt248() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt248,
array: false,
})
}
// AddInt256 adds an int256 parameter to the selector.
func (selector *ContractFunctionSelector) AddInt256() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt256,
array: false,
})
}
// AddUint8 adds a uint8 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint8() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint8,
array: false,
})
}
// AddUint16 adds a uint16 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint16() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint16,
array: false,
})
}
// AddUint24 adds a uint24 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint24() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint24,
array: false,
})
}
// AddUint32 adds a uint32 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint32() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint32,
array: false,
})
}
// AddUint40 adds a uint40 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint40() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint40,
array: false,
})
}
// AddUint48 adds a uint48 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint48() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint48,
array: false,
})
}
// AddUint56 adds a uint56 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint56() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint56,
array: false,
})
}
// AddUint64 adds a uint64 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint64() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint64,
array: false,
})
}
// AddUint72 adds a uint72 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint72() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint72,
array: false,
})
}
// AddUint80 adds a uint80 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint80() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint80,
array: false,
})
}
// AddUint88 adds a uint88 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint88() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint88,
array: false,
})
}
// AddUint96 adds a uint96 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint96() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint96,
array: false,
})
}
// AddUint104 adds a uint104 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint104() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint104,
array: false,
})
}
// AddUint112 adds a uint112 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint112() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint112,
array: false,
})
}
// AddUint120 adds a uint120 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint120() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint120,
array: false,
})
}
// AddUint128 adds a uint128 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint128() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint128,
array: false,
})
}
// AddUint136 adds a uint136 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint136() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint136,
array: false,
})
}
// AddUint144 adds a uint144 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint144() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint144,
array: false,
})
}
// AddUint152 adds a uint152 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint152() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint152,
array: false,
})
}
// AddUint160 adds a uint160 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint160() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint160,
array: false,
})
}
// AddUint168 adds a uint168 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint168() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint168,
array: false,
})
}
// AddUint176 adds a uint176 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint176() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint176,
array: false,
})
}
// AddUint184 adds a uint184 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint184() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint184,
array: false,
})
}
// AddUint192 adds a uint192 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint192() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint192,
array: false,
})
}
// AddUint200 adds a uint200 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint200() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint200,
array: false,
})
}
// AddUint208 adds a uint208 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint208() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint208,
array: false,
})
}
// AddUint216 adds a uint216 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint216() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint216,
array: false,
})
}
// AddUint224 adds a uint224 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint224() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint224,
array: false,
})
}
// AddUint232 adds a uint232 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint232() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint232,
array: false,
})
}
// AddUint240 adds a uint240 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint240() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint240,
array: false,
})
}
// AddUint248 adds a uint248 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint248() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint248,
array: false,
})
}
// AddUint256 adds a uint256 parameter to the selector.
func (selector *ContractFunctionSelector) AddUint256() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint256,
array: false,
})
}
// AddBytes adds a bytes parameter to the selector.
func (selector *ContractFunctionSelector) AddBytes() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aBytes,
array: false,
})
}
// AddBytes32 adds a bytes32 parameter to the selector.
func (selector *ContractFunctionSelector) AddBytes32() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aBytes32,
array: false,
})
}
// AddAddressArray adds an address[] parameter to the selector.
func (selector *ContractFunctionSelector) AddAddressArray() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aAddress,
array: true,
})
}
// AddBoolArray adds a bool[] parameter to the selector.
func (selector *ContractFunctionSelector) AddBoolArray() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aBool,
array: true,
})
}
// AddStringArray adds a string[] parameter to the selector.
func (selector *ContractFunctionSelector) AddStringArray() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aString,
array: true,
})
}
// AddInt8Array adds an int8[] parameter to the selector.
func (selector *ContractFunctionSelector) AddInt8Array() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt8,
array: true,
})
}
// AddInt32Array adds an int32[] parameter to the selector.
func (selector *ContractFunctionSelector) AddInt32Array() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt32,
array: true,
})
}
// AddInt64Array adds an int64[] parameter to the selector.
func (selector *ContractFunctionSelector) AddInt64Array() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt64,
array: true,
})
}
// AddInt256Array adds an int256[] parameter to the selector.
func (selector *ContractFunctionSelector) AddInt256Array() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aInt256,
array: true,
})
}
// AddUint8Array adds a uint8[] parameter to the selector.
func (selector *ContractFunctionSelector) AddUint8Array() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint8,
array: true,
})
}
// AddUint32Array adds a uint32[] parameter to the selector.
func (selector *ContractFunctionSelector) AddUint32Array() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint32,
array: true,
})
}
// AddUint64Array adds a uint64[] parameter to the selector.
func (selector *ContractFunctionSelector) AddUint64Array() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint64,
array: true,
})
}
// AddUint256Array adds a uint256[] parameter to the selector.
func (selector *ContractFunctionSelector) AddUint256Array() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aUint256,
array: true,
})
}
// AddBytesArray adds a bytes[] parameter to the selector.
func (selector *ContractFunctionSelector) AddBytesArray() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aBytes,
array: true,
})
}
// AddBytes32Array adds a bytes32[] parameter to the selector.
func (selector *ContractFunctionSelector) AddBytes32Array() *ContractFunctionSelector {
return selector._AddParam(_Solidity{
ty: aBytes32,
array: true,
})
}
// String returns the string representation of the selector.
func (selector *ContractFunctionSelector) String() string {
function := ""
if selector.function != nil {
function = *selector.function
}
return function + "(" + selector.params + ")"
}
func (selector *ContractFunctionSelector) _Build(function *string) []byte {
if function != nil {
selector.function = function
} else if selector.function == nil {
panic("unreachable: function name must be non-nil at this point")
}
hash := sha3.NewLegacyKeccak256()
if _, err := hash.Write([]byte(selector.String())); err != nil {
panic(err)
}
return hash.Sum(nil)[0:4]
}