Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/What's the best way to assert a deadline or expiry date on a choice?Forum ↗

What's the best way to assert a deadline or expiry date on a choice?

App Development4 posts299 viewsLast activity Feb 2023
LA
lashenhurstOP
Feb 2023

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!

CO
cocreature
Feb 2023

Does getTime and 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

LA
lashenhurst
Feb 2023

For some reason I thought getTime only worked in Scripts!

WA
WallaceKelly
Feb 2023

There might be a relevant example here in the docs. The code snippet for the Redeem choice includes both the choice code and scripts for testing. Notice that setTime and passTime can be used in the testing script.

← Back to Discussions