Add rough draft of repeating timelock contract

This commit is contained in:
John David Pressman 2020-01-22 03:01:21 -08:00
parent c8ea510f18
commit 9781a1c8ff

View File

@ -0,0 +1,20 @@
type storage = {
last_use: timestamp;
interval: int;
execute: unit -> operation list;
}
let main (p,s: unit * storage) : operation list * storage =
if Current.time > (s.last_use + s.interval)
then
let s: storage = {
last_use = Current.time;
interval = s.interval;
execute = s.execute;
}
in
(s.execute (), s)
else
(* TODO: Add the time until next use to this message *)
(failwith "You have to wait before you can execute this contract again.":
operation list * storage)