ligo/src/bin_client/test/contracts/vote_for_delegate.tz
2018-06-14 18:09:32 +02:00

30 lines
966 B
Plaintext

parameter (option key_hash) ;
storage (pair
(pair %mgr1 (address %addr) (option key_hash))
(pair %mgr2 (address %addr) (option key_hash))) ;
code { # Update the storage
DUP ; CDAAR %addr @%; SOURCE ; PAIR %@ %@; UNPAIR;
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 }