ligo/src/bin_client/test/contracts/vote_for_delegate.tz

30 lines
966 B
Plaintext
Raw Normal View History

2018-04-21 00:21:50 +02:00
parameter (option key_hash) ;
storage (pair
(pair %mgr1 (address %addr) (option key_hash))
(pair %mgr2 (address %addr) (option key_hash))) ;
2018-04-21 00:21:50 +02:00
code { # Update the storage
DUP ; CDAAR %addr @%; SOURCE ; PAIR %@ %@; UNPAIR;
2018-04-21 00:21:50 +02:00
IFCMPEQ
{ UNPAIR ; SWAP ; SET_CADR }
{ DUP ; CDDAR ; SOURCE ;
IFCMPEQ
{ UNPAIR ; SWAP ; SET_CDDR }
{ FAIL } } ;
# Now compare the proposals
DUP ; CADR ;
DIP { DUP ; CDDR } ;
IF_NONE
{ IF_NONE
{ NONE key_hash ;
SET_DELEGATE ; NIL operation ; SWAP ; CONS }
{ DROP ; NIL operation } }
{ SWAP ;
IF_SOME
{ DIP { DUP } ;
IFCMPEQ
{ SOME ;
SET_DELEGATE ; NIL operation ; SWAP ; CONS }
{ DROP ;
NIL operation }}
{ DROP ; NIL operation }} ;
PAIR }