Skip to content
Lattice

IGelatoAutomateAdapter

Git Source

Title: IGelatoAutomateAdapter

Author: Modified from Gelato (https://github.com/gelatodigital/automate)

Interface for the GelatoAutomateAdapter Diamond facet — Gelato Automate (Web3 Functions) task management. Establishes the automation/keeper family.

Lets a Diamond create, track, and cancel Gelato Automate tasks. Gelato executes a task through a task-creator-specific dedicated msg.sender; consumer exec entrypoints must gate on it via the library's requireDedicatedMsgSender guard. Task creation/cancellation are admin-gated.

Functions

getConfig

Returns the current Automate configuration.

function getConfig() external view returns (address automate, address dedicatedMsgSender);

Returns

NameTypeDescription
automateaddressThe Gelato Automate contract.
dedicatedMsgSenderaddressThe dedicated msg.sender Gelato execs through.

isTask

Returns whether taskId is tracked by this adapter.

function isTask(bytes32 taskId) external view returns (bool);

Parameters

NameTypeDescription
taskIdbytes32The task ID to query.

Returns

NameTypeDescription
<none>bool

setConfig

Sets or replaces the Automate configuration.

Caller must hold DEFAULT_ADMIN_ROLE. Reverts GelatoAutomateInvalidConfig on a zero field.

function setConfig(address automate, address dedicatedMsgSender) external;

Parameters

NameTypeDescription
automateaddressThe Gelato Automate contract.
dedicatedMsgSenderaddressThe dedicated msg.sender Gelato execs through (derived off-chain via
the OpsProxyFactory for this diamond).

createTask

Creates and tracks a Gelato Automate task.

Caller must hold DEFAULT_ADMIN_ROLE.

function createTask(
        address execAddress,
        bytes calldata execDataOrSelector,
        IGelatoAutomate.ModuleData calldata moduleData,
        address feeToken
    ) external returns (bytes32 taskId);

Parameters

NameTypeDescription
execAddressaddressThe contract Gelato will call when the task runs.
execDataOrSelectorbytesThe calldata (or selector) to run.
moduleDataIGelatoAutomate.ModuleDataThe modules configuring how/when the task triggers.
feeTokenaddressThe fee token (address(0) for native; off-chain via 1Balance otherwise).

Returns

NameTypeDescription
taskIdbytes32The Automate-assigned task ID.

cancelTask

Cancels and untracks a Gelato Automate task.

Caller must hold DEFAULT_ADMIN_ROLE. Reverts GelatoAutomateTaskNotFound if untracked.

function cancelTask(bytes32 taskId) external;

Parameters

NameTypeDescription
taskIdbytes32The task to cancel.

Events

GelatoAutomateConfigSet

Emitted when the Automate configuration is updated.

event GelatoAutomateConfigSet(address automate, address dedicatedMsgSender);

Parameters

NameTypeDescription
automateaddressThe Gelato Automate contract.
dedicatedMsgSenderaddressThe dedicated msg.sender Gelato execs through.

TaskCreated

Emitted when a task is created.

event TaskCreated(bytes32 indexed taskId, address execAddress);

Parameters

NameTypeDescription
taskIdbytes32The Automate-assigned task ID.
execAddressaddressThe contract Gelato will call when the task runs.

TaskCancelled

Emitted when a task is cancelled.

event TaskCancelled(bytes32 indexed taskId);

Parameters

NameTypeDescription
taskIdbytes32The cancelled task ID.

Errors

GelatoAutomateNotConfigured

Automate has not been configured (automate or dedicatedMsgSender is zero).

error GelatoAutomateNotConfigured();

GelatoAutomateInvalidConfig

setConfig was called with a zero automate or dedicatedMsgSender address.

error GelatoAutomateInvalidConfig();

GelatoAutomateOnlyDedicatedMsgSender

An exec entrypoint was called by an address other than the dedicated msg.sender.

error GelatoAutomateOnlyDedicatedMsgSender(address caller);

Parameters

NameTypeDescription
calleraddressThe unauthorised caller.

GelatoAutomateTaskNotFound

The given task ID is not tracked by this adapter.

error GelatoAutomateTaskNotFound(bytes32 taskId);

Parameters

NameTypeDescription
taskIdbytes32The unknown task ID.

GelatoAutomateTaskExists

A task with the given ID is already tracked.

error GelatoAutomateTaskExists(bytes32 taskId);

Parameters

NameTypeDescription
taskIdbytes32The duplicate task ID.