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.
_createTask()
_createTask()
Interacts and creates a task on the Gelato Automate smart contract.
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
- Useaddress(0)
if using Gelato balance. Use 0xeeeeee... for ETH or native tokens.
ModuleData
Modules are conditions / specifications about your task. These are the current available Modules.
RESOLVER
- Define dynamic conditions and execution data. Smart Contract ResolversTIME
- Repeated execution at a specific time and interval.PROXY
- Your function will be called by a dedicatedmsg.sender
.Dedicated msg.senderSINGLE_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.
Crafting ModuleData
will look like this if we want to create a task which utilise RESOLVER
,PROXY
& SINGLE_EXEC
Module.
Module[]
must follow the order RESOLVER
, TIME
, PROXY
, SINGLE_EXEC
_cancelTask()
_cancelTask()
Cancels a task owned by the smart contract.
onlyDedicatedMsgSender
onlyDedicatedMsgSender
Function modifier to restrict msg.sender
to only task executions created by taskCreator
(defined in constructor). Dedicated msg.sender
PROXY
module must be enabled. Or else the msg.sender will be the Automate smart contract in Contract Addresses
_depositFunds()
_depositFunds()
Deposit funds into the contract's Gelato balance.
withdrawFunds()
withdrawFunds()
Withdraw funds from the contract's Gelato balance. Only fundsOwner
defined in the constructor can call this function.
Last updated