7

Is it possible to schedule an action defined within a contract to be automatically executed at a specific timestamp or block? I know it's possible to get a timestamp inside of a contract but, I'm not sure how a scheduled action could be implemented.

In order to make my question a little bit clearer, I'll provide an example of what I'm after:

A company would like to do a crowd sale of some utility tokens for a service they have, that token sale can either end exactly 30 days or (30 * 86400) seconds. That same company would also like an action to automatically be ran whenever that 30 day time limit is hit, in order to distribute it's tokens to the people who've purchased them. They would like to avoid having to call this action manually, or create an external script to call this action.

Is it possible for something like this scheduled action to be implemented without the contract owner manually having to call it? And if so what's a possible implementation and best practice to work with scheduled actions, timestamp or block number?

5

Yes, you can do that. It's handled by the delay_sec property of the transaction structure. Check this answer: https://eosio.stackexchange.com/a/389/54

If you are using EOSRPC or inside the contract code, just change the delay_sec.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.