-
Notifications
You must be signed in to change notification settings - Fork 1
/
Mayura_Token_approval.Teal
1032 lines (1010 loc) · 11.8 KB
/
Mayura_Token_approval.Teal
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
#pragma version 7
intcblock 0 1 32 4 10000
bytecblock 0x61646d696e 0x726f79616c74795f7265636569766572 0x726f79616c74795f6261736973 0x151f7c75 0x
txn NumAppArgs
intc_0 // 0
==
bnz main_l22
txna ApplicationArgs 0
pushbytes 0x50cc740f
==
bnz main_l21
txna ApplicationArgs 0
pushbytes 0xb796c351
==
bnz main_l20
txna ApplicationArgs 0
pushbytes 0xa23007ae
==
bnz main_l19
txna ApplicationArgs 0
pushbytes 0xf4525807
==
bnz main_l18
txna ApplicationArgs 0
pushbytes 0x3da0bac6
==
bnz main_l17
txna ApplicationArgs 0
pushbytes 0x1b1a965b
==
bnz main_l16
txna ApplicationArgs 0
pushbytes 0xd4475032
==
bnz main_l15
txna ApplicationArgs 0
pushbytes 0xe90b9804
==
bnz main_l14
txna ApplicationArgs 0
pushbytes 0xfdd61d6a
==
bnz main_l13
txna ApplicationArgs 0
pushbytes 0xb7b87766
==
bnz main_l12
err
main_l12:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
txna ApplicationArgs 1
intc_0 // 0
getbyte
store 32
txna ApplicationArgs 2
btoi
store 33
txna ApplicationArgs 3
intc_0 // 0
getbyte
store 34
txna ApplicationArgs 4
intc_0 // 0
getbyte
store 35
txna ApplicationArgs 5
intc_0 // 0
getbyte
store 36
txna ApplicationArgs 6
intc_0 // 0
getbyte
store 38
txna ApplicationArgs 7
btoi
store 39
txn GroupIndex
intc_1 // 1
-
store 37
load 37
gtxns TypeEnum
intc_3 // axfer
==
assert
load 32
load 33
load 34
load 35
load 36
load 37
load 38
load 39
callsub transferassetpayment_21
intc_1 // 1
return
main_l13:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
txna ApplicationArgs 1
intc_0 // 0
getbyte
store 25
txna ApplicationArgs 2
btoi
store 26
txna ApplicationArgs 3
intc_0 // 0
getbyte
store 27
txna ApplicationArgs 4
intc_0 // 0
getbyte
store 28
txna ApplicationArgs 5
intc_0 // 0
getbyte
store 29
txna ApplicationArgs 6
btoi
store 31
txn GroupIndex
intc_1 // 1
-
store 30
load 30
gtxns TypeEnum
intc_1 // pay
==
assert
load 25
load 26
load 27
load 28
load 29
load 30
load 31
callsub transferalgopayment_20
intc_1 // 1
return
main_l14:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
txna ApplicationArgs 1
callsub setpolicy_19
intc_1 // 1
return
main_l15:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
txna ApplicationArgs 1
intc_0 // 0
getbyte
store 23
txna ApplicationArgs 2
intc_0 // 0
pushint 8 // 8
*
getbit
store 24
load 23
load 24
callsub setpaymentasset_18
intc_1 // 1
return
main_l16:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
txna ApplicationArgs 1
callsub setadministrator_17
intc_1 // 1
return
main_l17:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
txna ApplicationArgs 1
intc_0 // 0
getbyte
store 18
txna ApplicationArgs 2
btoi
store 19
txna ApplicationArgs 3
intc_0 // 0
getbyte
store 20
txna ApplicationArgs 4
intc_0 // 0
getbyte
store 21
txna ApplicationArgs 5
btoi
store 22
load 18
load 19
load 20
load 21
load 22
callsub token_free_move_16
intc_1 // 1
return
main_l18:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
txna ApplicationArgs 1
intc_0 // 0
getbyte
store 15
txna ApplicationArgs 2
store 16
txna ApplicationArgs 3
store 17
load 15
load 16
load 17
callsub offer_15
intc_1 // 1
return
main_l19:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
callsub getpolicy_14
store 8
bytec_3 // 0x151f7c75
load 8
concat
log
intc_1 // 1
return
main_l20:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
txna ApplicationArgs 1
btoi
store 1
txna ApplicationArgs 2
intc_0 // 0
getbyte
store 2
load 1
load 2
callsub getoffer_13
store 3
bytec_3 // 0x151f7c75
load 3
concat
log
intc_1 // 1
return
main_l21:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
callsub getadministrator_12
store 0
bytec_3 // 0x151f7c75
load 0
concat
log
intc_1 // 1
return
main_l22:
txn OnCompletion
intc_0 // NoOp
==
bnz main_l30
txn OnCompletion
intc_1 // OptIn
==
bnz main_l29
txn OnCompletion
intc_3 // UpdateApplication
==
bnz main_l28
txn OnCompletion
pushint 5 // DeleteApplication
==
bnz main_l27
err
main_l27:
txn ApplicationID
intc_0 // 0
!=
assert
callsub delete_3
intc_1 // 1
return
main_l28:
txn ApplicationID
intc_0 // 0
!=
assert
callsub update_2
intc_1 // 1
return
main_l29:
txn ApplicationID
intc_0 // 0
!=
assert
callsub optin_4
intc_1 // 1
return
main_l30:
txn ApplicationID
intc_0 // 0
==
assert
callsub create_1
intc_1 // 1
return
// <lambda>
lambda_0:
itob
retsub
// create
create_1:
bytec_0 // "admin"
global CreatorAddress
app_global_put
bytec_2 // "token_basis"
intc_0 // 0
app_global_put
bytec_1 // "perks_receiver"
bytec 4 // ""
app_global_put
retsub
// update
update_2:
txn Sender
bytec_0 // "admin"
app_global_get
==
assert
retsub
// delete
delete_3:
txn Sender
bytec_0 // "admin"
app_global_get
==
assert
retsub
// opt_in
optin_4:
retsub
// auth_only
authonly_5:
bytec_0 // "admin"
app_global_get
==
retsub
// auth_only
authonly_6:
bytec_0 // "admin"
app_global_get
==
retsub
// auth_only
authonly_7:
bytec_0 // "admin"
app_global_get
==
retsub
// do_move_asset
domoveasset_8:
store 71
store 70
store 69
store 68
itxn_begin
intc_3 // axfer
itxn_field TypeEnum
load 68
itxn_field XferAsset
load 71
itxn_field AssetAmount
load 69
itxn_field AssetSender
load 70
itxn_field AssetReceiver
intc_0 // 0
itxn_field Fee
itxn_submit
retsub
// do_pay_algos
dopayalgos_9:
store 95
store 94
store 93
store 92
load 92
load 95
mulw
intc_0 // 0
intc 4 // 10000
divmodw
pop
pop
swap
!
assert
store 96
itxn_begin
intc_1 // pay
itxn_field TypeEnum
load 92
load 96
-
itxn_field Amount
load 93
itxn_field Receiver
intc_0 // 0
itxn_field Fee
load 96
intc_0 // 0
>
bz dopayalgos_9_l2
itxn_next
intc_1 // pay
itxn_field TypeEnum
load 96
itxn_field Amount
load 94
itxn_field Receiver
intc_0 // 0
itxn_field Fee
dopayalgos_9_l2:
itxn_submit
retsub
// do_pay_assets
dopayassets_10:
store 110
store 109
store 108
load 109
bytec_2 // "token_basis"
app_global_get
mulw
intc_0 // 0
intc 4 // 10000
divmodw
pop
pop
swap
!
assert
store 111
itxn_begin
intc_3 // axfer
itxn_field TypeEnum
load 108
itxn_field XferAsset
load 109
load 111
-
itxn_field AssetAmount
load 110
itxn_field AssetReceiver
intc_0 // 0
itxn_field Fee
load 111
intc_0 // 0
>
bz dopayassets_10_l2
itxn_next
intc_3 // axfer
itxn_field TypeEnum
load 108
itxn_field XferAsset
load 111
itxn_field AssetAmount
bytec_1 // "perks_receiver"
app_global_get
itxn_field AssetReceiver
intc_0 // 0
itxn_field Fee
dopayassets_10_l2:
itxn_submit
retsub
// do_update_offered
doupdateoffered_11:
store 56
store 55
store 54
store 53
store 52
store 51
load 51
intc_0 // 0
load 52
callsub lambda_0
app_local_get_ex
store 58
store 57
load 58
bnz doupdateoffered_11_l5
load 56
intc_0 // 0
==
assert
load 55
global ZeroAddress
==
assert
doupdateoffered_11_l2:
load 54
intc_0 // 0
>
bnz doupdateoffered_11_l4
load 51
load 52
callsub lambda_0
app_local_del
b doupdateoffered_11_l6
doupdateoffered_11_l4:
load 51
load 52
callsub lambda_0
load 53
load 54
itob
concat
app_local_put
b doupdateoffered_11_l6
doupdateoffered_11_l5:
load 57
store 59
load 59
intc_2 // 32
extract_uint64
load 56
==
assert
load 59
extract 0 32
load 55
==
assert
b doupdateoffered_11_l2
doupdateoffered_11_l6:
retsub
// get_administrator
getadministrator_12:
bytec_0 // "admin"
app_global_get
retsub
// get_offer
getoffer_13:
store 5
store 4
load 5
txnas Accounts
intc_0 // 0
load 4
callsub lambda_0
app_local_get_ex
store 7
store 6
load 7
assert
load 6
retsub
// get_policy
getpolicy_14:
intc_0 // 0
bytec_2 // "token_basis"
app_global_get_ex
store 11
store 10
load 11
assert
load 10
store 9
intc_0 // 0
bytec_1 // "perks_receiver"
app_global_get_ex
store 14
store 13
load 14
assert
load 13
store 12
load 12
len
intc_2 // 32
==
assert
load 12
load 9
itob
concat
retsub
// offer
offer_15:
store 42
store 41
store 40
load 41
intc_2 // 32
extract_uint64
store 43
load 41
extract 0 32
store 44
load 42
intc_2 // 32
extract_uint64
store 45
load 42
extract 0 32
store 46
txn Sender
load 40
asset_holding_get AssetBalance
store 48
store 47
load 40
asset_params_get AssetClawback
store 50
store 49
load 47
load 43
>=
assert
load 49
global CurrentApplicationAddress
==
assert
txn Sender
load 40
txnas Assets
load 44
load 43
load 46
load 45
callsub doupdateoffered_11
retsub
// royalty_free_move
royaltyfreemove_16:
store 64
store 63
store 62
store 61
store 60
load 62
txnas Accounts
load 60
txnas Assets
callsub lambda_0
app_local_get
store 65
load 65
intc_2 // 32
extract_uint64
store 66
load 65
extract 0 32
store 67
load 66
load 64
==
assert
load 66
load 61
>=
assert
load 67
txn Sender
==
assert
load 62
txnas Accounts
load 60
txnas Assets
bytec 4 // ""
intc_0 // 0
load 67
load 66
callsub doupdateoffered_11
load 60
txnas Assets
load 62
txnas Accounts
load 63
txnas Accounts
load 61
callsub domoveasset_8
retsub
// set_administrator
setadministrator_17:
store 72
txn Sender
callsub authonly_5
// unauthorized
assert
bytec_0 // "admin"
load 72
app_global_put
retsub
// set_payment_asset
setpaymentasset_18:
store 74
store 73
txn Sender
callsub authonly_7
// unauthorized
assert
global CurrentApplicationAddress
load 73
asset_holding_get AssetBalance
store 76
store 75
load 73
asset_params_get AssetCreator
store 78
store 77
load 74
load 76
!
&&
bnz setpaymentasset_18_l4
load 74
!
load 76
&&
bnz setpaymentasset_18_l3
intc_0 // 0
return
setpaymentasset_18_l3:
itxn_begin
intc_3 // axfer
itxn_field TypeEnum
load 73
txnas Assets
itxn_field XferAsset
intc_0 // 0
itxn_field AssetAmount
intc_0 // 0
itxn_field Fee
load 77
itxn_field AssetCloseTo
load 77
itxn_field AssetReceiver
itxn_submit
b setpaymentasset_18_l5
setpaymentasset_18_l4:
itxn_begin
intc_3 // axfer
itxn_field TypeEnum
load 73
txnas Assets
itxn_field XferAsset
intc_0 // 0
itxn_field AssetAmount
intc_0 // 0
itxn_field Fee
global CurrentApplicationAddress
itxn_field AssetReceiver
itxn_submit
setpaymentasset_18_l5:
retsub
// set_policy
setpolicy_19:
store 79
txn Sender
callsub authonly_6
// unauthorized
assert
load 79
intc_2 // 32
extract_uint64
store 80
load 79
extract 0 32
store 81
load 80
intc 4 // 10000
<=
assert
bytec_2 // "token_basis"
load 80
app_global_put
bytec_1 // "perks_receiver"
load 81
app_global_put
retsub
// transfer_algo_payment
transferalgopayment_20:
store 88
store 87
store 86
store 85
store 84
store 83
store 82
load 84
txnas Accounts
load 82
txnas Assets
callsub lambda_0
app_local_get
store 89
load 89
intc_2 // 32
extract_uint64
store 90
load 89
extract 0 32
store 91
global GroupSize
pushint 2 // 2
==
assert
txn Sender
load 91
==
assert
load 83
load 90
<=
assert
load 87
gtxns Receiver
global CurrentApplicationAddress
==
assert
load 86
txnas Accounts
bytec_1 // "perks_receiver"
app_global_get
==
assert
load 87
gtxns Amount
load 84
txnas Accounts
load 86
txnas Accounts
bytec_2 // "token_basis"
app_global_get
callsub dopayalgos_9
load 82
txnas Assets
load 84
txnas Accounts
load 85
txnas Accounts
load 83
callsub domoveasset_8
load 84
txnas Accounts
load 82
txnas Assets
load 91
load 90
load 83
-
txn Sender
load 88
callsub doupdateoffered_11
retsub
// transfer_asset_payment
transferassetpayment_21:
store 104
store 103
store 102
store 101
store 100
store 99
store 98
store 97
load 99
txnas Accounts
load 97
txnas Assets
callsub lambda_0
app_local_get
store 105
load 105
intc_2 // 32
extract_uint64
store 106
load 105
extract 0 32
store 107
global GroupSize
pushint 2 // 2
==
assert
txn Sender
load 107
==
assert
load 102
gtxns Sender
load 107
==
assert
load 98
load 106
<=
assert
load 102
gtxns XferAsset
load 103
txnas Assets
==
assert
load 102
gtxns AssetReceiver
global CurrentApplicationAddress
==
assert
load 101
txnas Accounts
bytec_1 // "perks_receiver"
app_global_get