BCD

Tezos Contract Explorer
Search Networks Deploy
  • Home
  • /
  • Mainnet
  • /
  • PermaTaco
FA2Ledger
operations (53)Storage Code Interact Tokens Metadata Fork Statistics Details
Latest
​x
646
 
1
parameter (or
2
            (or (pair %abyss (nat %asset_id) (bytes %payload))
3
                (or %admin (or (unit %confirm_admin) (bool %pause)) (address %set_admin)))
4
            (or
5
              (or %assets
6
                (or
7
                  (pair %balance_of
8
                    (list %requests (pair (address %owner) (nat %token_id)))
9
                    (contract %callback (list (pair
10
                                              (pair %request (address %owner)
11
                                                             (nat %token_id))
12
                                              (nat %balance)))))
13
                  (list %transfer (pair (address %from_)
14
                                       (list %txs (pair (address %to_)
15
                                                       (pair (nat %token_id)
16
                                                             (nat %amount)))))))
17
                (list %update_operators (or
18
                                         (pair %add_operator (address %owner)
19
                                                             (pair (address %operator)
20
                                                                   (nat %token_id)))
21
                                         (pair %remove_operator (address %owner)
22
                                                                (pair
23
                                                                  (address %operator)
24
                                                                  (nat %token_id))))))
25
              (unit %close)));
26
storage (pair
27
          (pair
28
            (pair %admin (pair (address %admin) (bool %paused))
29
                         (option %pending_admin address))
30
            (pair %assets
31
              (pair (big_map %ledger nat address)
32
                    (big_map %operators (pair address (pair address nat)) unit))
33
              (pair
34
                (pair %permissions
35
                  (or %operator (unit %no_transfer)
36
                                (or (unit %owner_transfer)
37
                                    (unit %owner_or_operator_transfer)))
38
                  (pair
39
                    (or %receiver (unit %owner_no_hook)
40
                                  (or (unit %optional_owner_hook)
41
                                      (unit %required_owner_hook)))
42
                    (pair
43
                      (or %sender (unit %owner_no_hook)
44
                                  (or (unit %optional_owner_hook)
45
                                      (unit %required_owner_hook)))
46
                      (option %custom (pair (string %tag) (option %config_api address))))))
47
                (big_map %token_metadata nat
48
                                         (pair (nat %token_id)
49
                                               (map %token_info string bytes))))))
50
          (pair (big_map %metadata string bytes) (bool %minting_closed)));
