https://gitlab.com/tezos/tezos
Raw File
Tip revision: 8ae938fc50854f9df7a7427520cb4359a8766110 authored by Ole Krüger on 18 January 2023, 11:56:20 UTC
Test/Tezt: Migrate from Mumbai
Tip revision: 8ae938f
timelock.tz
# This contract takes a chest and chest key as parameter.
# It tries to open it and stores the resulting bytes if successful.
# Otherwise it stores some hardcoded bytes to test that we are in
# the expected branch
storage (bytes);
parameter (pair (chest_key) (chest));
code {
       UNPAIR;
       DIP {DROP};
       UNPAIR;
       DIIP {PUSH nat 1000};
       OPEN_CHEST;
       IF_LEFT
         { # successful case
           NIL operation;
           PAIR ;
         }
         {
           IF
             { # first type of failure
               PUSH bytes 0x01;
               NIL operation;
               PAIR;
             }
             { # second type of failure
               PUSH bytes 0x00;
               NIL operation;
               PAIR;
             }
         }
     }
back to top