Getting Started

IMPORTANT: Docs are a work in progress and will continue to improve.

xKeeper is a keeper network aggregator which aims to decentralise the on-chain automation of DeFi. With xKeeper, using multiple keeper networks, such as Keep3r Network, Gelato, or others, will be a walk in the park.

xKeeper is a fully modular framework, designed to be the backbone of future onchain automation.

Repositories

Deployments Addresses

Ethereum Mainnet

Contract NameContract Address
AutomationVaultFactory0xa9C4c7295519C8aE3A69D6d84252de6948666bd4
GelatoRelay0xe012118BA9678ceB3B7104C9bD7cc6b8Cf0a90DC
OpenRelay0xc461d22DCDd8538E8025AAfA439B5BddA8C69B15
Keep3rRelay0xeBe2B03A83FAF02C0f4f113E6C85a3A95f107E51
Keep3rBondedRelay0x5b564DA8EA72b79676EA9a6571DA0d62D29B6AA2
XKeeperMetadata0x96f57C654f07dda2B7d65dD98150158Bd5d764db

OP Mainnet

Contract NameContract Address
AutomationVaultFactory0xa9C4c7295519C8aE3A69D6d84252de6948666bd4
GelatoRelay0xe012118BA9678ceB3B7104C9bD7cc6b8Cf0a90DC
OpenRelay0xc461d22DCDd8538E8025AAfA439B5BddA8C69B15
Keep3rRelay0xfACd8867002605d16DaEb87955F443EE53a0893b
Keep3rBondedRelay0x10Ddf0A7051e238311A1b858acA26C4115f1c3EF
XKeeperMetadata0x96f57C654f07dda2B7d65dD98150158Bd5d764db

Ethereum Sepolia

Contract NameContract Address
AutomationVaultFactory0xa9C4c7295519C8aE3A69D6d84252de6948666bd4
GelatoRelay0xe012118BA9678ceB3B7104C9bD7cc6b8Cf0a90DC
OpenRelay0xc461d22DCDd8538E8025AAfA439B5BddA8C69B15
Keep3rRelay0x1bc8FC8D130666d8fC37fCA41F436fDC1F822c1E
Keep3rBondedRelay0xaDe1cE131609702FdDb68f6142fc1c74f80F4c5f
XKeeperMetadata0x96f57C654f07dda2B7d65dD98150158Bd5d764db

OP Sepolia

Contract NameContract Address
AutomationVaultFactory0xa9C4c7295519C8aE3A69D6d84252de6948666bd4
GelatoRelay0xe012118BA9678ceB3B7104C9bD7cc6b8Cf0a90DC
OpenRelay0xc461d22DCDd8538E8025AAfA439B5BddA8C69B15
Keep3rRelay0x6646329894ab2E6C9F5352A9D915c6c47bA9B6F9
Keep3rBondedRelay0x2Ec285BAf76bEF03AF55CdC6eeAd6EfE6AB762d8
XKeeperMetadata0x96f57C654f07dda2B7d65dD98150158Bd5d764db

Licensing

The primary license for xKeeper is AGPL-3.0

Contributors

XKeeper was built with ❤️ by Wonderland.

Wonderland is the largest core development group in web3. Our commitment is to a financial future that's open, decentralized, and accessible to all.

DeFi sucks, but Wonderland is here to make it better.

xKeeper

Why xKeeper?

xKeeper offers a powerful solution for on-chain automation. Here's why you should consider using it:

  • Simplicity: With the assistance of our relays and vault, you'll be able to easily manage automation for your contracts, and the payment process will be smoother than ever before.

  • Versatility: xKeeper is built to be compatible with various keeper services, including Keep3r, Gelato, Autonolas, and others. You have the freedom to choose the keeper that best fits your requirements.

  • Public Good: We're committed to contributing to the blockchain community by offering xKeeper as an open and free resource, promoting automation and efficiency across the ecosystem.

Join us in simplifying on-chain automation with xKeeper.

How to use

As a first step into xKeeper usage, we recommend you:

  1. Create your first Automation Vault
  2. Enable the OpenRelay
  3. Enable the GelatoRelay
  4. Enable the Keep3rRelay

Here you can also find some additional technical guides:

  1. How to create Relay exec data

Create your first Automation Vault

An Automation Vault serves as the home for your on-chain automations.

Within your vault, you can activate various automation networks (for example, Gelato) and select specific tasks they are authorized to perform.

In order to pay for your onchain automation, you can deposit ETH or any ERC20 into your vault.

Let's go ahead and try all this out.

Step 1: Deploy your vault

First, navigate to xkeeper.network in your browser. Once there, connect your wallet and select the testnet of your choosing.

Next, click the "Create Vault" button and follow the shown steps.

Well done! You now have created your first Automation Vault 🥳.

Step 2: Add metadata

Adding a name and description to your vault will make it easier for bots to identify and execute your jobs. Ensure that your description is comprehensive, detailing all the necessary information for task execution.

A compelling metadata entry looks something like this:

Name: My Protocol

Description: Automation of My Protocol reward and distribute jobs. Automation scripts can be found here: https://github.com/my-protocol/automation-scripts.

