Introduction to Job creation and automation with PowerPool

Mr FOS
PowerPool
Published in
7 min readNov 29, 2023

--

Automate your on-chain actions with PowerPool today

Automating the execution of users’ daily on-chain transactions is becoming mainstream. This was confirmed by the PowerPool team’s conversations with developers at Devconnect and ETHGlobal in Istanbul.

Many protocols already use automation solutions “under the hood,” to streamline the user experience and abstract complexity. Our vision is that such routine actions as limit orders/stop losses, liquidation protection, and yield compounding shouldn’t require users’ involvement and therefore should be reliably automated. It’s one of the main reasons why we believe that 40% of all transactions in the next 3 years will be automated.

Decentralized protocols need decentralized, reliable, and cost-efficient automation. Understanding it, we developed a decentralized network consisting of Keeper nodes that is permissionless, and easy to be adopted by node runners and protocols.

The PowerPool is already live on Ethereum, Gnosis mainnets and Sepolia testnet.

You can start using PowerPool and create your first automated Job today

Learn more about PowerPool architecture, Job creation, and how to automate your next creation:

  • PowerAgent V2: architecture and key features
  • Job types
  • How to create an Interval Job
  • How to create a Resolver Job
  • PowerAgent Explorer: a tool to monitor the execution of your Jobs

PowerAgent V2 in a nutshell

PowerAgent is a large-scale, decentralized, and permissionless network of independent automation agents (Keepers), who monitor and execute on-chain tasks submitted by users.

The network consists of 3 types of entities:

  • The Agent — the contract that stores all the information, defines the state of the network, and manages Keepers and task execution;
  • Jobs are tasks submitted into the network by users. They include the target contract address, execution conditions, CallData, and other parameters;
  • Keepers are independent nodes run by PowerPool community members. Nodes execute Jobs by monitoring on-chain conditions and calling the target contract when conditions are met.

Let’s explore Job creation and execution workflow.

How does it work?

  1. A user deploys a smart contract on an EVM chain with a function with either a time-based (Interval Job) or logic-based (Resolver Job) execution condition.
  2. The user then registers the Job in PowerAgent using the dApp, sets up all necessary parameters, and makes a deposit for paying gas and execution fees. The deposit is made in tokens, used in the network for gas payment (ETH in Ethereum, xDAI in Gnosis, BNB at BNB Chain, ETH at Ethereum rollups)
  3. When the Job is set up and registered, the network automatically and randomly assigns a Keeper for execution from the Keepers set, depending on the specified stake range.
  4. When the condition is met, the selected Keeper executes the Job, receives a gas compensation and execution fee, and the network randomly assigns the next Keeper.
  5. If the Keeper doesn’t execute the Job on time or condition, another Keeper, selected by the network, will slash him and execute the Job.

Note that the execution fee (the primary source of the Keepers’ income) depends on the size of the CVP stake. Thus, Jobs requiring the big Keeper stakes (and, therefore, responsibility for no execution) require higher execution fees and compensate Keeper for the responsibility taken.

This mechanism design provides the perfect combination of cryptoeconomic incentives for keepers to perform their tasks and reliability and cost-effectiveness for users.

Key features:

- Reliable execution: PowerAgent Keepers are incentivized to execute each job precisely according to conditions and disincentivized to miss/fail the execution for any reason.

- Cost-effective: Job owners can specify the maximal acceptable gas price for execution and select the necessary stake threshold to balance the execution fee and Keepers’ responsibility.

- Highly configurable: Developers can configure Jobs using various event triggers, job specifications, gas fee range approved for execution, and Keepers’ staking requirements.

- Easy to use: An intuitive UI allows anyone to create an automation job with a few clicks. The upcoming automation templates library will allow the automation of most Defi routine tasks in a few clicks without any tech knowledge.

- Secure: PowerAgent has passed independent audits, has an open bug bounty program, and continuously tests abusive mechanics and possible attack vectors in testnets/mainnets.

- Decentralized: The PowerAgent network consists of independent Keeper nodes, mainly running on privately owned RPC nodes/independent validators, ensuring reliability and excluding single points of failure.

Automation Job types: Interval and Resolver

There are two main types of Jobs automated by PowerAgent.

Interval Jobs (with or without predefined calldata)

