ligo/test/contracts/auction.tz

10 lines
574 B
Plaintext

parameter key_hash;
storage (pair timestamp (pair tez key_hash));
return unit;
code { DUP; CDAR; DUP; NOW; CMPGT; IF {FAIL} {}; SWAP; # Check if auction has ended
DUP; CAR; DIP{CDDR}; AMOUNT; PAIR; SWAP; DIP{SWAP; PAIR}; # Setup replacement storage
DUP; CAR; AMOUNT; CMPLE; IF {FAIL} {}; # Check to make sure that the new amount is greater
DUP; CAR; # Get amount of refund
DIP{CDR; DEFAULT_ACCOUNT}; UNIT; TRANSFER_TOKENS; # Make refund
PAIR} # Calling convention