Skip to content
Lattice

IChainlinkAutomationAdapter

Git Source

Title: IChainlinkAutomationAdapter

Author: Modified from Chainlink (https://github.com/smartcontractkit/chainlink-evm)

Interface for the ChainlinkAutomationAdapter Diamond facet — Chainlink Automation (keepers), consumer side.

Implements the Chainlink AutomationCompatibleInterface consumer surface with a canonical time-interval upkeep: checkUpkeep reports true once interval seconds have elapsed, and performUpkeep (gated to the configured Automation forwarder) advances the counter and resets the timer. The upkeep condition is re-validated inside performUpkeep — performData is never trusted blindly.

DECISION (recorded): this ships the consumer-side compatible facet only. The optional AutomationRegistrar/AutomationRegistry on-chain registration + LINK-funding surface is a separate concern and intentionally left as a future follow-up.

Functions

getForwarder

Returns the configured Automation forwarder.

function getForwarder() external view returns (address);

Returns

NameTypeDescription
<none>address

getInterval

Returns the configured upkeep interval (seconds).

function getInterval() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

getLastTimeStamp

Returns the timestamp of the last performed upkeep.

function getLastTimeStamp() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

getCounter

Returns the number of upkeeps performed.

function getCounter() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

checkUpkeep

Reports whether the upkeep should run.

Returns true once interval seconds have elapsed since the last upkeep. performData echoes checkData.

function checkUpkeep(bytes calldata checkData) external view returns (bool upkeepNeeded, bytes memory performData);

Parameters

NameTypeDescription
checkDatabytesArbitrary data configured on the upkeep.

Returns

NameTypeDescription
upkeepNeededboolTrue if performUpkeep should be called.
performDatabytesThe data to pass to performUpkeep.

setConfig

Sets or replaces the Automation configuration and resets the upkeep timer.

Caller must hold DEFAULT_ADMIN_ROLE. Reverts ChainlinkAutomationInvalidConfig on a zero forwarder or zero interval.

function setConfig(address forwarder, uint256 interval) external;

Parameters

NameTypeDescription
forwarderaddressThe Automation forwarder allowed to call performUpkeep.
intervaluint256The minimum seconds between upkeeps.

performUpkeep

Performs the upkeep. Gated to the configured forwarder.

Re-validates that interval seconds have elapsed (reverts ChainlinkAutomationConditionNotMet otherwise), advances the counter, resets the timer, and emits UpkeepPerformed.

function performUpkeep(bytes calldata performData) external;

Parameters

NameTypeDescription
performDatabytesThe data returned by checkUpkeep (unused by the reference upkeep).

Events

ChainlinkAutomationConfigSet

Emitted when the Automation configuration is updated.

event ChainlinkAutomationConfigSet(address forwarder, uint256 interval);

Parameters

NameTypeDescription
forwarderaddressThe Automation forwarder allowed to call performUpkeep.
intervaluint256The minimum seconds between upkeeps.

UpkeepPerformed

Emitted when an upkeep is performed.

event UpkeepPerformed(uint256 counter);

Parameters

NameTypeDescription
counteruint256The new upkeep counter value.

Errors

ChainlinkAutomationNotConfigured

Automation has not been configured (forwarder address is zero).

error ChainlinkAutomationNotConfigured();

ChainlinkAutomationInvalidConfig

setConfig was called with a zero forwarder or zero interval.

error ChainlinkAutomationInvalidConfig();

ChainlinkAutomationOnlyForwarder

performUpkeep was called by an address other than the configured forwarder.

error ChainlinkAutomationOnlyForwarder(address caller);

Parameters

NameTypeDescription
calleraddressThe unauthorised caller.

ChainlinkAutomationConditionNotMet

performUpkeep was called before the upkeep interval had elapsed.

error ChainlinkAutomationConditionNotMet();