BCD

Tezos Contract Explorer
Search Networks Deploy
  • Home
  • /
  • Ghostnet
  • /
  • KT18vYN...rqZt
FA2Ledger
operations (4)Storage Code Interact Tokens Metadata Fork Views Statistics Details
Latest
​x
764
1044
 
1
{ parameter (or
2
              (or
3
                (pair %balance_of
4
                  (list %requests (pair (address %owner) (nat %token_id)))
5
                  (contract %callback (list (pair
6
                                            (pair %request (address %owner)
7
                                                           (nat %token_id))
8
                                            (nat %balance)))))
9
                (or
10
                  (list %burn (pair (address %from_) (pair (nat %token_id) (nat %amount))))
11
                  (list %mint (pair (address %to_) (map %metadata string bytes)))))
12
              (or (address %set_administrator)
13
                  (or
14
                    (list %transfer (pair (address %from_)
15
                                         (list %txs (pair (address %to_)
16
                                                         (pair (nat %token_id)
17
                                                               (nat %amount))))))
18
                    (list %update_operators (or
19
                                             (pair %add_operator (address %owner)
20
                                                                 (pair
21
                                                                   (address %operator)
22
                                                                   (nat %token_id)))
23
                                             (pair %remove_operator (address %owner)
24
                                                                    (pair
25
                                                                      (address %operator)
26
                                                                      (nat %token_id)))))))) ;
27
  storage (pair (address %administrator)
28
                (pair (big_map %ledger nat address)
29
                      (pair (big_map %metadata string bytes)
30
                            (pair (nat %next_token_id)
31
                                  (pair
32
                                    (big_map %operators
33
                                      (pair (address %owner)
34
                                            (pair (address %operator) (nat %token_id)))
35
                                      unit)
36
                                    (big_map %token_metadata nat
37
                                                             (pair (nat %token_id)
38
                                                                   (map %token_info
39
                                                                     string
40
                                                                     bytes)))))))) ;
41
  code { LAMBDA
42
           (pair
43
             (pair
44
               (lambda
45
                 (pair nat
46
                       (pair address
47
                             (pair (big_map nat address)
48
                                   (pair (big_map string bytes)
49
                                         (pair nat
50
                                               (pair
51
                                                 (big_map
52
                                                   (pair address (pair address nat))
53
                                                   unit)
54
                                                 (big_map nat
55
                                                          (pair nat (map string bytes)))))))))
56
                 (pair bool
57
                       (pair address
58
                             (pair (big_map nat address)
59
                                   (pair (big_map string bytes)
60
                                         (pair nat
61
                                               (pair
62
                                                 (big_map
63
                                                   (pair address (pair address nat))
64
                                                   unit)
65
                                                 (big_map nat
66
                                                          (pair nat (map string bytes))))))))))
67
               (pair address nat))
68
             (pair address
69
                   (pair (big_map nat address)
70
                         (pair (big_map string bytes)
71
                               (pair nat
72
                                     (pair
73
                                       (big_map (pair address (pair address nat)) unit)
74
                                       (big_map nat (pair nat (map string bytes)))))))))
75
           (pair nat
76
                 (pair address
77
                       (pair (big_map nat address)
78
                             (pair (big_map string bytes)
79
                                   (pair nat
80
                                         (pair
81
                                           (big_map (pair address (pair address nat))
82
                                                    unit)
83
                                           (big_map nat (pair nat (map string bytes)))))))))
84
           { UNPAIR ;
85
             UNPAIR ;
86
             SWAP ;
87
             DUP ;
88
             CDR ;
89
             DIG 2 ;
90
             DIG 3 ;
91
             DIG 2 ;
92
             PAIR ;
93
             EXEC ;
94
             UNPAIR ;
95
             SWAP ;
96
             DUG 2 ;
97
             IF {} { PUSH string "FA2_TOKEN_UNDEFINED" ; FAILWITH } ;
98
             DUP ;
99
             CAR ;
100
             DUP 3 ;
101
             GET 3 ;
102
             DIG 2 ;
103
             CDR ;
104
             GET ;
105
             IF_NONE { PUSH int 351 ; FAILWITH } {} ;
106
             COMPARE ;
107
             EQ ;
108
             IF { PUSH nat 1 } { PUSH nat 0 } ;
109
             PAIR } ;
110
         SWAP ;
111
         LAMBDA
112
           (pair address (pair address nat))
113
           unit
114
           { CAR ; SENDER ; COMPARE ; EQ ; IF {} { PUSH string "FA2_NOT_OWNER" ; FAILWITH } ; UNIT } ;
115
         SWAP ;
116
         LAMBDA
117
           (pair (pair address (pair address nat))
118
                 (pair address
119
                       (pair (big_map nat address)
120
                             (pair (big_map string bytes)
121
                                   (pair nat
122
                                         (pair
123
                                           (big_map (pair address (pair address nat))
124
                                                    unit)
125
                                           (big_map nat (pair nat (map string bytes)))))))))
126
           (pair unit
127
                 (pair address
128
                       (pair (big_map nat address)
129
                             (pair (big_map string bytes)
130
                                   (pair nat
131
                                         (pair
132
                                           (big_map (pair address (pair address nat))
133
                                                    unit)
134
                                           (big_map nat (pair nat (map string bytes)))))))))
135
           { UNPAIR ;
136
             DUP ;
137
             CAR ;
138
             SENDER ;
139
             COMPARE ;
140
             EQ ;
141
             IF
142
               { DROP ; PUSH bool True }
143
               { DUP 2 ; GET 9 ; DUP 2 ; GET 4 ; SENDER ; DIG 3 ; CAR ; PAIR 3 ; MEM } ;
144
             IF {} { PUSH string "FA2_NOT_OPERATOR" ; FAILWITH } ;
145
             UNIT ;
146
             PAIR } ;
147
         SWAP ;
148
         LAMBDA unit bool { DROP ; PUSH bool True } ;
149
         SWAP ;
150
         LAMBDA
151
           (pair nat
152
                 (pair address
153
                       (pair (big_map nat address)
154
                             (pair (big_map string bytes)
155
                                   (pair nat
156
                                         (pair
157
                                           (big_map (pair address (pair address nat))
158
                                                    unit)
159
                                           (big_map nat (pair nat (map string bytes)))))))))
160
           (pair bool
161
                 (pair address
162
                       (pair (big_map nat address)
163
                             (pair (big_map string bytes)
164
                                   (pair nat
165
                                         (pair
166
                                           (big_map (pair address (pair address nat))
167
                                                    unit)
168
                                           (big_map nat (pair nat (map string bytes)))))))))
169
           { UNPAIR ; SWAP ; DUP ; GET 10 ; DIG 2 ; MEM ; PAIR } ;
170
         SWAP ;
171
         LAMBDA
172
           (pair (pair address (pair address nat))
173
                 (pair address
174
                       (pair (big_map nat address)
175
                             (pair (big_map string bytes)
176
                                   (pair nat
177
                                         (pair
178
                                           (big_map (pair address (pair address nat))
179
                                                    unit)
180
                                           (big_map nat (pair nat (map string bytes)))))))))
181
           (pair bool
182
                 (pair address
183
                       (pair (big_map nat address)
184
                             (pair (big_map string bytes)
185
                                   (pair nat
186
                                         (pair
187
                                           (big_map (pair address (pair address nat))
188
                                                    unit)
189
                                           (big_map nat (pair nat (map string bytes)))))))))
190
           { UNPAIR ; SWAP ; DUP ; GET 9 ; DIG 2 ; MEM ; PAIR } ;
191
         SWAP ;
192
         LAMBDA
193
           (pair
194
             (pair
195
               (lambda
196
                 (pair nat
197
                       (pair address
198
                             (pair (big_map nat address)
199
                                   (pair (big_map string bytes)
200
                                         (pair nat
201
                                               (pair
202
                                                 (big_map
203
                                                   (pair address (pair address nat))
204
                                                   unit)
205
                                                 (big_map nat
206
                                                          (pair nat (map string bytes)))))))))
207
                 (pair bool
208
                       (pair address
209
                             (pair (big_map nat address)
210
                                   (pair (big_map string bytes)
211
                                         (pair nat
212
                                               (pair
213
                                                 (big_map
214
                                                   (pair address (pair address nat))
215
                                                   unit)
216
                                                 (big_map nat
217
                                                          (pair nat (map string bytes))))))))))
218
               nat)
219
             (pair address
220
                   (pair (big_map nat address)
221
                         (pair (big_map string bytes)
222
                               (pair nat
223
                                     (pair
224
                                       (big_map (pair address (pair address nat)) unit)
225
                                       (big_map nat (pair nat (map string bytes)))))))))
226
           (pair nat
227
                 (pair address
228
                       (pair (big_map nat address)
229
                             (pair (big_map string bytes)
230
                                   (pair nat
231
                                         (pair
232
                                           (big_map (pair address (pair address nat))
233
                                                    unit)
234
                                           (big_map nat (pair nat (map string bytes)))))))))
235
           { UNPAIR ;
236
             UNPAIR ;
237
             DUG 2 ;
238
             PAIR ;
239
             EXEC ;
240
             UNPAIR ;
241
             IF {} { PUSH string "FA2_TOKEN_UNDEFINED" ; FAILWITH } ;
242
             PUSH nat 1 ;
243
             PAIR } ;
244
         SWAP ;
245
         LAMBDA
246
           (pair (pair address (pair address (pair nat nat)))
247
                 (pair address
248
                       (pair (big_map nat address)
249
                             (pair (big_map string bytes)
250
                                   (pair nat
251
                                         (pair
252
                                           (big_map (pair address (pair address nat))
253
                                                    unit)
254
                                           (big_map nat (pair nat (map string bytes)))))))))
255
           (pair unit
256
                 (pair address
257
                       (pair (big_map nat address)
258
                             (pair (big_map string bytes)
259
                                   (pair nat
260
                                         (pair
261
                                           (big_map (pair address (pair address nat))
262
                                                    unit)
263
                                           (big_map nat (pair nat (map string bytes)))))))))
264
           { UNPAIR ;
265
             PUSH nat 1 ;
266
             DUP 2 ;
267
             GET 6 ;
268
             COMPARE ;
269
             EQ ;
270
             IF
271
               { DUP ;
272
                 CAR ;
273
                 DUP 3 ;
274
                 GET 3 ;
275
                 DUP 3 ;
276
                 GET 5 ;
277
                 GET ;
278
                 IF_NONE { PUSH int 359 ; FAILWITH } {} ;
279
                 COMPARE ;
280
                 EQ }
281
               { PUSH bool False } ;
282
             IF {} { PUSH string "FA2_INSUFFICIENT_BALANCE" ; FAILWITH } ;
283
             SWAP ;
284
             DUP ;
285
             GET 3 ;
286
             DUP 3 ;
287
             GET 3 ;
288
             SOME ;
289
             DIG 3 ;
290
             GET 5 ;
291
             UPDATE ;
292
             UPDATE 3 ;
293
             UNIT ;
294
             PAIR } ;
295
         SWAP ;
296
         PUSH (pair (string %ledger_type)
297
                 (pair %policy (string %name)
298
                               (pair (bool %supports_operator) (bool %supports_transfer)))) (Pair "NFT" (Pair "owner-or-operator-transfer" (Pair True True))) ;
299
         SWAP ;
300
         UNPAIR ;
301
         IF_LEFT
302
           { IF_LEFT
303
               { LAMBDA
304
                   (pair
305
                     (pair (pair address nat)
306
                           (pair
307
                             (lambda
308
                               (pair nat
309
                                     (pair address
310
                                           (pair (big_map nat address)
311
                                                 (pair (big_map string bytes)
312
                                                       (pair nat
313
                                                             (pair
314
                                                               (big_map
315
                                                                 (pair address
316
                                                                       (pair address nat))
317
                                                                 unit)
318
                                                               (big_map nat
319
                                                                        (pair nat
320
                                                                              (map
321
                                                                                string
322
                                                                                bytes)))))))))
323
                               (pair bool
324
                                     (pair address
325
                                           (pair (big_map nat address)
326
                                                 (pair (big_map string bytes)
327
                                                       (pair nat
328
                                                             (pair
329
                                                               (big_map
330
                                                                 (pair address
331
                                                                       (pair address nat))
332
                                                                 unit)
333
                                                               (big_map nat
334
                                                                        (pair nat
335
                                                                              (map
336
                                                                                string
337
                                                                                bytes))))))))))
338
                             (lambda
339
                               (pair
340
                                 (pair
341
                                   (lambda
342
                                     (pair nat
343
                                           (pair address
344
                                                 (pair (big_map nat address)
345
                                                       (pair (big_map string bytes)
346
                                                             (pair nat
347
                                                                   (pair
348
                                                                     (big_map
349
                                                                       (pair address
350
                                                                             (pair
351
                                                                               address
352
                                                                               nat))
353
                                                                       unit)
354
                                                                     (big_map nat
355
                                                                              (pair nat
356
                                                                                    (map
357
                                                                                      string
358
                                                                                      bytes)))))))))
359
                                     (pair bool
360
                                           (pair address
361
                                                 (pair (big_map nat address)
362
                                                       (pair (big_map string bytes)
363
                                                             (pair nat
364
                                                                   (pair
365
                                                                     (big_map
366
                                                                       (pair address
367
                                                                             (pair
368
                                                                               address
369
                                                                               nat))
370
                                                                       unit)
371
                                                                     (big_map nat
372
                                                                              (pair nat
373
                                                                                    (map
374
                                                                                      string
375
                                                                                      bytes))))))))))
376
                                   (pair address nat))
377
                                 (pair address
378
                                       (pair (big_map nat address)
379
                                             (pair (big_map string bytes)
380
                                                   (pair nat
381
                                                         (pair
382
                                                           (big_map
383
                                                             (pair address
384
                                                                   (pair address nat))
385
                                                             unit)
386
                                                           (big_map nat
387
                                                                    (pair nat
388
                                                                          (map string
389
                                                                               bytes)))))))))
390
                               (pair nat
391
                                     (pair address
392
                                           (pair (big_map nat address)
393
                                                 (pair (big_map string bytes)
394
                                                       (pair nat
395
                                                             (pair
396
                                                               (big_map
397
                                                                 (pair address
398
                                                                       (pair address nat))
399
                                                                 unit)
400
                                                               (big_map nat
401
                                                                        (pair nat
402
                                                                              (map
403
                                                                                string
404
                                                                                bytes))))))))))))
405
                     (pair address
406
                           (pair (big_map nat address)
407
                                 (pair (big_map string bytes)
408
                                       (pair nat
409
                                             (pair
410
                                               (big_map
411
                                                 (pair address (pair address nat))
412
                                                 unit)
413
                                               (big_map nat
414
                                                        (pair nat (map string bytes)))))))))
415
                   (pair (pair (pair address nat) nat)
416
                         (pair address
417
                               (pair (big_map nat address)
418
                                     (pair (big_map string bytes)
419
                                           (pair nat
420
                                                 (pair
421
                                                   (big_map
422
                                                     (pair address (pair address nat))
423
                                                     unit)
424
                                                   (big_map nat
425
                                                            (pair nat (map string bytes)))))))))
426
                   { UNPAIR ;
427
                     UNPAIR 3 ;
428
                     DIG 2 ;
429
                     DUP 2 ;
430
                     DIG 3 ;
431
                     PAIR ;
432
                     SWAP ;
433
                     DIG 3 ;
434
                     DIG 2 ;
435
                     PAIR ;
436
                     EXEC ;
437
                     UNPAIR ;
438
                     SWAP ;
439
                     DUG 2 ;
440
                     SWAP ;
441
                     PAIR ;
442
                     PAIR } ;
443
                 DUP 2 ;
444
                 CAR ;
445
                 MAP { DUP 2 ;
446
                       DUP 14 ;
447
                       DUP 11 ;
448
                       PAIR ;
449
                       DIG 2 ;
450
                       PAIR ;
451
                       SWAP ;
452
                       DIG 4 ;
453
                       DIG 2 ;
454
                       PAIR ;
455
                       EXEC ;
456
                       UNPAIR ;
457
                       DUG 12 ;
458
                       DUG 12 ;
459
                       DUG 12 ;
460
                       DUG 12 ;
461
                       DIG 10 ;
462
                       DIG 12 ;
463
                       DIG 12 ;
464
                       DIG 12 } ;
465
                 SWAP ;
466
                 DROP ;
467
                 DIG 3 ;
468
                 DROP ;
469
                 DIG 3 ;
470
                 DROP ;
471
                 DIG 3 ;
472
                 DROP ;
473
                 DIG 3 ;
474
                 DROP ;
475
                 DIG 3 ;
476
                 DROP ;
477
                 DIG 3 ;
478
                 DROP ;
479
                 DIG 3 ;
480
                 DROP ;
481
                 DIG 3 ;
482
                 DROP ;
483
                 DIG 3 ;
484
                 DROP ;
485
                 NIL operation ;
486
                 DIG 2 ;
487
                 CDR ;
488
                 PUSH mutez 0 ;
489
                 DIG 3 ;
490
                 TRANSFER_TOKENS ;
491
                 CONS }
492
               { IF_LEFT
493
                   { DUP 3 ;
494
                     GET 6 ;
495
                     IF {} { PUSH string "FA2_TX_DENIED" ; FAILWITH } ;
496
                     DUP ;
497
                     ITER { DUP 8 ;
498
                            SWAP ;
499
                            DUP ;
500
                            GET 3 ;
501
                            DIG 2 ;
502
                            DIG 4 ;
503
                            DIG 2 ;
504
                            PAIR ;
505
                            EXEC ;
506
                            UNPAIR ;
507
                            DUG 12 ;
508
                            DUG 12 ;
509
                            DUG 12 ;
510
                            DUG 12 ;
511
                            DIG 10 ;
512
                            DIG 12 ;
513
                            DIG 12 ;
514
                            DIG 12 ;
515
                            IF {} { PUSH string "FA2_TOKEN_UNDEFINED" ; FAILWITH } ;
516
                            DUP 10 ;
517
                            DUP 2 ;
518
                            GET 3 ;
519
                            DUP 3 ;
520
                            CAR ;
521
                            DUP 4 ;
522
                            CAR ;
523
                            PAIR 3 ;
524
                            SWAP ;
525
                            DIG 4 ;
526
                            DIG 2 ;
527
                            PAIR ;
528
                            EXEC ;
529
                            CDR ;
530
                            DUG 11 ;
531
                            DUG 11 ;
532
                            DUG 11 ;
533
                            DIG 9 ;
534
                            DIG 11 ;
535
                            DIG 11 ;
536
                            PUSH nat 0 ;
537
                            DUP 2 ;
538
                            GET 4 ;
539
                            COMPARE ;
540
                            GT ;
541
                            IF
542
                              { PUSH nat 1 ;
543
                                DUP 2 ;
544
                                GET 4 ;
545
                                COMPARE ;
546
                                EQ ;
547
                                IF
548
                                  { DUP ;
549
                                    CAR ;
550
                                    DUP 4 ;
551
                                    GET 3 ;
552
                                    DUP 3 ;
553
                                    GET 3 ;
554
                                    GET ;
555
                                    IF_NONE { PUSH int 728 ; FAILWITH } {} ;
556
                                    COMPARE ;
557
                                    EQ }
558
                                  { PUSH bool False } ;
559
                                IF
560
                                  {}
561
                                  { PUSH string "FA2_INSUFFICIENT_BALANCE" ; FAILWITH } ;
562
                                DIG 2 ;
563
                                DUP ;
564
                                GET 3 ;
565
                                NONE address ;
566
                                DUP 4 ;
567
                                GET 3 ;
568
                                UPDATE ;
569
                                UPDATE 3 ;
570
                                DUP ;
571
                                GET 10 ;
572
                                NONE (pair nat (map string bytes)) ;
573
                                DIG 3 ;
574
                                GET 3 ;
575
                                UPDATE ;
576
                                UPDATE 10 ;
577
                                SWAP }
578
                              { DROP } } ;
579
                     DROP ;
580
                     SWAP ;
581
                     DROP ;
582
                     SWAP ;
583
                     DROP ;
584
                     SWAP ;
585
                     DROP ;
586
                     SWAP ;
587
                     DROP ;
588
                     SWAP ;
589
                     DROP ;
590
                     SWAP ;
591
                     DROP ;
592
                     SWAP ;
593
                     DROP ;
594
                     SWAP ;
595
                     DROP ;
596
                     SWAP ;
597
                     DROP }
598
                   { DUP 8 ;
599
                     UNIT ;
600
                     EXEC ;
601
                     IF {} { PUSH string "FA2_NOT_ADMIN" ; FAILWITH } ;
602
                     DUP ;
603
                     ITER { DUP 3 ;
604
                            GET 7 ;
605
                            DIG 3 ;
606
                            DUP ;
607
                            GET 10 ;
608
                            DUP 4 ;
609
                            CDR ;
610
                            DUP 4 ;
611
                            PAIR ;
612
                            SOME ;
613
                            DUP 4 ;
614
                            UPDATE ;
615
                            UPDATE 10 ;
616
                            DUP ;
617
                            GET 3 ;
618
                            DIG 3 ;
619
                            CAR ;
620
                            SOME ;
621
                            DIG 3 ;
622
                            UPDATE ;
623
                            UPDATE 3 ;
624
                            DUP ;
625
                            GET 7 ;
626
                            PUSH nat 1 ;
627
                            ADD ;
628
                            UPDATE 7 ;
629
                            SWAP } ;
630
                     DROP ;
631
                     SWAP ;
632
                     DROP ;
633
                     SWAP ;
634
                     DROP ;
635
                     SWAP ;
636
                     DROP ;
637
                     SWAP ;
638
                     DROP ;
639
                     SWAP ;
640
                     DROP ;
641
                     SWAP ;
642
                     DROP ;
643
                     SWAP ;
644
                     DROP ;
645
                     SWAP ;
646
                     DROP ;
647
                     SWAP ;
648
                     DROP } ;
649
                 NIL operation } }
650
           { IF_LEFT
651
               { DIG 2 ;
652
                 DROP ;
653
                 DIG 2 ;
654
                 DROP ;
655
                 DIG 2 ;
656
                 DROP ;
657
                 DIG 2 ;
658
                 DROP ;
659
                 DIG 2 ;
660
                 DROP ;
661
                 DIG 3 ;
662
                 DROP ;
663
                 DIG 3 ;
664
                 DROP ;
665
                 DIG 3 ;
666
                 DROP ;
667
                 DIG 2 ;
668
                 UNIT ;
669
                 EXEC ;
670
                 IF {} { PUSH string "FA2_NOT_ADMIN" ; FAILWITH } ;
671
                 UPDATE 1 }
672
               { IF_LEFT
673
                   { DUP 3 ;
674
                     GET 6 ;
675
                     IF
676
                       { DUP ;
677
                         ITER { DUP ;
678
                                CDR ;
679
                                ITER { DUP 9 ;
680
                                       SWAP ;
681
                                       DUP ;
682
                                       GET 3 ;
683
                                       DIG 2 ;
684
                                       DIG 5 ;
685
                                       DIG 2 ;
686
                                       PAIR ;
687
                                       EXEC ;
688
                                       UNPAIR ;
689
                                       DUG 13 ;
690
                                       DUG 13 ;
691
                                       DUG 13 ;
692
                                       DUG 13 ;
693
                                       DUG 13 ;
694
                                       DIG 10 ;
695
                                       DIG 13 ;
696
                                       DIG 13 ;
697
                                       DIG 13 ;
698
                                       DIG 13 ;
699
                                       IF
700
                                         {}
701
                                         { PUSH string "FA2_TOKEN_UNDEFINED" ; FAILWITH } ;
702
                                       DUP 11 ;
703
                                       DUP 2 ;
704
                                       GET 3 ;
705
                                       DUP 3 ;
706
                                       CAR ;
707
                                       DUP 5 ;
708
                                       CAR ;
709
                                       PAIR 3 ;
710
                                       SWAP ;
711
                                       DIG 5 ;
712
                                       DIG 2 ;
713
                                       PAIR ;
714
                                       EXEC ;
715
                                       CDR ;
716
                                       DUG 12 ;
717
                                       DUG 12 ;
718
                                       DUG 12 ;
719
                                       DUG 12 ;
720
                                       DIG 9 ;
721
                                       DIG 12 ;
722
                                       DIG 12 ;
723
                                       DIG 12 ;
724
                                       PUSH nat 0 ;
725
                                       DUP 2 ;
726
                                       GET 4 ;
727
                                       COMPARE ;
728
                                       GT ;
729
                                       IF
730
                                         { DUP 2 ;
731
                                           CAR ;
732
                                           PAIR ;
733
                                           DUP 6 ;
734
                                           DIG 4 ;
735
                                           DIG 2 ;
736
                                           PAIR ;
737
                                           EXEC ;
738
                                           CDR ;
739
                                           DUG 11 ;
740
                                           DUG 11 ;
741
                                           DUG 11 ;
742
                                           DIG 9 ;
743
                                           DIG 11 ;
744
                                           DIG 11 }
745
                                         { DROP } } ;
746
                                DROP } ;
747
                         DROP ;
748
                         SWAP ;
749
                         DROP ;
750
                         SWAP ;
751
                         DROP ;
752
                         SWAP ;
753
                         DROP ;
754
                         SWAP ;
755
                         DROP ;
756
                         SWAP ;
757
                         DROP ;
758
                         SWAP ;
759
                         DROP ;
760
                         SWAP ;
761
                         DROP ;
762
                         SWAP ;
763
                         DROP ;
764
                         SWAP ;
765
                         DROP }
766
                       { PUSH string "FA2_TX_DENIED" ; FAILWITH } }
767
                   { DUP 3 ;
768
                     GET 5 ;
769
                     IF
770
                       { DUP ;
771
                         ITER { IF_LEFT
772
                                  { DUP 11 ;
773
                                    DUP 2 ;
774
                                    EXEC ;
775
                                    DROP ;
776
                                    DIG 2 ;
777
                                    DUP ;
778
                                    GET 9 ;
779
                                    PUSH (option unit) (Some Unit) ;
780
                                    DIG 3 ;
781
                                    UPDATE ;
782
                                    UPDATE 9 ;
783
                                    SWAP }
784
                                  { DUP 11 ;
785
                                    DUP 2 ;
786
                                    EXEC ;
787
                                    DROP ;
788
                                    DIG 2 ;
789
                                    DUP ;
790
                                    GET 9 ;
791
                                    NONE unit ;
792
                                    DIG 3 ;
793
                                    UPDATE ;
794
                                    UPDATE 9 ;
795
                                    SWAP } } ;
796
                         DROP ;
797
                         SWAP ;
798
                         DROP ;
799
                         SWAP ;
800
                         DROP ;
801
                         SWAP ;
802
                         DROP ;
803
                         SWAP ;
804
                         DROP ;
805
                         SWAP ;
806
                         DROP ;
807
                         SWAP ;
808
                         DROP ;
809
                         SWAP ;
810
                         DROP ;
811
                         SWAP ;
812
                         DROP ;
813
                         SWAP ;
814
                         DROP }
815
                       { PUSH string "FA2_OPERATORS_UNSUPPORTED" ; FAILWITH } } } ;
816
             NIL operation } ;
817
         PAIR } ;
818
  view "get_balance_of" (list (pair (address %owner) (nat %token_id)))
819
        (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))
