ligo/test/contracts/lockup.tz

19 lines
1.1 KiB
Plaintext
Raw Normal View History

parameter unit;
storage (pair timestamp (pair tez (contract unit unit)));
return unit;
code { CDR; # Ignore the parameter
DUP; # Duplicate the storage
CAR; # Get the timestamp
NOW; # Push the current timestamp
CMPLT; # Compare to the current time
IF {FAIL} {}; # Fail if it is too soon
DUP; # Duplicate the storage value
# this must be on the bottom of the stack for us to call transfer tokens
CDR; # Ignore the timestamp, focussing in on the tranfser data
DUP; # Duplicate the transfer information
CAR; # Get the amount of the transfer on top of the stack
DIP{CDR}; # Put the contract underneath it
UNIT; # Put the contract's argument type on top of the stack
TRANSFER_TOKENS; # Make the transfer
PAIR} # Pair up to meet the calling convention