timer_callback

timer_callback | code​

1
/**
2
* LiquidScheduler uses the timer_callback to run the cron logic within the consumer contract
3
*
4
* @param {name} timer - account name to scope the timer within
5
* @param {std::vector<char>} payload - payload to be accessed within the timer_callback function in the consumer contract
6
* @param {uint32_t} seconds - seconds to repeat the cron
7
*
8
* Notes
9
* - can return true to create an infinite loop, false breaks the loop
10
*
11
* Example:
12
*
13
* @code
14
* bool timer_callback(name timer, std::vector<char> payload, uint32_t seconds){
15
* stats_def statstable(_self, _self.value);
16
* stat newstats;
17
* if(!statstable.exists()){
18
* statstable.set(newstats, _self);
19
* }
20
* else {
21
* newstats = statstable.get();
22
* }
23
* newstats.counter++;
24
* statstable.set(newstats, _self);
25
* return (newstats.counter < 10);
26
* }
27
* @endcode
28
*/
Copied!
Last modified 4mo ago
Copy link