51
code { PUSH string "FA2_TOKEN_UNDEFINED" ;
52
       PUSH string "FA2_INSUFFICIENT_BALANCE" ;
53
       LAMBDA
54
         (pair
55
           (pair
56
             (pair
57
               (list (pair (option address) (list (pair (option address) (pair nat nat)))))
58
               address)
59
             (lambda
60
               (pair (option address) (list (pair (option address) (pair nat nat))))
61
               (list (option address))))
62
           (pair
63
             (lambda address
64
                     (or
65
                       (contract (pair
66
                                  (list (pair (option address)
67
                                             (list (pair (option address) (pair nat nat)))))
68
                                  address))
69
                       string))
70
             bool))
71
         (list (contract (pair
72
                         (list (pair (option address)
73
                                    (list (pair (option address) (pair nat nat)))))
74
                         address)))
75
         { UNPAIR ;
76
           UNPAIR ;
77
           DIG 2 ;
78
           UNPAIR ;
79
           DIG 3 ;
80
           DIG 3 ;
81
           CAR ;
82
           EMPTY_SET address ;
83
           SWAP ;
84
           ITER { DUP 3 ; SWAP ; EXEC ; ITER { IF_NONE {} { PUSH bool True ; SWAP ; UPDATE } } } ;
85
           SWAP ;
86
           DROP ;
87
           NIL (contract (pair
88
                          (list (pair (option address)
89
                                     (list (pair (option address) (pair nat nat)))))
90
                          address)) ;
91
           SWAP ;
92
           ITER { DUP 3 ;
93
                  SWAP ;
94
                  EXEC ;
95
                  IF_LEFT { CONS } { DUP 4 ; IF { SWAP ; DROP ; FAILWITH } { DROP } } } ;
96
           SWAP ;
97
           DROP ;
98
           SWAP ;
99
           DROP } ;
100
       LAMBDA
101
         (pair
102
           (lambda
103
             (pair
104
               (pair
105
                 (pair
106
                   (list (pair (option address)
107
                              (list (pair (option address) (pair nat nat)))))
108
                   address)
109
                 (lambda
110
                   (pair (option address) (list (pair (option address) (pair nat nat))))
111
                   (list (option address))))
112
               (pair
113
                 (lambda address
114
                         (or
115
                           (contract (pair
116
                                      (list (pair (option address)
117
                                                 (list (pair (option address)
118
                                                            (pair nat nat)))))
119
                                      address))
120
                           string))
121
                 bool))
122
             (list (contract (pair
123
                             (list (pair (option address)
124
                                        (list (pair (option address) (pair nat nat)))))
125
                             address))))
126
           (pair
127
             (pair
128
               (pair
129
                 (list (pair (option address)
130
                            (list (pair (option address) (pair nat nat)))))
131
                 address)
132
               (or unit (or unit unit)))
133
             (pair
134
               (lambda
135
                 (pair (option address) (list (pair (option address) (pair nat nat))))
136
                 (list (option address)))
137
               (lambda address
138
                       (or
139
                         (contract (pair
140
                                    (list (pair (option address)
141
                                               (list (pair (option address)
142
                                                          (pair nat nat)))))
143
                                    address))
144
                         string)))))
145
         (list (contract (pair
146
                         (list (pair (option address)
147
                                    (list (pair (option address) (pair nat nat)))))
148
                         address)))
149
         { UNPAIR ;
150
           SWAP ;
151
           UNPAIR ;
152
           UNPAIR ;
153
           DIG 2 ;
154
           UNPAIR ;
155
           DIG 3 ;
156
           IF_LEFT
157
             { DROP 5 ;
158
               NIL (contract (pair
159
                              (list (pair (option address)
160
                                         (list (pair (option address) (pair nat nat)))))
161
                              address)) }
162
             { IF_LEFT
163
                 { DROP ; PUSH bool False ; DIG 2 ; PAIR ; SWAP ; DIG 2 ; PAIR ; PAIR ; EXEC }
164
                 { DROP ; PUSH bool True ; DIG 2 ; PAIR ; SWAP ; DIG 2 ; PAIR ; PAIR ; EXEC } } } ;
165
       SWAP ;
166
       APPLY ;
167
       LAMBDA
168
         (pair (pair address bool) (option address))
169
         unit
170
         { CAR ;
171
           CAR ;
172
           SENDER ;
173
           COMPARE ;
174
           NEQ ;
175
           IF { PUSH string "NOT_AN_ADMIN" ; FAILWITH } { UNIT } } ;
176
       DIG 4 ;
177
       UNPAIR ;
178
       IF_LEFT
179
         { DIG 3 ;
180
           DROP ;
181
           DIG 3 ;
182
           DROP ;
183
           DIG 3 ;
184
           DROP ;
185
           IF_LEFT
186
             { DROP ;
187
               SWAP ;
188
               DROP ;
189
               PUSH bool True ;
190
               SWAP ;
191
               DUP ;
192
               DUG 2 ;
193
               CDR ;
194
               CDR ;
195
               COMPARE ;
196
               EQ ;
197
               IF { PUSH string "MINTING_CLOSED" ; FAILWITH } {} ;
198
               NIL operation ;
199
               PAIR }
200
             { SWAP ;
201
               DUP ;
202
               DUG 2 ;
203
               CAR ;
204
               CAR ;
205
               SWAP ;
206
               IF_LEFT
207
                 { IF_LEFT
208
                     { DROP ;
209
                       DIG 2 ;
210
                       DROP ;
211
                       DUP ;
212
                       CDR ;
213
                       IF_NONE
214
                         { DROP ; PUSH string "NO_PENDING_ADMIN" ; FAILWITH }
215
                         { SENDER ;
216
                           COMPARE ;
217
                           EQ ;
218
                           IF
219
                             { NONE address ; SWAP ; CAR ; CDR ; SENDER ; PAIR ; PAIR }
220
                             { DROP ; PUSH string "NOT_A_PENDING_ADMIN" ; FAILWITH } } ;
221
                       NIL operation ;
222
                       PAIR }
223
                     { SWAP ;
224
                       DUP ;
225
                       DUG 2 ;
226
                       DIG 4 ;
227
                       SWAP ;
228
                       EXEC ;
229
                       DROP ;
230
                       SWAP ;
231
                       DUP ;
232
                       DUG 2 ;
233
                       CDR ;
234
                       SWAP ;
235
                       DIG 2 ;
236
                       CAR ;
237
                       CAR ;
238
                       PAIR ;
239
                       PAIR ;
240
                       NIL operation ;
241
                       PAIR } }
242
                 { SWAP ; DUP ; DUG 2 ; DIG 4 ; SWAP ; EXEC ; DROP ; SOME ; SWAP ; CAR ; PAIR ; NIL operation ; PAIR } ;
243
               UNPAIR ;
244
               DUP 3 ;
245
               CDR ;
246
               DIG 3 ;
247
               CAR ;
248
               CDR ;
249
               DIG 3 ;
250
               PAIR ;
251
               PAIR ;
252
               SWAP ;
253
               PAIR } }
254
         { IF_LEFT
255
             { DIG 2 ;
256
               DROP ;
257
               SWAP ;
258
               DUP ;
259
               DUG 2 ;
260
               CAR ;
261
               CAR ;
262
               CAR ;
263
               CDR ;
264
               IF { PUSH string "PAUSED" ; FAILWITH } {} ;
265
               SWAP ;
266
               DUP ;
267
               DUG 2 ;
268
               CAR ;
269
               CDR ;
270
               SWAP ;
271
               IF_LEFT
272
                 { IF_LEFT
273
                     { DIG 3 ;
274
                       DROP ;
275
                       DIG 3 ;
276
                       DROP ;
277
                       SWAP ;
278
                       DUP ;
279
                       DUG 2 ;
280
                       CAR ;
281
                       CAR ;
282
                       SWAP ;
283
                       DUP ;
284
                       CAR ;
285
                       MAP { DUP 3 ;
286
                             SWAP ;
287
                             DUP ;
288
                             DUG 2 ;
289
                             CDR ;
290
                             GET ;
291
                             IF_NONE
292
                               { DROP ; DUP 5 ; FAILWITH }
293
                               { SWAP ;
294
                                 DUP ;
295
                                 DUG 2 ;
296
                                 CAR ;
297
                                 SWAP ;
298
                                 COMPARE ;
299
                                 EQ ;
300
                                 IF { PUSH nat 1 } { PUSH nat 0 } ;
301
                                 SWAP ;
302
                                 PAIR } } ;
303
                       DIG 2 ;
304
                       DROP ;
305
                       DIG 4 ;
306
                       DROP ;
307
                       SWAP ;
308
                       CDR ;
309
                       PUSH mutez 0 ;
310
                       DIG 2 ;
311
                       TRANSFER_TOKENS ;
312
                       SWAP ;
313
                       NIL operation ;
314
                       DIG 2 ;
315
                       CONS ;
316
                       PAIR }
317
                     { SWAP ;
318
                       DUP ;
319
                       DUG 2 ;
320
                       CAR ;
321
                       CAR ;
322
                       DUP 3 ;
323
                       CAR ;
324
                       CDR ;
325
                       PAIR ;
326
                       LAMBDA
327
                         (pair (pair address address)
328
                               (pair nat
329
                                     (big_map (pair address (pair address nat)) unit)))
330
                         unit
331
                         { UNPAIR ;
332
                           UNPAIR ;
333
                           DIG 2 ;
334
                           UNPAIR ;
335
                           DUP 4 ;
336
                           DUP 4 ;
337
                           COMPARE ;
338
                           EQ ;
339
                           IF
340
                             { DROP 4 ; UNIT }
341
                             { DIG 3 ;
342
                               PAIR ;
343
                               DIG 2 ;
344
                               PAIR ;
345
                               MEM ;
346
                               IF
347
                                 { UNIT }
348
                                 { PUSH string "FA2_NOT_OPERATOR" ; FAILWITH } } } ;
349
                       DUP 3 ;
350
                       DIG 2 ;
351
                       UNPAIR ;
352
                       SWAP ;
353
                       DIG 2 ;
354
                       ITER { DUP ;
355
                              DUG 2 ;
356
                              CDR ;
357
                              ITER { SWAP ;
358
                                     PUSH nat 0 ;
359
                                     DUP 3 ;
360
                                     CDR ;
361
                                     CDR ;
362
                                     COMPARE ;
363
                                     EQ ;
364
                                     IF
365
                                       { SWAP ; DROP }
366
                                       { PUSH nat 1 ;
367
                                         DUP 3 ;
368
                                         CDR ;
369
                                         CDR ;
370
                                         COMPARE ;
371
                                         NEQ ;
372
                                         IF
373
                                           { DROP 2 ; DUP 8 ; FAILWITH }
374
                                           { DUP ;
375
                                             DUP 3 ;
376
                                             CDR ;
377
                                             CAR ;
378
                                             GET ;
379
                                             IF_NONE
380
                                               { DROP 2 ; DUP 9 ; FAILWITH }
381
                                               { DUP 4 ;
382
                                                 CAR ;
383
                                                 SWAP ;
384
                                                 COMPARE ;
385
                                                 NEQ ;
386
                                                 IF
387
                                                   { DROP 2 ; DUP 8 ; FAILWITH }
388
                                                   { DUP 4 ;
389
                                                     DUP 3 ;
390
                                                     CDR ;
391
                                                     CAR ;
392
                                                     PAIR ;
393
                                                     SENDER ;
394
                                                     DUP 5 ;
395
                                                     CAR ;
396
                                                     PAIR ;
397
                                                     PAIR ;
398
                                                     DUP 6 ;
399
                                                     SWAP ;
400
                                                     EXEC ;
401
                                                     DROP ;
402
                                                     SWAP ;
403
                                                     DUP ;
404
                                                     DUG 2 ;
405
                                                     CAR ;
406
                                                     SOME ;
407
                                                     DIG 2 ;
408
                                                     CDR ;
409
                                                     CAR ;
410
                                                     UPDATE } } } } } ;
411
                              SWAP ;
412
                              DROP } ;
413
                       SWAP ;
414
                       DROP ;
415
                       SWAP ;
416
                       DROP ;
417
                       DIG 5 ;
418
                       DROP ;
419
                       DIG 5 ;
420
                       DROP ;
421
                       DUP 3 ;
422
                       CDR ;
423
                       CAR ;
424
                       DIG 2 ;
425
                       SENDER ;
426
                       SWAP ;
427
                       MAP { DUP ;
428
                             CDR ;
429
                             MAP { DUP ; CDR ; CDR ; SWAP ; DUP ; DUG 2 ; CDR ; CAR ; PAIR ; SWAP ; CAR ; SOME ; PAIR } ;
430
                             SWAP ;
431
                             CAR ;
432
                             SOME ;
433
                             PAIR } ;
434
                       PAIR ;
435
                       DUP ;
436
                       DUG 2 ;
437
                       SWAP ;
438
                       DUP ;
439
                       DUG 2 ;
440
                       CDR ;
441
                       CDR ;
442
                       CAR ;
443
                       SWAP ;
444
                       DUP ;
445
                       DUG 2 ;
446
                       LAMBDA
447
                         address
448
                         (or
449
                           (contract (pair
450
                                      (list (pair (option address)
451
                                                 (list (pair (option address)
452
                                                            (pair nat nat)))))
453
                                      address))
454
                           string)
455
                         { CONTRACT %tokens_sent (pair
456
                                                   (list %batch (pair
457
                                                                 (option %from_ address)
458
                                                                 (list %txs (pair
459
                                                                             (option %to_ address)
460
                                                                             (pair
461
                                                                               (nat %token_id)
462
                                                                               (nat %amount))))))
463
                                                   (address %operator)) ;
464
                           IF_NONE
465
                             { PUSH string "FA2_SENDER_HOOK_UNDEFINED" ;
466
                               RIGHT (contract (pair
467
                                                (list (pair (option address)
468
                                                           (list (pair (option address)
469
                                                                      (pair nat nat)))))
470
                                                address)) }
471
                             { LEFT string } } ;
472
                       LAMBDA
473
                         (pair (option address)
474
                               (list (pair (option address) (pair nat nat))))
475
                         (list (option address))
476
                         { NIL (option address) ; SWAP ; CAR ; CONS } ;
477
                       PAIR ;
478
                       DUG 2 ;
479
                       PAIR ;
480
                       PAIR ;
481
                       DUP 8 ;
482
                       SWAP ;
483
                       EXEC ;
484
                       DIG 2 ;
485
                       CDR ;
486
                       CAR ;
487
                       DIG 2 ;
488
                       LAMBDA
489
                         address
490
                         (or
491
                           (contract (pair
492
                                      (list (pair (option address)
493
                                                 (list (pair (option address)
494
                                                            (pair nat nat)))))
495
                                      address))
496
                           string)
497
                         { CONTRACT %tokens_received (pair
498
                                                       (list %batch (pair
499
                                                                     (option %from_ address)
500
                                                                     (list %txs (pair
501
                                                                                 (option %to_ address)
502
                                                                                 (pair
503
                                                                                   (nat %token_id)
504
                                                                                   (nat %amount))))))
505
                                                       (address %operator)) ;
506
                           IF_NONE
507
                             { PUSH string "FA2_RECEIVER_HOOK_UNDEFINED" ;
508
                               RIGHT (contract (pair
509
                                                (list (pair (option address)
510
                                                           (list (pair (option address)
511
                                                                      (pair nat nat)))))
512
                                                address)) }
513
                             { LEFT string } } ;
514
                       LAMBDA
515
                         (pair (option address)
516
                               (list (pair (option address) (pair nat nat))))
517
                         (list (option address))
518
                         { CDR ; MAP { CAR } } ;
519
                       PAIR ;
520
                       DUG 2 ;
521
                       PAIR ;
522
                       PAIR ;
523
                       DIG 6 ;
524
                       SWAP ;
525
                       EXEC ;
526
                       ITER { CONS } ;
527
                       DUP ;
528
                       IF_CONS
529
                         { DROP 2 ;
530
                           MAP { PUSH mutez 0 ; DUP 3 ; TRANSFER_TOKENS } ;
531
                           SWAP ;
532
                           DROP }
533
                         { DROP 2 ; NIL operation } ;
534
                       DUP 3 ;
535
                       CDR ;
536
                       DIG 3 ;
537
                       CAR ;
538
                       CDR ;
539
                       DIG 3 ;
540
                       PAIR ;
541
                       PAIR ;
542
                       SWAP ;
543
                       PAIR } }
544
                 { DIG 3 ;
545
                   DROP ;
546
                   DIG 3 ;
547
                   DROP ;
548
                   DIG 3 ;
549
                   DROP ;
550
                   SWAP ;
551
                   DUP ;
552
                   DUG 2 ;
553
                   CAR ;
554
                   CDR ;
555
                   SWAP ;
556
                   SENDER ;
557
                   DUG 2 ;
558
                   ITER { SWAP ;
559
                          DUP 3 ;
560
                          DUP 3 ;
561
                          IF_LEFT {} {} ;
562
                          CAR ;
563
                          COMPARE ;
564
                          EQ ;
565
                          IF {} { PUSH string "FA2_NOT_OWNER" ; FAILWITH } ;
566
                          SWAP ;
567
                          IF_LEFT
568
                            { SWAP ;
569
                              UNIT ;
570
                              SOME ;
571
                              DUP 3 ;
572
                              CDR ;
573
                              CDR ;
574
                              DUP 4 ;
575
                              CDR ;
576
                              CAR ;
577
                              PAIR ;
578
                              DIG 3 ;
579
                              CAR ;
580
                              PAIR ;
581
                              UPDATE }
582
                            { DUP ;
583
                              DUG 2 ;
584
                              CDR ;
585
                              CDR ;
586
                              DUP 3 ;
587
                              CDR ;
588
                              CAR ;
589
                              PAIR ;
590
                              DIG 2 ;
591
                              CAR ;
592
                              PAIR ;
593
                              NONE unit ;
594
                              SWAP ;
595
                              UPDATE } } ;
596
                   SWAP ;
597
                   DROP ;
598
                   SWAP ;
599
                   DUP ;
600
                   DUG 2 ;
601
                   CDR ;
602
                   SWAP ;
603
                   DIG 2 ;
604
                   CAR ;
605
                   CAR ;
606
                   PAIR ;
607
                   PAIR ;
608
                   NIL operation ;
609
                   PAIR } ;
610
               UNPAIR ;
611
               DUP 3 ;
612
               CDR ;
613
               DIG 2 ;
614
               DIG 3 ;
615
               CAR ;
616
               CAR ;
617
               PAIR ;
618
               PAIR ;
619
               SWAP ;
620
               PAIR }
621
             { DROP ;
622
               DIG 2 ;
623
               DROP ;
624
               DIG 2 ;
625
               DROP ;
626
               DIG 2 ;
627
               DROP ;
628
               DUP ;
629
               CAR ;
630
               CAR ;
631
               DIG 2 ;
632
               SWAP ;
633
               EXEC ;
634
               DROP ;
635
               PUSH bool True ;
636
               SWAP ;
637
               DUP ;
638
               DUG 2 ;
639
               CDR ;
640
               CAR ;
641
               PAIR ;
642
               SWAP ;
643
               CAR ;
644
               PAIR ;
645
               NIL operation ;
646
               PAIR } } }