IAutomationVault

Git Source

Functions

owner

Returns the owner address

function owner() external view returns (address _owner);

Returns

NameTypeDescription
_owneraddressThe address of the owner

NATIVE_TOKEN

Returns the address of the native token

function NATIVE_TOKEN() external view returns (address _nativeToken);

Returns

NameTypeDescription
_nativeTokenaddressThe address of the native token

pendingOwner

Returns the pending owner address

function pendingOwner() external view returns (address _pendingOwner);

Returns

NameTypeDescription
_pendingOwneraddressThe address of the pending owner

getRelayData

Returns the approved relay callers and selectors for a specific relay and job

function getRelayData(address _relay)
  external
  returns (address[] memory _callers, IAutomationVault.JobData[] memory _jobsData);

Parameters

NameTypeDescription
_relayaddressThe address of the relay

Returns

NameTypeDescription
_callersaddress[]The array of approved relay callers
_jobsDataIAutomationVault.JobData[]The array of approved jobs and selectors

relays

Returns the approved relays

function relays() external view returns (address[] memory _listRelays);

Returns

NameTypeDescription
_listRelaysaddress[]The array of approved relays

changeOwner

Propose a new owner for the contract

The new owner will need to accept the ownership before it is transferred

function changeOwner(address _pendingOwner) external;

Parameters

NameTypeDescription
_pendingOwneraddressThe address of the new owner

acceptOwner

Accepts the ownership of the contract

function acceptOwner() external;

withdrawFunds

Withdraws funds deposited in the contract

Only the owner can call this function

function withdrawFunds(address _token, uint256 _amount, address _receiver) external;

Parameters

NameTypeDescription
_tokenaddressThe address of the token
_amountuint256The amount of tokens
_receiveraddressThe address of the receiver

addRelay

Add a new relay to the automation vault with the desired callers, jobs and selectors

If the relay is valid, it can be passed with all the fields or only the necessary ones, passing the empty argument in the unwanted ones

function addRelay(address _relay, address[] calldata _callers, IAutomationVault.JobData[] calldata _jobsData) external;

Parameters

NameTypeDescription
_relayaddressThe address of the relay
_callersaddress[]The array of callers
_jobsDataIAutomationVault.JobData[]The array of job data

deleteRelay

Revokes the approval of a specific relay

The callers, jobs and selectors will be deleted

function deleteRelay(address _relay) external;

Parameters

NameTypeDescription
_relayaddressThe address of the relay

modifyRelay

Modify the callers, jobs and selectors of a specific relay

If any of the arguments is empty, the data will be deleted

function modifyRelay(
  address _relay,
  address[] calldata _callers,
  IAutomationVault.JobData[] calldata _jobsData
) external;

Parameters

NameTypeDescription
_relayaddressThe address of the relay
_callersaddress[]The array of callers
_jobsDataIAutomationVault.JobData[]The array of job data

modifyRelayCallers

Modify the callers of a specific relay

If the array is empty, the data will be deleted

function modifyRelayCallers(address _relay, address[] calldata _callers) external;

Parameters

NameTypeDescription
_relayaddressThe address of the relay
_callersaddress[]The array of callers

modifyRelayJobs

Modify the jobs and selectors of a specific relay

If the array is empty, the data will be deleted, also if the function selectors array is empty

function modifyRelayJobs(address _relay, IAutomationVault.JobData[] calldata _jobsData) external;

Parameters

NameTypeDescription
_relayaddressThe address of the relay
_jobsDataIAutomationVault.JobData[]The array of job data

exec

Executes a job and issues a payment to the fee data receivers

The function can be called with only execData, only feeData or both. The strategy of the payment will be different depending on which relay is calling the function

function exec(address _relayCaller, ExecData[] calldata _execData, FeeData[] calldata _feeData) external;

Parameters

NameTypeDescription
_relayCalleraddressThe address of the relay caller
_execDataExecData[]The array of exec data
_feeDataFeeData[]The array of fee data

Events

ChangeOwner

Emitted when the owner is proposed to change

event ChangeOwner(address indexed _pendingOwner);

Parameters

NameTypeDescription
_pendingOwneraddressThe address that is being proposed

AcceptOwner

