Gelato is a tool for developers to automate smart contract executions on Ethereum.
// Define a Condition => When the transaction should execute
const condition = new Condition({
inst: conditionTimeStateful.address, // condition address
data: conditionData, // e.g. every 5 minutes
});
// Define an action => What that transaction should do
const action = new Action({
addr: uniswapTrade.address, // action address
data: uniswapTradeData, // data defining trade
operation: Operation.Delegatecall
});
// Combine condition + action to a task
const task = new Task({
conditions: [condition],
actions: [action]
});
// Define who will pay for the transaction,
// the user directly or the developer
const gelatoProvider = new GelatoProvider({
addr: provider.address,
module: gelatoUserProxyProviderModule.address,
});
// Submit transaction to gelato and it will
// be executed when the condition is fulfilled
await gelatoCore.submitTask(gelatoProvider, task, 0)