Use On-chain Scheduler
min_delayis minimum number of blocks after current blocks before the scheduled call will be called. i.e. Pass 0 means it will be scheduled to be called on next block. Calling
min_delay = 5on block 10 will scheduled the call on block
10 + 1 + 5 = 16. If the block are full or there are too many other scheduled tasks, the scheduled call could be deferred to later blocks until there is enough remaining spaces in the block.
ScheduleCall contract address:
// Schedule call the contract.
// Returns the task_address(block_number, index).
address contract_address, // The contract address to be called in future.
uint256 value, // How much native token to send alone with the call.
uint256 gas_limit, // The gas limit for the call. Corresponding fee will be reserved upfront and refunded after call.
uint256 storage_limit, // The storage limit for the call. Corresponding fee will be reserved upfront and refunded after call.
uint256 min_delay, // Minimum number of blocks before the scheduled call will be called.
bytes memory input_data // The input data to the call.
returns (uint256, uint256); // Returns a task id that can be used to cancel or reschedule call.
Follow this tutorial to write and deploy a basic automatic subscription contract on Acala EVM.