Emitted when the owner is accepted

event AcceptOwner(address indexed _owner);

Parameters

NameTypeDescription
_owneraddressThe address of the new owner

WithdrawFunds

Emitted when funds are withdrawn

event WithdrawFunds(address indexed _token, uint256 _amount, address indexed _receiver);

Parameters

NameTypeDescription
_tokenaddressThe address of the token
_amountuint256The amount of tokens
_receiveraddressThe address of the receiver

ApproveRelay

Emitted when a relay is approved

event ApproveRelay(address indexed _relay);

Parameters

NameTypeDescription
_relayaddressThe address of the relay

DeleteRelay

Emitted when a relay is deleted

event DeleteRelay(address indexed _relay);

Parameters

NameTypeDescription
_relayaddressThe address of the relay

ApproveRelayCaller

Emitted when a relay caller is approved

event ApproveRelayCaller(address indexed _relay, address indexed _caller);

Parameters

NameTypeDescription
_relayaddressThe address of the relay
_calleraddressThe address of the caller

ApproveJob

Emitted when job is approved

event ApproveJob(address indexed _job);

Parameters

NameTypeDescription
_jobaddressThe address of the job

ApproveJobSelector

Emitted when job selector is approved

event ApproveJobSelector(address indexed _job, bytes4 indexed _functionSelector);

Parameters

NameTypeDescription
_jobaddressThe address of the job
_functionSelectorbytes4The function selector

JobExecuted

Emitted when a job is executed

event JobExecuted(address indexed _relay, address indexed _relayCaller, address indexed _job, bytes _jobData);

Parameters

NameTypeDescription
_relayaddressThe relay address
_relayCalleraddressThe relay caller address
_jobaddressThe address of the job
_jobDatabytesThe data to execute the job

IssuePayment

Emitted when a payment is issued

event IssuePayment(
  address indexed _relay, address indexed _relayCaller, address indexed _feeRecipient, address _feeToken, uint256 _fee
);

Parameters

NameTypeDescription
_relayaddressThe relay address
_relayCalleraddressThe relay caller address
_feeRecipientaddressThe recipient address which will receive the fee
_feeTokenaddressThe address of the token
_feeuint256The amount of tokens

NativeTokenReceived

Emitted when native token is received in the automation vault

event NativeTokenReceived(address indexed _sender, uint256 _amount);

Parameters

NameTypeDescription
_senderaddressThe sender address
_amountuint256The amount of native token

Errors

AutomationVault_RelayZero

Thrown when the the relay is the zero address

error AutomationVault_RelayZero();

AutomationVault_RelayAlreadyApproved

Thrown when the relay is already approved

error AutomationVault_RelayAlreadyApproved();

AutomationVault_NativeTokenTransferFailed

Thrown when ether transfer fails

error AutomationVault_NativeTokenTransferFailed();

AutomationVault_NotApprovedRelayCaller

Thrown when a not approved relay caller is trying to execute a job

error AutomationVault_NotApprovedRelayCaller();

AutomationVault_NotApprovedJobSelector

Thrown when a not approved job selector is trying to be executed

error AutomationVault_NotApprovedJobSelector();

AutomationVault_ExecFailed

Thrown when a job execution fails

error AutomationVault_ExecFailed();

AutomationVault_OnlyOwner

Thrown when the caller is not the owner

error AutomationVault_OnlyOwner();

AutomationVault_OnlyPendingOwner

Thrown when the caller is not the pending owner

error AutomationVault_OnlyPendingOwner();

Structs

ExecData

The data to execute a job

struct ExecData {
  address job;
  bytes jobData;
}

Properties

NameTypeDescription
jobaddressThe address of the job
jobDatabytesThe data to execute the job

FeeData

The data to issue a payment

struct FeeData {
  address feeRecipient;
  address feeToken;
  uint256 fee;
}

Properties

NameTypeDescription
feeRecipientaddressThe recipient address which will receive the fee
feeTokenaddressThe address of the token
feeuint256The amount of tokens

JobData

The data of a job

struct JobData {
  address job;
  bytes4[] functionSelectors;
}

Properties

NameTypeDescription
jobaddressThe address of the job
functionSelectorsbytes4[]The array of function selectors