820
        { UNPAIR ;
821
          LAMBDA
822
            (pair
823
              (pair
824
                (lambda
825
                  (pair nat
826
                        (pair address
827
                              (pair (big_map nat address)
828
                                    (pair (big_map string bytes)
829
                                          (pair nat
830
                                                (pair
831
                                                  (big_map
832
                                                    (pair address (pair address nat))
833
                                                    unit)
834
                                                  (big_map nat
835
                                                           (pair nat (map string bytes)))))))))
836
                  (pair bool
837
                        (pair address
838
                              (pair (big_map nat address)
839
                                    (pair (big_map string bytes)
840
                                          (pair nat
841
                                                (pair
842
                                                  (big_map
843
                                                    (pair address (pair address nat))
844
                                                    unit)
845
                                                  (big_map nat
846
                                                           (pair nat (map string bytes))))))))))
847
                (pair address nat))
848
              (pair address
849
                    (pair (big_map nat address)
850
                          (pair (big_map string bytes)
851
                                (pair nat
852
                                      (pair
853
                                        (big_map (pair address (pair address nat)) unit)
854
                                        (big_map nat (pair nat (map string bytes)))))))))
855
            (pair nat
856
                  (pair address
857
                        (pair (big_map nat address)
858
                              (pair (big_map string bytes)
859
                                    (pair nat
860
                                          (pair
861
                                            (big_map (pair address (pair address nat))
862
                                                     unit)
863
                                            (big_map nat (pair nat (map string bytes)))))))))
864
            { UNPAIR ;
865
              UNPAIR ;
866
              SWAP ;
867
              DUP ;
868
              CDR ;
869
              DIG 2 ;
870
              DIG 3 ;
871
              DIG 2 ;
872
              PAIR ;
873
              EXEC ;
874
              UNPAIR ;
875
              SWAP ;
876
              DUG 2 ;
877
              IF {} { PUSH string "FA2_TOKEN_UNDEFINED" ; FAILWITH } ;
878
              DUP ;
879
              CAR ;
880
              DUP 3 ;
881
              GET 3 ;
882
              DIG 2 ;
883
              CDR ;
884
              GET ;
885
              IF_NONE { PUSH int 351 ; FAILWITH } {} ;
886
              COMPARE ;
887
              EQ ;
888
              IF { PUSH nat 1 } { PUSH nat 0 } ;
889
              PAIR } ;
890
          SWAP ;
891
          LAMBDA
892
            (pair nat
893
                  (pair address
894
                        (pair (big_map nat address)
895
                              (pair (big_map string bytes)
896
                                    (pair nat
897
                                          (pair
898
                                            (big_map (pair address (pair address nat))
899
                                                     unit)
900
                                            (big_map nat (pair nat (map string bytes)))))))))
901
            (pair bool
902
                  (pair address
903
                        (pair (big_map nat address)
904
                              (pair (big_map string bytes)
905
                                    (pair nat
906
                                          (pair
907
                                            (big_map (pair address (pair address nat))
908
                                                     unit)
909
                                            (big_map nat (pair nat (map string bytes)))))))))
910
            { UNPAIR ; SWAP ; DUP ; GET 10 ; DIG 2 ; MEM ; PAIR } ;
911
          SWAP ;
912
          LAMBDA
913
            (pair
914
              (pair (pair address nat)
915
                    (pair
916
                      (lambda
917
                        (pair nat
918
                              (pair address
919
                                    (pair (big_map nat address)
920
                                          (pair (big_map string bytes)
921
                                                (pair nat
922
                                                      (pair
923
                                                        (big_map
924
                                                          (pair address
925
                                                                (pair address nat))
926
                                                          unit)
927
                                                        (big_map nat
928
                                                                 (pair nat
929
                                                                       (map string bytes)))))))))
930
                        (pair bool
931
                              (pair address
932
                                    (pair (big_map nat address)
933
                                          (pair (big_map string bytes)
934
                                                (pair nat
935
                                                      (pair
936
                                                        (big_map
937
                                                          (pair address
938
                                                                (pair address nat))
939
                                                          unit)
940
                                                        (big_map nat
941
                                                                 (pair nat
942
                                                                       (map string bytes))))))))))
943
                      (lambda
944
                        (pair
945
                          (pair
946
                            (lambda
947
                              (pair nat
948
                                    (pair address
949
                                          (pair (big_map nat address)
950
                                                (pair (big_map string bytes)
951
                                                      (pair nat
952
                                                            (pair
953
                                                              (big_map
954
                                                                (pair address
955
                                                                      (pair address nat))
956
                                                                unit)
957
                                                              (big_map nat
958
                                                                       (pair nat
959
                                                                             (map string
960
                                                                                  bytes)))))))))
961
                              (pair bool
962
                                    (pair address
963
                                          (pair (big_map nat address)
964
                                                (pair (big_map string bytes)
965
                                                      (pair nat
966
                                                            (pair
967
                                                              (big_map
968
                                                                (pair address
969
                                                                      (pair address nat))
970
                                                                unit)
971
                                                              (big_map nat
972
                                                                       (pair nat
973
                                                                             (map string
974
                                                                                  bytes))))))))))
975
                            (pair address nat))
976
                          (pair address
977
                                (pair (big_map nat address)
978
                                      (pair (big_map string bytes)
979
                                            (pair nat
980
                                                  (pair
981
                                                    (big_map
982
                                                      (pair address (pair address nat))
983
                                                      unit)
984
                                                    (big_map nat
985
                                                             (pair nat
986
                                                                   (map string bytes)))))))))
987
                        (pair nat
988
                              (pair address
989
                                    (pair (big_map nat address)
990
                                          (pair (big_map string bytes)
991
                                                (pair nat
992
                                                      (pair
993
                                                        (big_map
994
                                                          (pair address
995
                                                                (pair address nat))
996
                                                          unit)
997
                                                        (big_map nat
998
                                                                 (pair nat
999
                                                                       (map string bytes))))))))))))
1000
              (pair address
1001
                    (pair (big_map nat address)
1002
                          (pair (big_map string bytes)
1003
                                (pair nat
1004
                                      (pair
1005
                                        (big_map (pair address (pair address nat)) unit)
1006
                                        (big_map nat (pair nat (map string bytes)))))))))
1007
            (pair (pair (pair address nat) nat)
1008
                  (pair address
1009
                        (pair (big_map nat address)
1010
                              (pair (big_map string bytes)
1011
                                    (pair nat
1012
                                          (pair
1013
                                            (big_map (pair address (pair address nat))
1014
                                                     unit)
1015
                                            (big_map nat (pair nat (map string bytes)))))))))
1016
            { UNPAIR ;
1017
              UNPAIR 3 ;
1018
              DIG 2 ;
1019
              DUP 2 ;
1020
              DIG 3 ;
1021
              PAIR ;
1022
              SWAP ;
1023
              DIG 3 ;
1024
              DIG 2 ;
1025
              PAIR ;
1026
              EXEC ;
1027
              UNPAIR ;
1028
              SWAP ;
1029
              DUG 2 ;
1030
              SWAP ;
1031
              PAIR ;
1032
              PAIR } ;
1033
          DUP 2 ;
1034
          MAP { DUP 2 ; DUP 6 ; DUP 6 ; PAIR ; DIG 2 ; PAIR ; SWAP ; DIG 6 ; DIG 2 ; PAIR ; EXEC ; UNPAIR ; SWAP ; DUG 5 } ;
1035
          SWAP ;
1036
          DROP ;
1037
          SWAP ;
1038
          DROP ;
1039
          SWAP ;
1040
          DROP ;
1041
          SWAP ;
1042
          DROP ;
1043
          SWAP ;
1044
          DROP } }