Please note, xKeeper operates entirely on-chain. Therefore, storing metadata requires an onchain transaction.

Now, give it a try and add some metadata to your new vault.

Step 3: Add balance

To prepare your vault for task execution, deposit the necessary funds to cover associated costs.

As an example, let's add some ETH to it. Using your preferred wallet, send ETH to the address of your new Automation Vault.

Step 4: Setup your relays and jobs

Relays act as bridges between your vault and various automation networks. For instance, you can enable the Keep3rRelay for Keep3r's network or the GelatoRelay for Gelato's services within your vault.

The OpenRelay is a unique exception; it doesn't connect to a specific automation network. Instead, it allows any bot to execute your on-chain tasks, compensating them directly with ETH. This approach is particularly attractive to MEV Searchers and contributes significantly to the decentralization of your tasks.

Upon enabling a relay, you also define which tasks it can carry out.

To complete the setup, enable one or more of the following relays in your vault:

Enable the GelatoRelay on your Vault

🚧 Prerequisite: Please ensure you have completed the Automation Vault setup before proceeding.

The Gelato Relay enables you to connect Gelato Network to the array of automation networks in xKeeper.

Gelato offers differentiated incentives depending on the chain being used.For comprehensive details, refer to their documentation.

Step 1: Add the relay in your vault

Inside your vault, find and click "Add New Relay," then choose Gelato Relay from the list.

In the Callers section of the window that appears, you will need to approve the dedicated msg.sender from Gelato. You can find your dedicated msg.sender inside Gelato settings.

Next, in the Jobs section, input the details of your job. For this guide, we will use a sample job we've made available on all testnets:

Job Address: 0x129f5C4Adf38a1860e54DE46970653465A605364

Selectors to allow:

  • work (0x322e9f04)

Now proceed by confirming in order to submit the transaction.

Step 2: Create the task inside Gelato

Open your web browser and navigate to Gelato. Connect your wallet and click on "Create task".

For the purposes of this guide, we'll apply the following settings:

  • Time Interval: 5 minutes
  • Start Immediately: true
  • Trigger: Solidity function

In the trigger settings:

  • Solidity Function
    • Network: Testnet of your choosing.
    • Contract Address: Smart contract with integrated checker. We will use a simple one deployed by us for this guide: 0x6F3f27a48Da92100Bc1b34c1FAA5e268f4bDdFDe.
  • Target Smart Contract
    • Contract Address: Address of your job. For this guide, we will use a sample job we've made available on all testnets: 0x129f5C4Adf38a1860e54DE46970653465A605364.

Lastly, in the "Task Properties" section under "Advanced Settings" toggle on "Transaction pays itself" to ensure the transaction costs are covered onchain through your Automation Vault.

You can learn more about each setting by visiting Gelato documentation.

Step 3: Verify execution

After the first work transaction is included onchain, you will be able to find its details under the Activity tab if your vault.

Vault transaction history

Enable the Keep3rRelay on your Vault

🚧 Prerequisite: Please ensure you have completed the Automation Vault setup before proceeding. For this relay, the selected chain must be Ethereum Sepolia.

The Keep3r Relay allows you to connect the Keep3r Network to an array of automation networks within xKeeper. The Keep3r Network currently provides an incentive of 120% of gas costs to keepers. For in-depth information about the Keep3r Network, please consult their documentation.

Moreover, the Keep3r Relay introduces an opportunity for job owners to leverage Keep3r Liquidity Provider Tokens (kLPs) for their tasks. These tokens, minted to liquidity providers within the network's pools, accrue KP3R credits over time, which can then be utilized for automation payments. The process is detailed further in the Credit Mining Docs.

Step 1: Add the relay in your vault

Inside your vault, find and click "Add New Relay," then choose Keep3r Relay from the list.

In the Callers section of the window that appears, activate the "Allow any caller" option to permit any address to execute your job. Remember that only valid keepers will be able to run your job.

Then, in the Jobs section, provide your job's specifics. For this tutorial, we'll use a sample job available on all testnets:

Job Address: 0x129f5C4Adf38a1860e54DE46970653465A605364

Selectors to allow:

  • work (0x322e9f04)

Additionally, for this relay's operation, it's crucial to authorize the isKeeper and worked functions from Keep3r v2 for executing payments:

Job Address: 0xf171B63F97018ADff9Bb15F065c6B6CDA378d320 (Keep3rV2)

Selectors to allow:

  • isKeeper (0x6ba42aaa)
  • worked (0x5feeb794)

Continue by confirming the transaction.

Step 2: Register your Automation Vault as a Keep3r Job

Open keep3r.network in your web browser, connect your wallet, and click on "Register Job" using your Automation Vault's address.

Step 3: Acquire kLPs

Since kLPs are backed by WETH and KP3R, acquiring these underlying tokens is a prerequisite for minting kLPs.

Afterward, navigate to your job on keep3r.network and mint kLPs with the KP3R and WETH you've acquired.

Step 4: Deposit kLPs into your vault

Access your job on keep3r.network and in the "Add liquidity" section, enter the amount of previously minted kLPs. Proceed by selecting "Add liquidity to job" and confirming the transaction.

