BCD

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