You can execute recurrent calls using Ethereum alarm clock. The gracePeriod
that is described in the links that you provide indicates how many blocks you will allow the executor to be delayed (maximum). That is, assume you want something to be executed in block x
, the gracePeriod
indicates that you are Ok with your call being executed at any block between x
and x + gracePeriod
. After x + gracePeriod
is considered to late and the call will not be executed.
So it will work.
On the other side, you have alternatives to EAC, that are less expensive in gas (an ether transaction is about 500K gas in EAC, which is now rebuilt by Chronologic) and also Aion hs fixed fees. The Aion scheduling system has fees of about 10 cents od dollar per call, the first call you do is about 250Kgas and after that, the cost for a call goes as low as 70K (5x less that EAC). This is because the system creates accounts for the users. You can test it on ropsten.
This code shows how to set up a recurrent call (every day) using Aion Scheduling system:
pragma solidity ^0.4.24;
// interface Aion
contract Aion {
uint256 public serviceFee;
function ScheduleCall(uint256 blocknumber, address to, uint256 value, uint256 gaslimit, uint256 gasprice, bytes data, bool schedType) public payable returns (uint,address);
}
// Main contract
contract MyContract{
uint256 public sqrtValue;
Aion aion;
constructor(uint256 number) public payable{
scheduleMyfucntion(number);
}
function scheduleMyfucntion(uint256 number) public {
aion = Aion(0xFcFB45679539667f7ed55FA59A15c8Cad73d9a4E);
bytes memory data = abi.encodeWithSelector(bytes4(keccak256('myfucntion(uint256)')),number);
uint callCost = 200000*1e9 + aion.serviceFee();
aion.ScheduleCall.value(callCost)( block.timestamp + 1 days, address(this), 0, 200000, 1e9, data, true);
}
function myfucntion(uint256 number) public {
// do your task here and call again the function to schedule
scheduleMyfucntion(number);
}
function () public payable {}
}
You can find more details here and here
Hope this helps.