Skip to content
CCPEDIAby Unity Nodes
App Development

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

4 posts352 viewsLast activity Feb 2023

  1. 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!

  2. cocreature

    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

  3. lashenhurst

    For some reason I thought getTime only worked in Scripts!

  4. WallaceKelly

    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.