manager.tz 654 Bytes
Newer Older
1
parameter
2
  (or
3 4
     (lambda %do unit (list operation))
     (unit %default));
5
storage key_hash;
6 7 8
code
  { UNPAIR ;
    IF_LEFT
9 10 11 12 13 14 15 16 17 18
      { # 'do' entrypoint
        # Assert no token was sent:
        # to send tokens, the default entry point should be used
        PUSH mutez 0 ;
        AMOUNT ;
        ASSERT_CMPEQ ;
        # Assert that the sender is the manager
        DUUP ;
        IMPLICIT_ACCOUNT ;
        ADDRESS ;
19
        SENDER ;
20 21 22 23 24 25 26 27 28 29 30 31
        ASSERT_CMPEQ ;
        # Execute the lambda argument
        UNIT ;
        EXEC ;
        PAIR ;
      }
      { # 'default' entrypoint
        DROP ;
        NIL operation ;
        PAIR ;
      }
  };