What's the best way to assert a deadline or expiry date on a choice?
- lashenhurstOP
Hi all,
I’m looking to ensure that certain choices cannot be executed after a given timestamp, and I’m finding trouble where the only way to implement this is where the choice controller provides their timestamp for when they are executing the choice, which is flawed for multiple reasons.
Is there any better way to do this? Or will I be reliant on a Trigger, or developing some custom service of my own, to lock the contract (or similar) at a certain time?
Thanks in advance!
- cocreature
Does
getTimeand an assertion against that not work for you? While the exact time there is set by the submitter it must be within a skew interval or it will get rejected during validaton. Take a look at the docs for more details - lashenhurst
For some reason I thought
getTimeonly worked in Scripts! - WallaceKelly
There might be a relevant example here in the docs. The code snippet for the
Redeemchoice includes both the choice code and scripts for testing. Notice thatsetTimeandpassTimecan be used in the testing script.