Skip to content
Lattice

ChainlinkAutomationAdapter

Git Source

Inherits: IChainlinkAutomationAdapter

Title: ChainlinkAutomationAdapter

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from Chainlink (https://github.com/smartcontractkit/chainlink-evm)

Diamond facet for the consumer side of Chainlink Automation (keepers) with a canonical time-interval upkeep.

Stateless delegator — all logic and storage live in ChainlinkAutomationAdapterLib.

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 — no registrar/registry management is performed here.

Notes:

  • lattice-version: 0.1.0
  • lattice-source: Chainlink

Functions

getForwarder

Returns the configured Automation forwarder.

function getForwarder() external view virtual override returns (address);

Returns

NameTypeDescription
<none>address

getInterval

Returns the configured upkeep interval (seconds).

function getInterval() external view virtual override returns (uint256);

Returns

NameTypeDescription
<none>uint256

getLastTimeStamp

Returns the timestamp of the last performed upkeep.

function getLastTimeStamp() external view virtual override returns (uint256);

Returns

NameTypeDescription
<none>uint256

getCounter

Returns the number of upkeeps performed.

function getCounter() external view virtual override 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
        virtual
        override
        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 virtual override;

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 virtual override;

Parameters

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

exportSelectors

ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).

Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches forge inspect ChainlinkAutomationAdapter methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: checkUpkeep(bytes) 0x6e04ff0d getCounter() 0x8ada066e getForwarder() 0xa0042526 getInterval() 0x91ad27b4 getLastTimeStamp() 0xc1c244e8 performUpkeep(bytes) 0x4585e33b setConfig(address,uint256) 0xc6195d36

function exportSelectors() external pure virtual returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes