-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.fif
executable file
·1153 lines (1153 loc) · 19.4 KB
/
code.fif
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
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// automatically generated from `../../src/crypto/smartcont/stdlib.fc` `../code.fc`
PROGRAM{
DECLPROC send_money
DECLPROC send_message_back
DECLPROC ~load_common_auction_fields
DECLPROC pack_state
DECLPROC unpack_state
DECLPROC check_blind_bids
DECLPROC return_blind_bids
DECLPROC ~complete_auction
DECLPROC recv_internal
DECLPROC recv_external
85143 DECLMETHOD seqno
send_money PROC:<{
0 PUSHINT
DUP
196 PUSHINT
NEWC
9 STU
s1 s5 XCHG
8 STI
s1 s3 XCHG
256 STU
SWAP
STGRAMS
s1 s2 XCHG
107 STU
32 STU
ENDC
3 PUSHINT
SENDRAWMSG
}>
send_message_back PROC:<{
0 PUSHINT
24 PUSHINT
NEWC
6 STU
s0 s8 XCHG2
STSLICER
ROT
STGRAMS
s1 s6 XCHG
107 STU
s1 s4 XCHG
32 STU
s1 s2 XCHG
64 STU
OVER
-1 GTINT
IF:<{
32 STU
}>ELSE<{
NIP
}>
OVER
-1 GTINT
IF:<{
32 STU
}>ELSE<{
NIP
}>
ENDC
SWAP
SENDRAWMSG
}>
~load_common_auction_fields PROC:<{
8 LDU
LDDICT
32 LDU
32 LDU
LDGRAMS
LDGRAMS
LDGRAMS
32 LDU
8 -ROLL
}>
pack_state PROCREF:<{
NEWC
s1 s5 XCHG
32 STU
s1 s3 XCHG
256 STU
SWAP
STSLICER
SWAP
STGRAMS
STDICT
ENDC
}>
unpack_state PROC:<{
c4 PUSH
CTOS
32 LDU
256 LDU
264 PUSHINT
LDSLICEX
LDGRAMS
LDDICT
ENDS
}>
check_blind_bids PROC:<{
0 PUSHINT
s0 s0 s0 PUSH3
TRUE
-1 PUSHINT
UNTIL:<{
s8 PUSH
8 PUSHPOW2
DICTUGETNEXT
NULLSWAPIFNOT
NULLSWAPIFNOT
DUP
IF:<{
s0 s2 XCHG
8 LDI
LDGRAMS
9 PUSHPOW2
LDSLICEX
NIP
DUP
SDEMPTY
IF:<{
3 BLKDROP
s2 POP
FALSE
}>ELSE<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SH
8 PUSHPOW2
DICTUGETNEXT
NULLSWAPIFNOT
NULLSWAPIFNOT
DUP
IF:<{
s0 s2 XCHG
8 LDI
LDGRAMS
DROP
s0 s4 PUSH2
SUB
s1 s6 XCHG
SUB
s5 s4 XCPU
SUB
s2 s(-1) PUXC
send_money CALLDICT
}>ELSE<{
s2 POP
}>
SWAP
NOT
}>
s2 s3 XCHG
3 BLKDROP
}>
~complete_auction PROC:<{
32 PUSHINT
s5 s6 s6 PUXC2
DICTUDELGET
NULLSWAPIFNOT
DROP
NEWC
SWAP
STSLICER
ENDC
670869177 PUSHINT
0 PUSHINT
196 PUSHINT
NEWC
9 STU
s0 s7 XCHG2
STSLICER
30 PUSHPOW2
STGRAMS
s1 s6 XCHG
107 STU
s1 s5 XCHG
32 STU
s1 s5 XCHG
64 STU
s1 s2 XCHG
8 STI
256 STU
s0 s3 XCHG2
STGRAMS
s1 s2 XCHG
STREF
ENDC
3 PUSHINT
SENDRAWMSG
}>
recv_internal PROC:<{
SWAP
CTOS
4 LDU
SWAP
1 PUSHINT
AND
IFJMP:<{
3 BLKDROP
}>
OVER
SEMPTY
IFJMP:<{
3 BLKDROP
}>
LDMSGADDR
DROP
DUP
REWRITESTDADDR
s0 s3 XCHG
32 LDU
OVER
0 EQINT
IFJMP:<{
6 BLKDROP
}>
unpack_state CALLDICT
s0 s5 XCHG
64 LDU
s7 PUSH
100 EQINT
IFJMP:<{
32 LDU
s1 s7 PUSH2
32 PUSHINT
DICTUGET
NULLSWAPIFNOT
IFNOTJMP:<{
s3 s8 XCHG
8 BLKDROP
s2 POP
s3 POP
s3 POP
4294967294 PUSHINT
36 PUSHINT
0 PUSHINT
s3 s5 XCHG
s2 s4 XCHG
64 PUSHINT
send_message_back CALLDICT
}>
~load_common_auction_fields CALLDICT
s5 PUSH
NOW
LESS
IFNOTJMP:<{
s11 s12 XCHG
12 BLKDROP
s0 s4 XCHG
4 BLKDROP
s2 POP
s3 POP
s3 POP
4294967294 PUSHINT
46 PUSHINT
0 PUSHINT
s3 s5 XCHG
s2 s4 XCHG
64 PUSHINT
send_message_back CALLDICT
}>
s4 PUSH
NOW
GREATER
IFNOTJMP:<{
s11 s12 XCHG
12 BLKDROP
s0 s4 XCHG
4 BLKDROP
s2 POP
s3 POP
s3 POP
4294967294 PUSHINT
47 PUSHINT
0 PUSHINT
s3 s5 XCHG
s2 s4 XCHG
64 PUSHINT
send_message_back CALLDICT
}>
21 s() PUSH
s4 PUSH
GEQ
IFNOTJMP:<{
s11 s12 XCHG
12 BLKDROP
s0 s4 XCHG
4 BLKDROP
s2 POP
s3 POP
s3 POP
4294967294 PUSHINT
48 PUSHINT
0 PUSHINT
s3 s5 XCHG
s2 s4 XCHG
64 PUSHINT
send_message_back CALLDICT
}>
FALSE
s8 PUSH
64 LESSINT
IFJMP:<{
s10 POP
OVER
0 GTINT
22 s() PUSH
s3 PUSH
GEQ
AND
IF:<{
s9 POP
TRUE
}>ELSE<{
s0 s9 XCHG
}>
21 s() PUSH
s3 PUSH
GEQ
IFNOTJMP:<{
s11 s12 XCHG
12 BLKDROP
s0 s4 XCHG
4 BLKDROP
s2 POP
s3 POP
s3 POP
4294967294 PUSHINT
49 PUSHINT
0 PUSHINT
s3 s5 XCHG
s2 s4 XCHG
64 PUSHINT
send_message_back CALLDICT
}>
s0 s8 XCHG
LDGRAMS
LDGRAMS
OVER
0 NEQINT
s2 s3 PUSH2
ADD
25 s() PUSH
SWAP
LESS
AND
IFJMP:<{
12 BLKDROP
s1 s6 XCHG
6 BLKDROP
s2 POP
s3 POP
s3 POP
4294967294 PUSHINT
50 PUSHINT
0 PUSHINT
s3 s5 XCHG
s2 s4 XCHG
64 PUSHINT
send_message_back CALLDICT
}>
s13 POP
18 s() POP
19 s() POP
16 s() PUSH
0 EQINT
IFNOT:<{
16 s() PUSH
s3 PUSH
SUB
s1 s12 XCHG
SUB
s0 s10 XCHG
8 LDI
256 LDU
DROP
s0 17 s() XCHG
s3 PUSH
SUB
s1 s2 XCHG
s1 17 s() XCHG
send_money CALLDICT
}>ELSE<{
s1 16 s() XCHG
s0 s11 XCHG
s10 POP
DROP
}>
s5 PUSH
IF:<{
s13 s7 s10 XCPU2
17 s() PUSH
20 s() PUSH
22 s() PUSH
~complete_auction CALLDICT
}>ELSE<{
s0 s13 XCHG
}>
s6 PUSH
0 GTINT
s6 s(-1) PUXC
AND
s6 PUSH
NOT
OR
IF:<{
NEWC
s1 s5 XCHG
8 STU
s1 s3 XCHG
STDICT
32 STU
32 STU
s10 PUSH
STGRAMS
s0 s11 XCHG2
STGRAMS
s0 s5 XCHG2
STGRAMS
s0 s4 XCHG
IF:<{
s7 POP
s8 POP
s9 POP
s9 POP
s0 s3 XCHG
DEC
s0 s8 XCHG2
32 STU
s0 s5 XCHG2
STGRAMS
0 PUSHINT
STGRAMS
}>ELSE<{
s12 s7 PUXC
SUB
s1 s2 XCHG
ADD
s6 s2 XCHG2
32 STU
s0 s8 XCHG2
STGRAMS
s0 s9 XCHG2
STGRAMS
s1 s5 XCHG
8 STI
s1 s6 XCHG
256 STU
4 3 REVERSE
s1 s3 XCHG
}>
2SWAP
32 PUSHINT
DICTUSETB
}>ELSE<{
s11 18 s() XCHG
s8 17 s() XCHG
s12 16 s() XCHG
s10 s15 XCHG
s14 POP
12 BLKDROP
DROP
}>
s2 s4 XCHG
s1 s3 s0 XCHG3
pack_state INLINECALLDICT
c4 POP
}>
s0 s9 XCHG
32 LDU
LDGRAMS
24 s() PUSH
s2 PUSH
GEQ
IFNOTJMP:<{
12 BLKDROP
s2 s7 XCHG
7 BLKDROP
s2 POP
s3 POP
s3 POP
4294967294 PUSHINT
51 PUSHINT
0 PUSHINT
s3 s5 XCHG
s2 s4 XCHG
64 PUSHINT
send_message_back CALLDICT
}>
s4 s1 PUSH2
GREATER
25 s() PUSH
s6 PUSH
GEQ
AND
IF:<{
s11 POP
TRUE
}>ELSE<{
s0 s11 XCHG
}>
s0 s11 XCHG
LDDICT
DROP
23 s() PUSH
OVER
8 PUSHPOW2
DICTUGET
NULLSWAPIFNOT
NIP
s12 PUSH
NOT
SWAP
AND
IFJMP:<{
12 BLKDROP
s2 s7 XCHG
7 BLKDROP
s2 POP
s3 POP
s3 POP
4294967294 PUSHINT
52 PUSHINT
0 PUSHINT
s3 s5 XCHG
s2 s4 XCHG
64 PUSHINT
send_message_back CALLDICT
}>
s14 POP
19 s() POP
20 s() POP
s8 PUSH
IF:<{
s11 s12 s3 PUXCPU
return_blind_bids CALLDICT
s0 16 s() XCHG
s10 s13 PUSH2
20 s() PUSH
23 s() PUSH
25 s() PUSH
~complete_auction CALLDICT
}>ELSE<{
s12 16 s() XCHG
s0 s12 XCHG
}>
s12 PUSH
0 GTINT
s9 s(-1) PUXC
AND
s9 PUSH
NOT
OR
IF:<{
NEWC
s1 s8 XCHG
8 STU
s1 s6 XCHG
STDICT
s1 s4 XCHG
32 STU
s1 s2 XCHG
32 STU
OVER
STGRAMS
ROT
STGRAMS
ROT
STGRAMS
s0 s3 XCHG
IF:<{
DROP
s2 POP
s3 POP
s9 POP
s10 POP
s10 POP
NEWDICT
SWAP
DEC
s0 s10 XCHG2
32 STU
s1 s7 XCHG
32 STU
s0 s4 XCHG2
STGRAMS
s1 s7 XCHG
STDICT
}>ELSE<{
s15 s(-1) PUXC
SUB
s1 s10 XCHG
ADD
s0 s2 XCHG
9 PUSHPOW2
LDSLICEX
DROP
NEWC
s1 s12 XCHG
8 STI
s0 s14 XCHG2
STGRAMS
s0 s10 XCHG2
STSLICER
s11 s2 XCHG2
8 PUSHPOW2
DICTUSETB
s0 s10 XCHG
32 STU
s1 s7 XCHG
32 STU
s0 s4 XCHG2
STGRAMS
s1 s7 XCHG
STDICT
s1 s3 XCHG
}>
s0 s5 s3 XCHG3
32 PUSHINT
DICTUSETB
}>ELSE<{
s15 21 s() XCHG
16 s() 20 s() XCHG
s13 19 s() XCHG
s14 18 s() XCHG
17 s() POP
12 BLKDROP
4 BLKDROP
}>
s1 s3 XCHG
pack_state INLINECALLDICT
c4 POP
}>
s1 s6 XCHG
6 BLKDROP
s2 POP
s3 POP
s3 POP
OVER
31 PUSHPOW2
AND
IFNOTJMP:<{
32 PUSHPOW2DEC
0 PUSHINT
DUP
s3 s5 XCHG
s2 s4 XCHG
64 PUSHINT
send_message_back CALLDICT
}>
3 BLKDROP
}>
recv_external PROC:<{
9 PUSHPOW2
LDSLICEX
DUP
32 LDU
32 LDU
32 LDU
NOW
s1 s3 XCHG
LESS
35 THROWIF
unpack_state CALLDICT
s7 s4 XCPU
EQUAL
33 THROWIFNOT
s0 s3 XCHG
INC
s4 PUSH
101 EQINT
IF:<{
s4 POP
s0 s4 XCHG
256 LDU
s0 s7 XCHG
HASHSU
s0 s8 s8 XCHG3
CHKSIGNU
34 THROWIFNOT
s0 s4 XCHG
32 LDU
DROP
s0 s3 PUSH2
32 PUSHINT
DICTUGET
NULLSWAPIFNOT
36 THROWIFNOT
~load_common_auction_fields CALLDICT
3 BLKDROP
s2 POP
s2 POP
NOW
s1 s2 XCHG
LESS
38 THROWIFNOT
0 PUSHINT
s0 s2 PUSH2
64 LESSINT
IF:<{
s3 POP
ACCEPT
s0 s3 XCHG
LDGRAMS
NIP
LDGRAMS
NIP
LDGRAMS
OVER
0 EQINT
IFNOT:<{
s3 POP
s3 POP
SWAP
8 LDI
256 LDU
DROP
s3 s2 PUXC
SUB
s1 s8 XCHG
SUB
}>ELSE<{
s4 s9 XCHG
s4 s4 s0 XCHG3
2DROP
}>
}>ELSE<{
2DROP
s0 s2 XCHG
32 LDU
NOW
s1 s2 XCHG
GREATER
45 THROWIF
ACCEPT
LDGRAMS
NIP
LDDICT
DROP
s0 s3 XCHG2
s0 s7 XCHG
TRUE
check_blind_bids CALLDICT
NIP
s3 s7 XCHG
s1 s2 XCHG
}>
s4 s6 XCHG
s5 PUSH
s8 s8 s3 XCHG3
~complete_auction CALLDICT
}>ELSE<{
s4 PUSH
102 EQINT
IF:<{
s4 POP
s0 s4 XCHG
256 LDU
s0 s7 XCHG
HASHSU
s0 s8 s8 XC2PU
CHKSIGNU
35 THROWIFNOT
s0 s5 XCHG
LDREF
DROP
CTOS
DUP
HASHSU
SWAP
32 LDU
8 LDI
256 LDU
LDGRAMS
DROP
s3 s8 PUSH2
32 PUSHINT
DICTUGET
NULLSWAPIFNOT
36 THROWIFNOT
~load_common_auction_fields CALLDICT
2DROP
s3 POP
s3 POP
s3 PUSH
63 GTINT
37 THROWIFNOT
NOW
LESS
38 THROWIFNOT
s0 s3 XCHG
32 LDU
LDGRAMS
NIP
LDDICT
DROP
NOW
s1 s2 XCHG
GREATER
39 THROWIFNOT
s5 s0 PUSH2
8 PUSHPOW2
DICTUGET
NULLSWAPIFNOT
40 THROWIFNOT
8 LDI
s1 s8 PUXC
EQUAL
41 THROWIFNOT
s0 s7 XCHG
LDGRAMS
9 PUSHPOW2
LDSLICEX
s11 s11 s(-1) XCPUXC
s0 18 s() XCHG
CHKSIGNU
42 THROWIFNOT
s0 s15 XCHG
SDEMPTY
53 THROWIFNOT
s4 s3 PUXC
GEQ
s4 s14 PUSH2
LEQ
AND
54 THROWIFNOT
s9 s12 s10 PUSH3
s11 s14 PUSH2
pack_state INLINECALLDICT
c4 POP
COMMIT
ACCEPT
NEWC
s1 s6 XCHG
8 STI
s0 s13 XCHG2
STGRAMS
s0 s6 XCHG2
STSLICER
SWAP
STGRAMS
s0 s1 s4 XCHG3
8 PUSHPOW2
DICTUSETB
s8 s8 s0 XCHG3
s3 PUSH
FALSE
check_blind_bids CALLDICT
DROP
IF:<{
s4 s6 XCHG
s3 s8 XCHG
s5 PUSH
3 -ROLL
~complete_auction CALLDICT
}>ELSE<{
s3 s8 XCHG
s4 s6 XCHG
4 BLKDROP
}>
}>ELSE<{
s0 s7 XCHG