Gelato Network

Smart Contract

Using Automate programatically
Tasks created via this route cannot be named
Smart Contracts can also create and cancel tasks on Gelato Automate.
You can find a list of example smart contracts here.

AutomateTaskCreator functions

Here are the functions exposed by AutomateTaskCreator which you can use when setting up your smart contract.


Interacts and creates a task on the Gelato Automate smart contract.
function _createTask(
address execAddress,
bytes memory execDataOrSelector,
ModuleData memory moduleData,
address feeToken
) internal returns (bytes32 taskId);
  • execAddress - Address of the contract which Gelato will call.
  • execDataOrSelector - Signature of function which Gelato will call / execution data (If Resolver Module is not used. More about modules below)
  • moduleData - Modules that are enabled for the task. (More about ModuleData below)
  • feeToken - Use address(0) if using Gelato balance. Use 0xeeeeee... for ETH or native tokens.


struct ModuleData {
Module[] modules;
bytes[] args;
Modules are conditions / specifications about your task. These are the current available Modules.
enum Module {
  • RESOLVER - Define dynamic conditions and execution data. Smart Contract Resolvers
  • TIME - Repeated execution at a specific time and interval.
  • PROXY - Your function will be called by a dedicated msg.sender.Dedicated msg.sender
  • SINGLE_EXEC - Task is cancelled after one execution.
Each Module would require additional arguments which is an encoded data.
You can use these helper functions to get the arguments for each Module.
function _resolverModuleArg(address _resolverAddress, bytes memory _resolverData)
function _timeModuleArg(uint256 _startTime, uint256 _interval)
function _proxyModuleArg()
function _singleExecModuleArg()
Crafting ModuleData will look like this if we want to create a task which utilise RESOLVER ,PROXY & SINGLE_EXEC Module.
ModuleData memory moduleData = ModuleData({
modules: new Module[](3),
args: new bytes[](3)
moduleData.modules[0] = Module.RESOLVER;
moduleData.modules[1] = Module.PROXY;
moduleData.modules[2] = Module.SINGLE_EXEC
moduleData.args[0] = _resolverModuleArg(
abi.encodeCall(this.checker, ())
moduleData.args[1] = _proxyModuleArg();
moduleData.args[2] = _singleExecModuleArg();
Module[] must follow the order RESOLVER, TIME, PROXY, SINGLE_EXEC


Cancels a task owned by the smart contract.
function _cancelTask(bytes32 _taskId) internal


Function modifier to restrict msg.sender to only task executions created by taskCreator (defined in constructor). Dedicated msg.sender
modifier onlyDedicatedMsgSender() {
require(msg.sender == dedicatedMsgSender, "Only dedicated msg.sender");
PROXY module must be enabled. Or else the msg.sender will be the Automate smart contract in Contract Addresses


function _depositFunds(uint256 _amount, address _token) internal
Deposit funds into the contract's Gelato balance.


function withdrawFunds(uint256 _amount, address _token) external
Withdraw funds from the contract's Gelato balance. Only fundsOwner defined in the constructor can call this function.