The interval Job is executed every given period (dT). For example, yield harvesting once a day is an interval Job with predefined CallData.

For example, a DEX LP can register an interval Job with the Rewards Vault as the target contract and his address as the CallData. Or a network validator can set up a Job that periodically harvests their validator’s rewards. In both cases, yield will be harvested automatically.

Resolver Jobs

The second type of Job involves using a Resolver contract, which has a function that defines whether the task should be executed now and with what parameters. Keepers virtually execute this function every block (checking if the Job is ready for execution or not), and as soon as it returns True and CallData, the assigned Keeper will send the execution transaction.

Examples of automated tasks using Resolver Jobs include limit orders, stop losses, liquidation protections, automated vaults, and more. Any kind of triggers/algorithms using on-chain data can be used in Resolvers to define the custom execution scenario for your tasks.

Now, let’s go through creating and registering each type of Job in PowerAgent.

Creating an Interval Job

Registering an Interval Job requires: (1) the target contract that should be called to execute the desired action (2) native tokens of the blockchain network used for the gas payment (the initial Job deposit):

1. Go to the Job creation page in the PowerAgent dApp, select the network in the upper right corner and press “Create Job”

2. Enter the address of the target contract. Its ABI will automatically be fetched

3. Choose the target contract Method

4. If the target contract requires CallData, specify it in the corresponding field

5. Now you need to configure your Job:

  • “MIN stake” is the minimum CVP a Keeper has to have staked to be eligible for executing this Job
  • “MAX stake” is the upper bound of the Keeper’s stake that is used to calculate fees and slashing amount in case of no-execution
  • Enter an “Interval” for your Job’s execution

6. Now, all that’s left is to top up the Job’s balance. It will be used for compensating gas fees and paying for the Keeper’s work.

7. When you press “Create Job” and your task will now be reliably executed each interval.

Creating a Resolver Job

Now let’s look at the more flexible Resolver Jobs that allow to automatically execute smart contracts based on arbitrary logic defined by the user.

In simple terms, a Resolver is just a smart contract (that can be part of the target contract) that performs calculations and tells the Keeper if the time has come to execute a Job and if so, what CallData to pass to it.

As an example, we will look at a Resolver contract for a claiming Gnosis Validator rewards when they exceed a certain threshold:

1. The first thing we need to do is define the parameters:

  • ClaimTarget: the target contract from which the claim would happen;
  • ClaimThreshold: claim when this amount is available

2. Now we need to define the execution logic. In this example we made a public function resolve() that will do three things:

  • Check whether the claimable rewards of the owner are above a certain threshold
  • If true, construct the CallData for the Gnosis deposit contract’s claimWithdrawals function
  • Return True and the CallData to pass to the target contract

When we deploy this Resolver, we can set all the parameters and configure our Resolver by interacting with the contract through, for example, Gnosisscan.

Now let’s submit the task into PowerAgent:

1. Go to the Job Creation screen, select the target contract (in this example, the Gnosis SBCDeposit contract) and tick the “Use Resolver” switch

2. Pick the target contract Method, which is the “claimWithdrawal” function

3. Specify the Resolver contract we just deployed and choose which function to call for checks — “resolve”

4. Configure the Job just like in case of an Interval Job (the “Interval” field is unavailable when using a Resolver)

5. Press “Create Job”

6. Now, Keepers will off-chain check out the resolve() function every block. As soon as the claimable rewards reach a predefined threshold, the function will return true and the rewards will be automatically claimed.

PowerPool is working on introducing Automation Job Templates that will allow users to automate the execution of various on-chain tasks without the need to develop and code their own Resolvers.

PowerAgent Explorer: a tool to monitor your Jobs

To keep track of your Jobs, PowerPool has developed the PowerAgent Explorer. There you can find all Jobs, Keepers, and transactions ever registered in PowerAgent.

If you go to your Job’s page, you will see all its parameters, the Keeper that is currently assigned to it, when will its next execution be, and details about all prior executions.

It’s a handy tool that allows users and developers to monitor and optimize the execution of their Jobs.

Twitter | Discord | Telegram | CMC Community | Debank | Medium

--

--

Mr FOS
PowerPool

PowerPool is a DAO, focused on providing the web3 community with a truly decentralized and reliable on-chain automation solution. https://powerpool.finance