Revision 222330dc62b50df603a7efba2c15f1da9ddc84dc authored by Killian Delarue on 19 September 2023, 08:59:38 UTC, committed by Killian Delarue on 19 September 2023, 08:59:38 UTC
Approved-by: Arvid Jakobsson <arvid.jakobsson@nomadic-labs.com> Approved-by: Raphaƫl Proust <code@bnwr.net> See merge request https://gitlab.com/tezos/tezos/-/merge_requests/10153
king_of_tez.tz
parameter key_hash;
storage (pair timestamp (pair mutez key_hash));
code { DUP; CDAR;
# If the time is more than 2 weeks, any amount makes you king
NOW; CMPGT;
# User becomes king of mutez
IF { CAR; AMOUNT; PAIR; NOW; PUSH int 604800; ADD; PAIR;
NIL operation }
# Check balance to see if user has paid enough to become the new king
{ DUP; CDDAR; AMOUNT; CMPLT;
IF { FAIL } # user has not paid out
{ CAR; DUP;
# New storage
DIP{ AMOUNT; PAIR; NOW; PUSH int 604800; ADD; PAIR };
# Pay funds to old king
IMPLICIT_ACCOUNT; AMOUNT; UNIT; TRANSFER_TOKENS;
NIL operation; SWAP; CONS}};
# Cleanup
PAIR };
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...