This will commence the automatic generation of KP3R credits. Please note, it may take up to an hour to accumulate sufficient credits to commence your job.

Step 5: Work your job for the first time

While only validated keepers can execute tasks, testnet testing simplifies the keeper registration process.

Visit keep3r.network, connect your wallet, and select "Bond". Confirm the transaction, without the need of adding KP3R, effectively validating your keeper status.

While this process is typically automated, we'll manually trigger the job via Etherscan for demonstration purposes. Visit the Keep3rRelay in Etherscan and execute the exec function with the specified parameters.

Let's gather the needed information:

_automationVault

Your vault's address.

_execData

This encapsulates the encoded function signature of your job and its parameters. A typical _execData example is as follows:

[{ "job": "<JOB_ADDRESS>", "jobData": "<JOB_DATA>" }]

Continue using the testnet sample job address: `0x129f5C4Adf38a1860e54DE46970653465A605364`.

To generate the job data, we will use [chisel](https://book.getfoundry.sh/chisel/):

```bash
> chisel
> bytes32(abi.encodeWithSignature("work()"))

Type: bytes32
└ Data: 0x322e9f0400000000000000000000000000000000000000000000000000000000

For alternative methods to generate _execData, refer to Relay exec data.

Step 6: Verify execution

After the first work transaction is included onchain, you will be able to find its details under the Activity tab if your vault.

Vault transaction history

Enable the OpenRelay on your Vault

🚧 Prerequisite: Please ensure you have completed the Automation Vault setup before proceeding.

The OpenRelay is a fundamental yet potent relay system. It precisely calculates the gas used for executing your job within its smart contract, reimbursing the executor in ETH for the gas costs, plus an additional incentive.

Current incentive: 120% of the gas costs, paid out in ETH instantaneously.

Step 1: Enable the relay in your vault

Inside your vault, find and click "Add New Relay," then choose Open Relay from the list.

In the Callers section of the window that appears, activate the "Allow any caller" option to permit any address to execute your job.

Next, in the Jobs section, input the details of your job. For this guide, we will use a sample job we've made available on all testnets:

Job Address: 0x129f5C4Adf38a1860e54DE46970653465A605364

Selectors to allow:

  • work (0x322e9f04)

Now proceed by confirming in order to submit the transaction.

Step 2: Generate exec parameters

Execution of jobs through Relays requires specific data for the exec function on the Open Relay.

Jobs should always be executed through Relays. In this case, we need to generate the data needed to call the exec function on the Open Relay.

Let's gather the needed information:

_automationVault

Your vault's address.

_execData

This encapsulates the encoded function signature of your job and its parameters. A typical _execData example is as follows:

[{ "job": "<JOB_ADDRESS>", "jobData": "<JOB_DATA>" }]

Continue using the testnet sample job address: 0x129f5C4Adf38a1860e54DE46970653465A605364.

To generate the job data, we will use chisel:

> chisel
> bytes32(abi.encodeWithSignature("work()"))

Type: bytes32
└ Data: 0x322e9f0400000000000000000000000000000000000000000000000000000000

For alternative methods to generate _execData, refer to Relay exec data.

_feeRecipient

The ETH fee recipient, typically the wallet executing the job.

Step 3: Work your job for the first time

While this process is usually automated, we'll manually execute the job through Etherscan for demonstration purposes.

Visit the Etherscan page for your chosen testnet and locate the OpenRelay address listed on your vault's homepage.

Then, under the Write Contracts tab, input the parameters prepared in Step 2 and confirm the transaction.

Step 4: Verify execution

After your work transaction is included onchain, you will be able to find its details under the Activity tab if your vault.

Vault transaction history

How to Generate execData

The exec function shared by every Relay requires a specific argument: IAutomationVault.ExecData[] calldata _execData. This guide covers the process of generating this essential data component.

How can you generate that exec data?

Structure of _execData

The _execData is a collection that includes the encoded function signature of your job along with its parameters. Here’s how the _execData looks like:

[{ "job": "<JOB_ADDRESS>", "jobData": "<JOB_DATA>" }]

Generating Job Data with chisel

Prerequisite: Ensure you have Foundry installed.

To generate your job data, execute the following commands in your terminal:

> chisel
> abi.encodeWithSignature("work(uint256)", 420)

Type: dynamic bytes
├ Hex (Memory):
├─ Length ([0x00:0x20]): 0x0000000000000000000000000000000000000000000000000000000000000024
├─ Contents ([0x20:..]): 0x5858d16100000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000
├ Hex (Tuple Encoded):
├─ Pointer ([0x00:0x20]): 0x0000000000000000000000000000000000000000000000000000000000000020
├─ Length ([0x20:0x40]): 0x0000000000000000000000000000000000000000000000000000000000000024
└─ Contents ([0x40:..]): 0x5858d16100000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000 <-- YOUR NEEDED DATA

Grab the Contents field of the result, and use that as your <JOB_DATA>.

Generating Job Data with ethers.js

For those who use JavaScript, ethers.js provides a straightforward method to obtain your job data. Below is an example:

abi = ["function work(uint256 _someData)"];
iface = new ethers.utils.Interface(abi);
encodedData = iface.encodeFunctionData("work", [420]);

> "0x5858d16100000000000000000000000000000000000000000000000000000000000001a4"

Try copy pasting the previous lines of code in the Ethers Playground to see the expected output.

Grab the value of encodedData, and use that as your <JOB_DATA>.

Core Contracts

The core contracts of the xKeeper project are the backbone of the framework. They can be used to generate new vaults, manage balances and approve and revoke permissions for callers and relays.

Core Contracts

  • The AutomationVault contract manages on-chain job execution with relays, streamlining payment and serving as a core component in user-friendly on-chain automation.

  • The AutomationVaultFactory contract is responsible for deploying new instances of automation vaults.

For more detailed information about each contract, please refer to the respective documentation pages.

For more technical details about the interfaces of the core contracts, please refer to the Interfaces section in the technical documentation.

⚠️ Please note that the code has not been audited yet, so use it with caution.

Automation Vault

The AutomationVault contract is designed to facilitate the management of job execution with various relays and the payment of these relays for their services. The contract operates as a core component in the realm of on-chain automation. It provides a robust and user-friendly solution for defining and executing tasks while ensuring that payments are handled in a more straightforward manner.

Key Features

  • Relay and Job Management: The AutomationVault contract allows users to manage approved relays and jobs efficiently. It maintains a list of approved relays and jobs, providing control over who can perform specific tasks.

  • Simplified Payment Handling: Payment management has been simplified, allowing payments to be made in a more user-friendly manner. It supports both Ether (ETH) and ERC-20 tokens, ensuring that fees for job execution are processed seamlessly.

  • Ownership Control: The contract incorporates ownership management to ensure control over its functions. The owner has the authority to approve or revoke relays, callers, and selectors.

  • Multichain Support: The xKeeper core allows to configure the automation vaults for several chains. The native token is configurable for any automation vault.

  • Flexibility: Users have the freedom to add or remove relays and select specific functions to be executed by jobs, granting them greater control over their automation processes.

Automation Vault Factory

The AutomationVaultFactory contract is specifically designed to handle the deployment and management of automation vaults within the on-chain automation ecosystem. As a factory, it plays a crucial role in streamlining the creation of new automation vaults, each serving as a dedicated entity for job execution, relay management, and payment processing.

Key Features

  • Efficient Deployment: The primary function of the factory is to efficiently deploy new instances of automation vaults. This allows users to manage automation tasks, associated relays and handle balances.

  • Automation Vaults Listing: Enables users to retrieve a list of deployed automation vaults, allowing for efficient tracking and monitoring.

Relays Contracts

Relay contracts in the xKeeper project play a key role in facilitating automated task executions from different networks. Each of these contracts provides specialized solutions to optimize task execution and manage the associated payments.

Relays Contracts

  • The Keep3rRelay: Orchestrates and executes tasks efficiently, ensuring a harmonious automation process within the Keep3r network.

  • The Keep3rBondedRelay: Introduces dynamic bonding requirements for automation vaults, enhancing security by validating tasks with bonded keepers.

  • The GelatoRelay: Acts as a centralized hub for managing and executing tasks from the Gelato network, streamlining automation processes.

  • The OpenRelay: Manages and facilitates the execution of tasks from various bots, ensuring efficient automation processes and fee payments.

For more detailed information about each contract, please refer to the respective documentation pages.

For more technical details about the interfaces of the relays contracts, please refer to the Interfaces section in the technical documentation.

⚠️ Please note that the code has not been audited yet, so use it with caution.

Keep3r Relay

The Keep3rRelay is meticulously crafted to orchestrate and streamline task executions from the Keep3r network, offering a cohesive solution for efficient automation processes and fee payments.

Key Features

  • Task Coordination: The contract seamlessly coordinates task executions with an AutomationVault, ensuring a harmonious and streamlined automation process.

  • Keeper Authorization: Validation mechanisms guarantee that only authorized keepers within the Keep3r network can initiate and execute tasks, enhancing security and control.

  • Optimized Execution Array: The contract intelligently creates an array of executions, encompassing crucial steps such as keeper validation, injected execution data, and issuance of payments upon successful task completion.

  • Event Transparency: Upon successful execution, the contract emits the AutomationVaultExecuted event, providing transparent insights into executed tasks and relay activities.

Keep3r Network

The Keep3rRelay combines task coordination, keeper validation, and event transparency to deliver a robust solution for streamlined automation processes within the Keep3r network. This design prioritizes efficiency, security, and user-friendly task execution.

Keep3r Bonded Relay

The Keep3rBondedRelay contract efficiently manages executions originating from the Keep3r network when the job is bonded. This contract introduces bonding requirements for automation vaults, ensuring task executions are performed by legitimate bonded keepers.

Key Features

  • Dynamic Bonding Requirements: The contract introduces flexible bonding requirements for automation vaults. Vault owners can set specific bonding parameters, such as the required bond, minimum bond, earned rewards, and age, ensuring customizable security measures.

  • Bonding Requirement Configuration: Through the setAutomationVaultRequirements function, automation vault owners can dynamically configure bonding requirements. This feature grants control over the security measures necessary for task execution.

  • Task Execution with Bonded Keepers: The contract efficiently executes tasks with bonded keepers, validating their bonding status based on the configured requirements. This ensures that only legitimate bonded keepers can initiate and complete tasks.

  • Event Emission: Upon successful execution, the contract emits the AutomationVaultExecuted event. This event provides transparency into executed tasks, including details on the associated automation vault and the executed data.

Keep3r Network

The Keep3rBondedRelay contract introduces a novel approach by incorporating dynamic bonding requirements for automation vaults. This design enhances security and control, allowing vault owners to customize bonding parameters and ensuring task executions are carried out by validated bonded keepers.

Gelato Relay

The GelatoRelay contract, serves as a central hub for managing and executing tasks originating from the Gelato network, contributing to seamless automation processes and fee payments.

Key Features

  • Task Execution Coordination: The contract, in collaboration with the Gelato network, coordinates and executes tasks efficiently, ensuring a smooth and reliable automation process.

  • Automation Vault Interaction: This interaction centralizes multiple tasks within a single relay, streamlining the management of various tasks and their associated payments in a single function call. This feature enhances efficiency and reduces the complexity of task management, allowing users to handle multiple tasks simultaneously.

  • Event Transparency: Upon successful execution, the contract emits the AutomationVaultExecuted event, providing transparent insights into executed tasks and relay activities.

Gelato Network

The GelatoRelay contract seamlessly integrates with the Gelato network, offering a robust solution for the execution of automated tasks while maintaining transparency in fee calculations and execution events.

Open Relay

The OpenRelay is designed to manage and facilitate the execution of tasks coming from various bots, ensuring efficient automation processes and fee payments.

Key Features

  • Gas Management: The contract employs gas management to optimize transaction costs. It calculates the gas spent and provides a gas bonus to ensure that the execution is efficient and cost-effective.

  • Automated Fee Calculation: The contract automatically calculates and handles fees for task execution. It uses gas metrics to determine the appropriate payment to be made to the automation vault.

  • Seamless Task Execution: The contract allows the execution of tasks within an automation vault. It ensures that all tasks are carried out smoothly, and fees are promptly paid to the designated fee recipient.

  • Event Transparency: Upon successful execution, the contract emits the AutomationVaultExecuted event, providing transparent insights into executed tasks and relay activities.

Gas Metrics

  • GAS_BONUS: 53,000
  • GAS_MULTIPLIER: 12,000
  • BASE: 10,000

These gas metrics play a vital role in paying the caller for the work performed.

Peripheral Contracts

Peripheral contracts serve as supportive components that extend the capabilities of the core system. Among these, the XKeeperMetadata contract stands out as a crucial peripheral contract, specifically designed for managing and streamlining metadata associated with automation vaults.

Peripheral Contracts

  • The XKeeperMetadata: Manages and organizes metadata for automation vaults within the system, ensuring accurate and secure data handling while enhancing the overall efficiency of metadata management processes.

For more detailed information about each contract, please refer to the respective documentation pages.

For more technical details about the interfaces of the relays contracts, please refer to the Interfaces section in the technical documentation.

⚠️ Please note that the code has not been audited yet, so use it with caution.

XKeeperMetadata

The XKeeperMetadata contract is a pivotal component in managing the metadata associated with automation vaults. It offers a structured and efficient way to handle metadata operations, providing essential features and interactions for users. Automation vaults owners can define all information related with their protocols to provide information about how to work their jobs.

Key Features

  • Metadata Management: The contract is primarily focused on handling the metadata of automation vaults, providing a structured and consistent approach to managing information.

  • Robust Querying: Users can query metadata for an array of automation vaults simultaneously, ensuring efficient data retrieval and management.

  • Secure Metadata Modification: The contract ensures that only the owner of an automation vault can modify its metadata, maintaining the integrity and security of the data.

Contents

Contents

IAutomationVault

Git Source

Inherits: IOwnable

Functions

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

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

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

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();

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

IAutomationVaultFactory

Git Source

Functions

totalAutomationVaults

Get the total amount of automation vaults deployed by the factory

function totalAutomationVaults() external view returns (uint256 _totalAutomationVaults);

Returns

NameTypeDescription
_totalAutomationVaultsuint256The total amount of automation vaults deployed

automationVaults

Get a certain amount of automation vaults deployed by the factory

function automationVaults(uint256 _startFrom, uint256 _amount) external view returns (address[] memory _list);

Parameters

NameTypeDescription
_startFromuint256Index from where to start retrieving automation vaults
_amountuint256Amount of automation vaults to retrieve

Returns

NameTypeDescription
_listaddress[]The array of automation vaults

deployAutomationVault

Deploy a new automation vault

function deployAutomationVault(
  address _owner,
  address _nativeToken,
  uint256 _salt
) external returns (IAutomationVault _automationVault);

Parameters

NameTypeDescription
_owneraddressThe address of the owner
_nativeTokenaddressThe address of the native token
_saltuint256The salt to use for the automation vault deployment

Returns

NameTypeDescription
_automationVaultIAutomationVaultThe address of the automation vault deployed

Events

DeployAutomationVault

Emitted when a new automation vault is deployed

event DeployAutomationVault(address indexed _owner, address indexed _automationVault);

Parameters

NameTypeDescription
_owneraddressThe address of the owner
_automationVaultaddressThe address of the automation vault deployed

Errors

AutomationVaultFactory_Create2Failed

Thrown when the automation vault factory fails to deploy a new automation vault

error AutomationVaultFactory_Create2Failed();

IBasicJobChecker

Git Source

Functions

checker

This function checks whether the job can be executed by the automation vault

function checker(
  IAutomationVault _automationVault,
  IBasicJob _basicJob
) external pure returns (bool _canExec, bytes memory _execPayload);

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe automation vault that will execute the job
_basicJobIBasicJobThe basic job that will be executed

Returns

NameTypeDescription
_canExecboolWhether the job can be executed
_execPayloadbytesThe payload that will be executed by the automation vault

Contents

IKeep3rSponsor

Git Source

Inherits: IOwnable

Functions

KEEP3R_V2

Returns the keep3rV2 contract

function KEEP3R_V2() external view returns (IKeep3rV2 _keep3rV2);

Returns

NameTypeDescription
_keep3rV2IKeep3rV2The address of the keep3rV2 contract

KEEP3R_HELPER

Returns the keep3r helper contract

function KEEP3R_HELPER() external view returns (IKeep3rHelper _keep3rHelper);

Returns

NameTypeDescription
_keep3rHelperIKeep3rHelperThe address of the keep3r helper contract

BASE

Returns the base

function BASE() external view returns (uint32 _base);

Returns

NameTypeDescription
_baseuint32The base

bonus

Returns the bonus

The bonus is in base 10_000

function bonus() external view returns (uint256 _bonus);

Returns

NameTypeDescription
_bonusuint256The bonus

openRelay

Returns the open relay

function openRelay() external view returns (IOpenRelay _openRelay);

Returns

NameTypeDescription
_openRelayIOpenRelayThe address of the open relay

feeRecipient

Returns the fee recipient address

function feeRecipient() external view returns (address _feeRecipient);

Returns

NameTypeDescription
_feeRecipientaddressThe address of the fee recipient

getSponsoredJobs

Returns the list of the sponsored jobs

function getSponsoredJobs() external returns (address[] memory _sponsoredJobsList);

Returns

NameTypeDescription
_sponsoredJobsListaddress[]The list of the sponsored jobs

setFeeRecipient

Sets the fee recipient who will receive the payment of the open relay

function setFeeRecipient(address _feeRecipient) external;

Parameters

NameTypeDescription
_feeRecipientaddressThe address of the fee recipient

setOpenRelay

Sets the open relay

function setOpenRelay(IOpenRelay _openRelay) external;

Parameters

NameTypeDescription
_openRelayIOpenRelayThe address of the open relay

setBonus

Sets the bonus

function setBonus(uint256 _bonus) external;

Parameters

NameTypeDescription
_bonusuint256The bonus

addSponsoredJobs

Adds a job to the sponsored list

function addSponsoredJobs(address[] calldata _jobs) external;

Parameters

NameTypeDescription
_jobsaddress[]List of jobs to add

deleteSponsoredJobs

Removes a job from the sponsored list

function deleteSponsoredJobs(address[] calldata _jobs) external;

Parameters

NameTypeDescription
_jobsaddress[]List of jobs to remove

exec

Execute an open relay which will execute the jobs and will manage the payment to the fee data receivers

function exec(IAutomationVault _automationVault, IAutomationVault.ExecData[] calldata _execData) external;

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe automation vault that will be executed
_execDataIAutomationVault.ExecData[]The array of exec data

Events

JobExecuted

Emitted when a job is executed

event JobExecuted(address _job);

Parameters

NameTypeDescription
_jobaddressThe address of the job

FeeRecipientSetted

Emitted when the fee recipient is setted

event FeeRecipientSetted(address indexed _feeRecipient);

Parameters

NameTypeDescription
_feeRecipientaddressThe address of the new fee recipient

OpenRelaySetted

Emitted when the open relay is setted

event OpenRelaySetted(IOpenRelay indexed _openRelay);

Parameters

NameTypeDescription
_openRelayIOpenRelayThe address of the new open relay

BonusSetted

Emitted when the bonus is setted

event BonusSetted(uint256 indexed _bonus);

Parameters

NameTypeDescription
_bonusuint256The sponsored bonus

ApproveSponsoredJob

Emitted when a sponsored job is approved

event ApproveSponsoredJob(address indexed _job);

Parameters

NameTypeDescription
_jobaddressThe address of the sponsored job

DeleteSponsoredJob

Emitted when a sponsored job is deleted

event DeleteSponsoredJob(address indexed _job);

Parameters

NameTypeDescription
_jobaddressjob The address of the sponsored job

Errors

Keep3rSponsor_JobNotSponsored

Thrown when the job executed is not in the list of sponsored jobs

error Keep3rSponsor_JobNotSponsored();

Keep3rSponsor_NotKeeper

Thrown when the caller is not a keeper

error Keep3rSponsor_NotKeeper();

Keep3rSponsor_NoJobs

Thrown when the exec data is empty

error Keep3rSponsor_NoJobs();

Keep3rSponsor_LowBonus

Thrown when the bonus is lower than the base

error Keep3rSponsor_LowBonus();

IXKeeperMetadata

Git Source

Functions

automationVaultMetadata

Returns the metadata of the automation vault

function automationVaultMetadata(IAutomationVault _automationVault)
  external
  view
  returns (string calldata _name, string calldata _description);

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe automation vault

Returns

NameTypeDescription
_namestringThe name of the automation vault
_descriptionstringThe description of the automation vault

automationVaultsMetadata

Returns the metadata of the automation vault

function automationVaultsMetadata(IAutomationVault[] calldata _automationVault)
  external
  view
  returns (IXKeeperMetadata.AutomationVaultMetadata[] memory _metadata);

Parameters

NameTypeDescription
_automationVaultIAutomationVault[]The automation vaults

Returns

NameTypeDescription
_metadataIXKeeperMetadata.AutomationVaultMetadata[]The metadata of the automation vault

setAutomationVaultMetadata

Sets the metadata of the automation vault

function setAutomationVaultMetadata(
  IAutomationVault _automationVault,
  AutomationVaultMetadata calldata _automationVaultMetadata
) external;

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe automation vault
_automationVaultMetadataAutomationVaultMetadataThe metadata of the automation vault

Events

AutomationVaultMetadataSetted

Emitted when the metadata of an automation vault is set

event AutomationVaultMetadataSetted(IAutomationVault indexed _automationVault, string _name, string _description);

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe automation vault
_namestringThe name of the automation vault
_descriptionstringThe description of the automation vault

Structs

AutomationVaultMetadata

The metadata of the automation vault

struct AutomationVaultMetadata {
  string name;
  string description;
}

Properties

NameTypeDescription
namestringThe name of the automation vault
descriptionstringThe description of the automation vault

Contents

IGelatoRelay

Git Source

Functions

AUTOMATE

Returns the automate contract of the gelato network

function AUTOMATE() external view returns (IAutomate _automate);

Returns

NameTypeDescription
_automateIAutomateThe address of the automate contract

FEE_COLLECTOR

Returns the fee collector of the gelato network

function FEE_COLLECTOR() external view returns (address _feeCollector);

Returns

NameTypeDescription
_feeCollectoraddressThe address of the fee collector

exec

Execute an automation vault which will execute the jobs and will manage the payment to the fee data receivers

function exec(IAutomationVault _automationVault, IAutomationVault.ExecData[] calldata _execData) external;

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe automation vault that will be executed
_execDataIAutomationVault.ExecData[]The array of exec data

Events

AutomationVaultExecuted

Emitted when an automation vault is executed

event AutomationVaultExecuted(
  IAutomationVault indexed _automationVault,
  address indexed _relayCaller,
  IAutomationVault.ExecData[] _execData,
  IAutomationVault.FeeData[] _feeData
);

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe address of the automation vault
_relayCalleraddressThe address of the relay caller
_execDataIAutomationVault.ExecData[]The array of exec data
_feeDataIAutomationVault.FeeData[]The array of fee data

IKeep3rBondedRelay

Git Source

Inherits: IKeep3rRelay

Functions

automationVaultRequirements

Get the automation vault bonded requirements

function automationVaultRequirements(IAutomationVault _automationVault)
  external
  view
  returns (address _bond, uint256 _minBond, uint256 _earned, uint256 _age);

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe automation vault

Returns

NameTypeDescription
_bondaddressThe bond token being evaluated
_minBonduint256The minimum amount of bonded tokens
_earneduint256The minimum funds earned in the keepers lifetime
_ageuint256The minimum keeper age required

setAutomationVaultRequirements

Set the automation vault requirements when bonded job is required

Only the owner of the automation vault can set the requirements

function setAutomationVaultRequirements(
  IAutomationVault _automationVault,
  IKeep3rBondedRelay.Requirements memory _requirements
) external;

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe automation vault that will be executed
_requirementsIKeep3rBondedRelay.RequirementsThe requirements needed when bonded job is required

Events

AutomationVaultRequirementsSetted

Emitted when the automation vault requirements are setted

event AutomationVaultRequirementsSetted(
  IAutomationVault indexed _automationVault, address _bond, uint256 _minBond, uint256 _earned, uint256 _age
);

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe address of the automation vault
_bondaddressThe bond token being evaluated
_minBonduint256The minimum amount of bonded tokens
_earneduint256The minimum funds earned in the keepers lifetime
_ageuint256The minimum keeper age required

Errors

Keep3rBondedRelay_NotAutomationVaultRequirement

Thrown when the automation vault requirements are not setted

error Keep3rBondedRelay_NotAutomationVaultRequirement();

Keep3rBondedRelay_NotBondedKeeper

Thrown when the keeper doesn't meet the requirements set by the automation vault

error Keep3rBondedRelay_NotBondedKeeper();

Structs

Requirements

The requirements needed when bonded job is required

struct Requirements {
  address bond;
  uint256 minBond;
  uint256 earned;
  uint256 age;
}

Properties

NameTypeDescription
bondaddressThe bond token being evaluated
minBonduint256The minimum amount of bonded tokens
earneduint256The minimum funds earned in the keepers lifetime
ageuint256The minimum keeper age required

IKeep3rBondedRelayL2

Git Source

Inherits: IKeep3rRelayL2, IKeep3rBondedRelay

IKeep3rRelay

Git Source

Functions

KEEP3R_V2

Get the keep3rV2 contract

function KEEP3R_V2() external view returns (IKeep3rV2 _keep3rV2);

Returns

NameTypeDescription
_keep3rV2IKeep3rV2The keep3rV2 contract

exec

Execute an automation vault which will execute the jobs and will manage the payment to the fee data receivers

The payment will be managed by keep3r network. The first and last exec data are assembled by the relay in order to be able to work with keep3r network

function exec(IAutomationVault _automationVault, IAutomationVault.ExecData[] calldata _execData) external;

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe automation vault that will be executed
_execDataIAutomationVault.ExecData[]The array of exec data

Events

AutomationVaultExecuted

Emitted when an automation vault is executed

event AutomationVaultExecuted(
  IAutomationVault indexed _automationVault, address indexed _relayCaller, IAutomationVault.ExecData[] _execData
);

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe address of the automation vault
_relayCalleraddressThe address of the relay caller
_execDataIAutomationVault.ExecData[]The array of exec data

Errors

Keep3rRelay_NoExecData

Thrown when the exec data is empty

error Keep3rRelay_NoExecData();

Keep3rRelay_NotKeeper

Thrown when the caller is not a keeper

error Keep3rRelay_NotKeeper();

Keep3rRelay_Keep3rNotAllowed

Thrown when the exec data contains Keep3r V2

error Keep3rRelay_Keep3rNotAllowed();

IKeep3rRelayL2

Git Source

Inherits: IKeep3rRelay

Functions

usdPerGasUnitPerVault

Get the USD per gas unit per automation vault

function usdPerGasUnitPerVault(IAutomationVault _automationVault) external view returns (uint256 _usdPerGasUnit);

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe address of the automation vault

Returns

NameTypeDescription
_usdPerGasUnituint256The USD per gas unit

setUsdPerGasUnit

Set the USD per gas unit

function setUsdPerGasUnit(IAutomationVault _automationVault, uint256 _usdPerGasUnit) external;

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe address of the automation vault
_usdPerGasUnituint256The USD per gas unit

Events

UsdPerGasUnitSetted

Emitted when the USD per gas unit is setted

event UsdPerGasUnitSetted(IAutomationVault _automationVault, uint256 _usdPerGasUnit);

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe address of the automation vault
_usdPerGasUnituint256The USD per gas unit

IOpenRelay

Git Source

Functions

GAS_BONUS

Returns the gas bonus

function GAS_BONUS() external view returns (uint256 _gasBonus);

Returns

NameTypeDescription
_gasBonusuint256The value of the gas bonus

GAS_MULTIPLIER

Returns the gas multiplier

function GAS_MULTIPLIER() external view returns (uint256 _gasMultiplier);

Returns

NameTypeDescription
_gasMultiplieruint256The value of the gas multiplier

BASE

Returns the base used for the payment calculation

function BASE() external view returns (uint32 _base);

Returns

NameTypeDescription
_baseuint32The value of the base

exec

Execute an automation vault which will execute the jobs and will manage the payment to the fee data receivers

The payment will be calculated on the basis of several variables like the gas spent, the base fee, the gas bonus and the gas multiplier

function exec(
  IAutomationVault _automationVault,
  IAutomationVault.ExecData[] calldata _execData,
  address _feeRecipient
) external;

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe automation vault that will be executed
_execDataIAutomationVault.ExecData[]The array of exec data
_feeRecipientaddressThe address of the fee recipient

Events

AutomationVaultExecuted

Emitted when an automation vault is executed

event AutomationVaultExecuted(
  IAutomationVault indexed _automationVault,
  address indexed _relayCaller,
  IAutomationVault.ExecData[] _execData,
  IAutomationVault.FeeData[] _feeData
);

Parameters

NameTypeDescription
_automationVaultIAutomationVaultThe address of the automation vault
_relayCalleraddressThe address of the relay caller
_execDataIAutomationVault.ExecData[]The array of exec data
_feeDataIAutomationVault.FeeData[]The array of fee data

Errors

OpenRelay_NoExecData

Thrown when the exec data is empty

error OpenRelay_NoExecData();

Contents

IOwnable

Git Source

This contract is used to manage ownership

Functions

owner

Returns the owner address

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

Returns

NameTypeDescription
_owneraddressThe address of the owner

pendingOwner

Returns the pending owner address

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

Returns

NameTypeDescription
_pendingOwneraddressThe address of the pending owner

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;

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

Errors

Ownable_OnlyOwner

Thrown when the caller is not the owner

error Ownable_OnlyOwner();

Ownable_OnlyPendingOwner

Thrown when the caller is not the pending owner

error Ownable_OnlyPendingOwner();

IOwnableAutomationVault

Git Source

Errors

OwnableAutomationVault_OnlyAutomationVaultOwner

Error when the caller is not the automation vault owner

error OwnableAutomationVault_OnlyAutomationVaultOwner();