Introduction
# King of Tez Contract
# Define a constant for ONEWEEK in seconds
const int ONEWEEK 604800;
# Define an object King
struct King(
timestamp end,
mutez bounty,
address owner);
# Declare a storage variable king of type King (the object we created)
storage King king;
# Entry point for this script
entry contend(){
assert(storage.king.end < NOW || AMOUNT > storage.king.bounty);
let address oldKing = storage.king.owner;
storage.king = new King(add(NOW, ONEWEEK), AMOUNT, SENDER);
transfer(oldKing, AMOUNT);
}Compiling to Michelson
Last updated
Was this helpful?