Skip to main content

IMate2Automation1_1.sol

ExtraModule

enum ExtraModule {
None,
Echo,
Pyth
}

PythOffchainPrice

struct PythOffchainPrice {
uint256 publishTime;
int64 price;
int32 expo;
bytes vaa;
}

IMate2Automation1_1

catchErr

event catchErr(string _name, string _err)

checkUpkeep

function checkUpkeep(bytes checkData, bytes extraData) external view returns (bool upkeepNeeded, bytes performData)

method that is simulated by the keepers to see if any work actually needs to be performed. This method does does not actually need to be executable, and since it is only ever simulated it can consume lots of gas.

To ensure that it is never called, you may want to add the cannotExecute modifier from KeeperBase to your implementation of this method.

  • Parameters:

    NameTypeDescription
    checkDatabytesspecified in the upkeep registration so it is always the same for a registered upkeep. This can easily be broken down into specific arguments using abi.decode, so multiple upkeeps can be registered on the same contract and easily differentiated by the contract.
    extraDatabytespassed by keeper for passing offchain data
  • Return Values:

    NameTypeDescription
    upkeepNeededboolboolean to indicate whether the keeper should call performUpkeep or not.
    performDatabytesbytes that the keeper should call performUpkeep with, if upkeep is needed. If you would like to encode data to decode later, try abi.encode.

performUpkeep

function performUpkeep(bytes performData) external

method that is actually executed by the keepers, via the registry. The data returned by the checkUpkeep simulation will be passed into this method to actually be executed.

The input to this method should not be trusted, and the caller of the method should not even be restricted to any single registry. Anyone should be able call it, and the input should be validated, there is no guarantee that the data passed in is the performData returned from checkUpkeep. This could happen due to malicious keepers, racing keepers, or simply a state change while the performUpkeep transaction is waiting for confirmation. Always validate the data passed in.

  • Parameters:

    NameTypeDescription
    performDatabytesis the data which was passed back from the checkData simulation. If it is encoded, it can easily be decoded into other types by calling abi.decode. This data should not be trusted, and should be validated against the contract's current state.