BCD

Tezos Contract Explorer
Search Networks Deploy
  • Home
  • /
  • Mainnet
  • /
  • TzSafe
operations (7)Storage Code Interact Tokens Metadata Fork Events Statistics Details
Latest
​x
709
 
1
parameter (or
2
            (or
3
              (list %create_proposal (or
4
                                      (or
5
                                        (or (set %add_owners address)
6
                                            (int %adjust_effective_period))
7
                                        (or (nat %adjust_threshold)
8
                                            (pair %execute (address %target)
9
                                                           (unit %parameter)
10
                                                           (mutez %amount))))
11
                                      (or
12
                                        (or
13
                                          (pair %execute_lambda
14
                                            (option %lambda (lambda unit operation))
15
                                            (option %metadata bytes))
16
                                          (set %remove_owners address))
17
                                        (pair %transfer (address %target)
18
                                                        (unit %parameter)
19
                                                        (mutez %amount)))))
20
              (unit %default))
21
            (or
22
              (pair %resolve_proposal nat
23
                                      (list (or
24
                                             (or
25
                                               (or (set %add_owners address)
26
                                                   (int %adjust_effective_period))
27
                                               (or (nat %adjust_threshold)
28
                                                   (pair %execute (address %target)
29
                                                                  (unit %parameter)
30
                                                                  (mutez %amount))))
31
                                             (or
32
                                               (or
33
                                                 (pair %execute_lambda
34
                                                   (option %lambda (lambda unit operation))
35
                                                   (option %metadata bytes))
36
                                                 (set %remove_owners address))
37
                                               (pair %transfer (address %target)
38
                                                               (unit %parameter)
39
                                                               (mutez %amount))))))
40
              (pair %sign_proposal
41
                (pair nat
42
                      (list (or
43
                             (or
44
                               (or (set %add_owners address)
45
                                   (int %adjust_effective_period))
46
                               (or (nat %adjust_threshold)
47
                                   (pair %execute (address %target) (unit %parameter)
48
                                                  (mutez %amount))))
49
                             (or
50
                               (or
51
                                 (pair %execute_lambda
52
                                   (option %lambda (lambda unit operation))
53
                                   (option %metadata bytes))
54
                                 (set %remove_owners address))
55
                               (pair %transfer (address %target) (unit %parameter)
56
                                               (mutez %amount))))))
57
                bool)));
58
storage (pair (nat %proposal_counter)
59
              (big_map %proposals nat
60
                                  (pair
61
                                    (or %state (or (unit %executed) (unit %expired))
62
                                               (or (unit %proposing) (unit %rejected)))
63
                                    (map %signatures address bool)
64
                                    (pair %proposer (address %actor)
65
                                                    (timestamp %timestamp))
66
                                    (option %resolver (pair (address %actor)
67
                                                           (timestamp %timestamp)))
68
                                    (list %contents (or
69
                                                     (or
70
                                                       (or (set %add_owners address)
71
                                                           (int %adjust_effective_period))
72
                                                       (or (nat %adjust_threshold)
73
                                                           (pair %execute
74
                                                             (address %target)
75
                                                             (unit %parameter)
76
                                                             (mutez %amount))))
77
                                                     (or
78
                                                       (or
79
                                                         (pair %execute_lambda
80
                                                           (option %lambda (lambda unit
81
                                                                                  operation))
82
                                                           (option %metadata bytes))
83
                                                         (set %remove_owners address))
84
                                                       (pair %transfer (address %target)
85
                                                                       (unit %parameter)
86
                                                                       (mutez %amount)))))))
87
              (set %owners address)
88
              (nat %threshold)
89
              (int %effective_period)
90
              (big_map %metadata string bytes));
91
code { PUSH string "Only the contract owners can perform this operation" ;
92
       PUSH string "No proposal exists for this counter" ;
93
       PUSH string "Unknown contract" ;
94
       PUSH string "Threshold must be greater than 1" ;
95
       PUSH string "There is no content in proposal" ;
96
       PUSH string "No owner to be added or removed" ;
97
       PUSH string "The proposal content doesn't match" ;
98
       PUSH string "Effective period should be greater than 0" ;
99
       NIL operation ;
100
       DIG 9 ;
101
       UNPAIR ;
102
       IF_LEFT
103
         { DIG 2 ;
104
           DIG 4 ;
105
           DIG 8 ;
106
           DIG 9 ;
107
           DROP 4 ;
108
           IF_LEFT
109
             { DUP 2 ;
110
               GET 5 ;
111
               SENDER ;
112
               MEM ;
113
               IF { DIG 6 ; DROP } { DIG 6 ; FAILWITH } ;
114
               AMOUNT ;
115
               PUSH mutez 0 ;
116
               SWAP ;
117
               COMPARE ;
118
               EQ ;
119
               IF
120
                 {}
121
                 { PUSH string "You must not send tez to the smart contract" ; FAILWITH } ;
122
               PUSH nat 0 ;
123
               DUP 2 ;
124
               SIZE ;
125
               COMPARE ;
126
               GT ;
127
               IF {} { DUP 5 ; FAILWITH } ;
128
               DUP ;
129
               ITER { IF_LEFT
130
                        { IF_LEFT
131
                            { IF_LEFT
132
                                { PUSH nat 0 ;
133
                                  SWAP ;
134
                                  SIZE ;
135
                                  COMPARE ;
136
                                  GT ;
137
                                  IF {} { DUP 4 ; FAILWITH } }
138
                                { PUSH int 0 ; SWAP ; COMPARE ; GT ; IF {} { DUP 3 ; FAILWITH } } }
139
                            { IF_LEFT
140
                                { PUSH nat 0 ; SWAP ; COMPARE ; GT ; IF {} { DUP 6 ; FAILWITH } }
141
                                { DROP } } }
142
                        { IF_LEFT
143
                            { IF_LEFT
144
                                { CAR ;
145
                                  IF_NONE
146
                                    { PUSH bool False }
147
                                    { DROP ; PUSH bool True } ;
148
                                  IF {} { DUP 5 ; FAILWITH } }
149
                                { PUSH nat 0 ;
150
                                  SWAP ;
151
                                  SIZE ;
152
                                  COMPARE ;
153
                                  GT ;
154
                                  IF {} { DUP 4 ; FAILWITH } } }
155
                            { PUSH mutez 0 ;
156
                              SWAP ;
157
                              GET 4 ;
158
                              COMPARE ;
159
                              EQ ;
160
                              NOT ;
161
                              IF
162
                                {}
163
                                { PUSH string "Amount should be greater than zero" ;
164
                                  FAILWITH } } } } ;
165
               DIG 3 ;
166
               DIG 4 ;
167
               DROP 2 ;
168
               NONE (pair address timestamp) ;
169
               NOW ;
170
               SENDER ;
171
               PAIR ;
172
               EMPTY_MAP address bool ;
173
               UNIT ;
174
               LEFT unit ;
175
               RIGHT (or unit unit) ;
176
               PAIR 5 ;
177
               PUSH nat 1 ;
178
               DUP 3 ;
179
               CAR ;
180
               ADD ;
181
               DUP 3 ;
182
               DIG 3 ;
183
               GET 3 ;
184
               DUP 4 ;
185
               DUP 4 ;
186
               SWAP ;
187
               SOME ;
188
               SWAP ;
189
               UPDATE ;
190
               UPDATE 3 ;
191
               SWAP ;
192
               UPDATE 1 ;
193
               SWAP ;
194
               DUP 2 ;
195
               CAR ;
196
               PAIR ;
197
               EMIT %create_proposal (pair nat
198
                                           (or %state
199
                                             (or (unit %executed) (unit %expired))
200
                                             (or (unit %proposing) (unit %rejected)))
201
                                           (map %signatures address bool)
202
                                           (pair %proposer (address %actor)
203
                                                           (timestamp %timestamp))
204
                                           (option %resolver (pair (address %actor)
205
                                                                  (timestamp %timestamp)))
206
                                           (list %contents (or
207
                                                            (or
208
                                                              (or
209
                                                                (set %add_owners address)
210
                                                                (int %adjust_effective_period))
211
                                                              (or
212
                                                                (nat %adjust_threshold)
213
                                                                (pair %execute
214
                                                                  (address %target)
215
                                                                  (unit %parameter)
216
                                                                  (mutez %amount))))
217
                                                            (or
218
                                                              (or
219
                                                                (pair %execute_lambda
220
                                                                  (option %lambda (lambda
221
                                                                                   unit
222
                                                                                   operation))
223
                                                                  (option %metadata bytes))
224
                                                                (set %remove_owners address))
225
                                                              (pair %transfer
226
                                                                (address %target)
227
                                                                (unit %parameter)
228
                                                                (mutez %amount)))))) }
229
             { DIG 3 ;
230
               DIG 4 ;
231
               DIG 6 ;
232
               DROP 4 ;
233
               AMOUNT ;
234
               SENDER ;
235
               PAIR ;
236
               EMIT %receiving_tez (pair address mutez) } ;
237
           SWAP ;
238
           NIL operation }
239
         { DIG 5 ;
240
           DIG 6 ;
241
           DROP 2 ;
242
           IF_LEFT
243
             { UNPAIR ;
244
               DUP 3 ;
245
               GET 5 ;
246
               SENDER ;
247
               MEM ;
248
               IF { DIG 9 ; DROP } { DIG 9 ; FAILWITH } ;
249
               AMOUNT ;
250
               PUSH mutez 0 ;
251
               SWAP ;
252
               COMPARE ;
253
               EQ ;
254
               IF
255
                 {}
256
                 { PUSH string "You must not send tez to the smart contract" ; FAILWITH } ;
257
               DUP 3 ;
258
               GET 3 ;
259
               DUP 2 ;
260
               GET ;
261
               IF_NONE { DIG 8 ; FAILWITH } { DIG 9 ; DROP } ;
262
               UNIT ;
263
               LEFT unit ;
264
               RIGHT (or unit unit) ;
265
               DUP 2 ;
266
               CAR ;
267
               COMPARE ;
268
               EQ ;
269
               IF {} { PUSH string "This proposal has been resolved" ; FAILWITH } ;
270
               DIG 2 ;
271
               PACK ;
272
               DUP 2 ;
273
               GET 8 ;
274
               PACK ;
275
               SWAP ;
276
               COMPARE ;
277
               EQ ;
278
               IF { DIG 5 ; DROP } { DIG 5 ; FAILWITH } ;
279
               SENDER ;
280
               DUP 4 ;
281
               GET 9 ;
282
               DUP 3 ;
283
               GET 5 ;
284
               CDR ;
285
               ADD ;
286
               DUP 5 ;
287
               GET 5 ;
288
               DUP 6 ;
289
               GET 7 ;
290
               NOW ;
291
               DIG 3 ;
292
               COMPARE ;
293
               LT ;
294
               IF
295
                 { DIG 3 ;
296
                   UNIT ;
297
                   RIGHT unit ;
298
                   LEFT (or unit unit) ;
299
                   UPDATE 1 ;
300
                   NOW ;
301
                   SENDER ;
302
                   PAIR ;
303
                   SOME ;
304
                   UPDATE 7 }
305
                 { DIG 3 } ;
306
               UNIT ;
307
               RIGHT unit ;
308
               LEFT (or unit unit) ;
309
               DUP 2 ;
310
               CAR ;
311
               COMPARE ;
312
               EQ ;
313
               IF
314
                 { SWAP ; DIG 2 ; DROP 2 }
315
                 { DUP ;
316
                   EMPTY_MAP address bool ;
317
                   DUP 5 ;
318
                   ITER { SWAP ;
319
                          DUP 4 ;
320
                          GET 3 ;
321
                          DUP 3 ;
322
                          GET ;
323
                          IF_NONE
324
                            { SWAP ; DROP }
325
                            { DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } } ;
326
                   DIG 2 ;
327
                   DROP ;
328
                   UPDATE 3 ;
329
                   PUSH nat 0 ;
330
                   PUSH nat 0 ;
331
                   PAIR ;
332
                   DUP 2 ;
333
                   GET 3 ;
334
                   ITER { SWAP ;
335
                          UNPAIR ;
336
                          DIG 2 ;
337
                          CDR ;
338
                          IF
339
                            { SWAP ; PUSH nat 1 ; DIG 2 ; ADD }
340
                            { PUSH nat 1 ; DIG 2 ; ADD ; SWAP } ;
341
                          PAIR } ;
342
                   UNPAIR ;
343
                   UNIT ;
344
                   LEFT unit ;
345
                   RIGHT (or unit unit) ;
346
                   DUP 4 ;
347
                   CAR ;
348
                   COMPARE ;
349
                   EQ ;
350
                   DUP 5 ;
351
                   DIG 2 ;
352
                   COMPARE ;
353
                   GE ;
354
                   AND ;
355
                   IF
356
                     { SWAP ;
357
                       UNIT ;
358
                       LEFT unit ;
359
                       LEFT (or unit unit) ;
360
                       UPDATE 1 ;
361
                       NOW ;
362
                       SENDER ;
363
                       PAIR ;
364
                       SOME ;
365
                       UPDATE 7 }
366
                     { SWAP } ;
367
                   DIG 2 ;
368
                   DIG 3 ;
369
                   SIZE ;
370
                   SUB ;
371
                   ABS ;
372
                   DUG 2 ;
373
                   UNIT ;
374
                   LEFT unit ;
375
                   RIGHT (or unit unit) ;
376
                   DUP 2 ;
377
                   CAR ;
378
                   COMPARE ;
379
                   EQ ;
380
                   DIG 3 ;
381
                   DIG 3 ;
382
                   COMPARE ;
383
                   GT ;
384
                   AND ;
385
                   IF
386
                     { UNIT ;
387
                       RIGHT unit ;
388
                       RIGHT (or unit unit) ;
389
                       UPDATE 1 ;
390
                       NOW ;
391
                       SENDER ;
392
                       PAIR ;
393
                       SOME ;
394
                       UPDATE 7 }
395
                     {} } ;
396
               UNIT ;
397
               LEFT unit ;
398
               RIGHT (or unit unit) ;
399
               DUP 2 ;
400
               CAR ;
401
               COMPARE ;
402
               EQ ;
403
               NOT ;
404
               IF
405
                 {}
406
                 { PUSH string "No enough signature to resolve the proposal" ; FAILWITH } ;
407
               DUP 4 ;
408
               DIG 4 ;
409
               GET 3 ;
410
               DUP 3 ;
411
               SOME ;
412
               DUP 6 ;
413
               UPDATE ;
414
               UPDATE 3 ;
415
               DUP 2 ;
416
               CAR ;
417
               IF_LEFT
418
                 { IF_LEFT
419
                     { DROP ;
420
                       NIL (or
421
                             (or (or (set address) int)
422
                                 (or nat (pair address unit mutez)))
423
                             (or
424
                               (or
425
                                 (pair (option (lambda unit operation)) (option bytes))
426
                                 (set address))
427
                               (pair address unit mutez))) ;
428
                       DIG 5 ;
429
                       PAIR ;
430
                       PAIR ;
431
                       DUP 2 ;
432
                       GET 8 ;
433
                       ITER { SWAP ;
434
                              UNPAIR ;
435
                              UNPAIR ;
436
                              DUP 4 ;
437
                              IF_LEFT
438
                                { IF_LEFT
439
                                    { IF_LEFT
440
                                        { DUP 4 ;
441
                                          DIG 4 ;
442
                                          GET 5 ;
443
                                          DIG 2 ;
444
                                          ITER { PUSH bool True ; SWAP ; UPDATE } ;
445
                                          UPDATE 5 }
446
                                        { DIG 3 ; SWAP ; UPDATE 9 } ;
447
                                      DIG 3 ;
448
                                      NONE operation }
449
                                    { IF_LEFT
450
                                        { DIG 3 ; SWAP ; UPDATE 7 ; DIG 3 ; NONE operation }
451
                                        { DIG 3 ;
452
                                          DIG 4 ;
453
                                          DUP 3 ;
454
                                          CAR ;
455
                                          CONTRACT unit ;
456
                                          IF_NONE { DUP 11 ; FAILWITH } {} ;
457
                                          DUP 4 ;
458
                                          GET 4 ;
459
                                          DIG 4 ;
460
                                          GET 3 ;
461
                                          TRANSFER_TOKENS ;
462
                                          SOME } } }
463
                                { IF_LEFT
464
                                    { IF_LEFT
465
                                        { DIG 4 ;
466
                                          DROP ;
467
                                          DUP ;
468
                                          CDR ;
469
                                          NONE (lambda unit operation) ;
470
                                          PAIR ;
471
                                          LEFT (set address) ;
472
                                          LEFT (pair address unit mutez) ;
473
                                          RIGHT (or (or (set address) int)
474
                                                    (or nat (pair address unit mutez))) ;
475
                                          DIG 4 ;
476
                                          SWAP ;
477
                                          DIG 2 ;
478
                                          CAR ;
479
                                          MAP { UNIT ; EXEC } }
480
                                        { DUP 4 ;
481
                                          DIG 4 ;
482
                                          GET 5 ;
483
                                          DIG 2 ;
484
                                          ITER { PUSH bool False ; SWAP ; UPDATE } ;
485
                                          UPDATE 5 ;
486
                                          DIG 3 ;
487
                                          NONE operation } }
488
                                    { DIG 3 ;
489
                                      DIG 4 ;
490
                                      DUP 3 ;
491
                                      CAR ;
492
                                      CONTRACT unit ;
493
                                      IF_NONE { DUP 11 ; FAILWITH } {} ;
494
                                      DUP 4 ;
495
                                      GET 4 ;
496
                                      DIG 4 ;
497
                                      GET 3 ;
498
                                      TRANSFER_TOKENS ;
499
                                      SOME } } ;
500
                              IF_NONE
501
                                { SWAP ; DIG 3 ; DIG 2 ; CONS ; DIG 2 }
502
                                { DIG 2 ; DIG 4 ; DIG 3 ; CONS ; DIG 3 ; DIG 3 ; CONS } ;
503
                              PAIR ;
504
                              PAIR } ;
505
                       DIG 6 ;
506
                       DROP ;
507
                       UNPAIR ;
508
                       UNPAIR ;
509
                       NIL operation ;
510
                       SWAP ;
511
                       ITER { CONS } ;
512
                       NIL (or
513
                             (or (or (set address) int)
514
                                 (or nat (pair address unit mutez)))
515
                             (or
516
                               (or
517
                                 (pair (option (lambda unit operation)) (option bytes))
518
                                 (set address))
519
                               (pair address unit mutez))) ;
520
                       DIG 2 ;
521
                       ITER { CONS } ;
522
                       DIG 2 ;
523
                       DIG 3 ;
524
                       DIG 2 ;
525
                       UPDATE 8 ;
526
                       DIG 2 }
527
                     { DIG 8 ;
528
                       DROP 2 ;
529
                       DUP 2 ;
530
                       DIG 2 ;
531
                       GET 8 ;
532
                       MAP { DUP ;
533
                             IF_LEFT
534
                               { IF_LEFT
535
                                   { IF_LEFT { DROP } { DROP } }
536
                                   { IF_LEFT { DROP } { DROP } } }
537
                               { IF_LEFT
538
                                   { IF_LEFT
539
                                       { SWAP ;
540
                                         DROP ;
541
                                         CDR ;
542
                                         NONE (lambda unit operation) ;
543
                                         PAIR ;
544
                                         LEFT (set address) ;
545
                                         LEFT (pair address unit mutez) ;
546
                                         RIGHT (or (or (set address) int)
547
                                                   (or nat (pair address unit mutez))) }
548
                                       { DROP } }
549
                                   { DROP } } } ;
550
                       UPDATE 8 ;
551
                       DIG 4 } }
552
                 { DIG 8 ;
553
                   DROP ;
554
                   IF_LEFT
555
                     { DROP }
556
                     { DROP ;
557
                       DUP 2 ;
558
                       DIG 2 ;
559
                       GET 8 ;
560
                       MAP { DUP ;
561
                             IF_LEFT
562
                               { IF_LEFT
563
                                   { IF_LEFT { DROP } { DROP } }
564
                                   { IF_LEFT { DROP } { DROP } } }
565
                               { IF_LEFT
566
                                   { IF_LEFT
567
                                       { SWAP ;
568
                                         DROP ;
569
                                         CDR ;
570
                                         NONE (lambda unit operation) ;
571
                                         PAIR ;
572
                                         LEFT (set address) ;
573
                                         LEFT (pair address unit mutez) ;
574
                                         RIGHT (or (or (set address) int)
575
                                                   (or nat (pair address unit mutez))) }
576
                                       { DROP } }
577
                                   { DROP } } } ;
578
                       UPDATE 8 ;
579
                       SWAP } ;
580
                   SWAP ;
581
                   DIG 4 } ;
582
               DIG 3 ;
583
               DUP 5 ;
584
               PAIR ;
585
               EMIT %resolve_proposal (pair nat address) ;
586
               DUP 4 ;
587
               DIG 4 ;
588
               GET 3 ;
589
               DIG 4 ;
590
               SOME ;
591
               DIG 5 ;
592
               UPDATE ;
593
               UPDATE 3 ;
594
               DIG 2 }
595
             { DIG 2 ;
596
               DIG 6 ;
597
               DROP 2 ;
598
               UNPAIR ;
599
               UNPAIR ;
600
               DUP 4 ;
601
               GET 5 ;
602
               SENDER ;
603
               MEM ;
604
               IF { DIG 8 ; DROP } { DIG 8 ; FAILWITH } ;
605
               AMOUNT ;
606
               PUSH mutez 0 ;
607
               SWAP ;
608
               COMPARE ;
609
               EQ ;
610
               IF
611
                 {}
612
                 { PUSH string "You must not send tez to the smart contract" ; FAILWITH } ;
613
               DUP 4 ;
614
               GET 3 ;
615
               DUP 2 ;
616
               GET ;
617
               IF_NONE { DIG 7 ; FAILWITH } { DIG 8 ; DROP } ;
618
               UNIT ;
619
               LEFT unit ;
620
               RIGHT (or unit unit) ;
621
               DUP 2 ;
622
               CAR ;
623
               COMPARE ;
624
               EQ ;
625
               IF {} { PUSH string "This proposal has been resolved" ; FAILWITH } ;
626
               DUP ;
627
               GET 3 ;
628
               SENDER ;
629
               MEM ;
630
               NOT ;
631
               IF
632
                 {}
633
                 { PUSH string "You have already signed this proposal" ; FAILWITH } ;
634
               NOW ;
635
               DUP 6 ;
636
               GET 9 ;
637
               DUP 3 ;
638
               GET 5 ;
639
               CDR ;
640
               ADD ;
641
               COMPARE ;
642
               GT ;
643
               IF
644
                 {}
645
                 { PUSH string "The proposal has passed its expiration time" ; FAILWITH } ;
646
               DIG 2 ;
647
               PACK ;
648
               DUP 2 ;
649
               GET 8 ;
650
               PACK ;
651
               SWAP ;
652
               COMPARE ;
653
               EQ ;
654
               IF { DIG 5 ; DROP } { DIG 5 ; FAILWITH } ;
655
               SENDER ;
656
               DUP 4 ;
657
               DUP 2 ;
658
               DUP 5 ;
659
               PAIR ;
660
               PAIR ;
661
               EMIT %sign_proposal (pair (pair nat address) bool) ;
662
               DUP 6 ;
663
               DIG 6 ;
664
               GET 3 ;
665
               DUP 5 ;
666
               DIG 5 ;
667
               GET 3 ;
668
               DIG 7 ;
669
               SOME ;
670
               DIG 6 ;
671
               UPDATE ;
672
               UPDATE 3 ;
673
               SOME ;
674
               DIG 4 ;
675
               UPDATE ;
676
               UPDATE 3 ;
677
               NIL operation } } ;
678
       DIG 2 ;
679
       CONS ;
680
       PUSH nat 0 ;
681
       DUP 3 ;
682
       GET 5 ;
683
       SIZE ;
684
       COMPARE ;
685
       GT ;
686
       IF {} { PUSH string "Require at least one owner in the contract" ; FAILWITH } ;
687
       DUP 2 ;
688
       GET 7 ;
689
       DUP 3 ;
690
       GET 5 ;
691
       SIZE ;
692
       COMPARE ;
693
       GE ;
694
       IF
695
         {}
696
         { PUSH string "Number of owner should be greater than threshold" ; FAILWITH } ;
697
       PUSH nat 0 ;
698
       DUP 3 ;
699
       GET 7 ;
700
       COMPARE ;
701
       GT ;
702
       IF { DIG 3 ; DROP } { DIG 3 ; FAILWITH } ;
703
       PUSH int 0 ;
704
       DUP 3 ;
705
       GET 9 ;
706
       COMPARE ;
707
       GT ;
708
       IF { DIG 2 ; DROP } { DIG 2 ; FAILWITH } ;
709
       PAIR }