PowerPool
  • powerpool overview
    • PowerPool
      • PowerPool DAO Story
      • Value Proposition
      • Use Cases
      • CVP Token
      • Vision 2027
    • Blockchain Automation
      • Glossary
    • PowerAgent Stats
    • How to contribute
    • Contracts and Links
  • Power Agent
    • 🎯PowerAgent features
    • 🏛️Architecture
      • ℹ️Agent
      • ℹ️Keeper
      • ℹ️Job
        • Full Specification
    • 📜User Guides and Instructions
      • ❓I Want to Automate my Tasks
        • Job Registration Guide
      • ❓I Want to Become a Keeper
    • ℹ️Scenarios
    • ⌛Old Pages
      • Installation Guide (Old)
        • Prerequisites
        • DAppNode Installation
        • Registering in PowerAgent
        • Installing PowerAgent Package on DAppNode
        • Standalone Installation
        • Chain-specific configs
      • Keeper (Old)
        • Keeper Registration and Update
        • Keeper staking, withdrawal, and deactivation
          • Keeper activation and deactivation in PPAgentV2RANDAO
        • Keeper assignment and release in RanDAO realisation
      • Job (Old)
        • Job Registration & Update
        • Job funds deposition and withdrawal
      • Agent (old)
        • Page
        • Execution
      • Technical Implementation (Old)
        • Hooks and helper functions
        • Errors
        • Modifiers
          • Flags
      • Job Registration Guide (Old)
      • 📑Testnet Rules
      • Slashing
        • Copy of Slashing
      • Task Reward and Gas Compensation
        • Fees and income sources
        • Copy of Task Reward and Gas Compensation
  • PowerPool Incentives
    • PowerPool Points Program
  • Security
    • Bug Bounty
    • Security Audits
  • Research
    • Automation Networks Research
      • Approaches on Keeper Selection
      • On-chain Random Number Generation
      • Keeper Weighing
      • 🌊PowerPool & PowerAgent Automation Network
      • Value Proposition-PowerPool
    • PowerAgent v2.1
      • Keeper Selection
      • Hooks
  • Resources
    • Website
    • Twitter
    • Medium
    • Discord
    • Github
    • Telegram
    • Governance Voting
    • Governance Forum
  • Legacy & Deprecated
    • Index Products
      • $YLA: Yearn Lazy Ape
        • Invest (ZAP) in YLA with low fees
        • Instant YLA mint via USDC
        • $CVP Boost Program
        • Redeem YLA
        • YLA Onsen Liquidity Mining [deprecated]
      • $BSCDEFI: BSC DeFi Pool/Index
        • Guide: Mint $BSCDEFI with $BNB
        • Guide: Multi-Asset $BSCDEFI Mint
        • Guide: PancakeSwap LM Farming
        • Add $BSCDEFI to MetaMask.
        • Redeem $BSCDEFI
      • $ASSY: Aave, SushiSwap, Synthetix, and Yearn Index
        • $CVP Boost Program
        • Underlying Token Staking
      • $PIPT: PowerIndex Pool
      • $YETI: Yearn Ecosystem Index
      • Market Price vs Fair Value
      • About ZAP
    • CVP reward program
      • How to create a DCA flow in Partitura
Powered by GitBook
On this page
  • Overview
  • Functions
  • Keeper Management
  • Job Management
  • Transaction Execution
  • Slashing
  • Job Update
  • Keeper Removal

Was this helpful?

  1. Power Agent
  2. Architecture

Agent

Core PowerAgent contract

PreviousArchitectureNextKeeper

Last updated 1 year ago

Was this helpful?

Overview

The PPAgentV2 (later The Agent) is the key PowerAgent contract that stores the state of the PowerAgent network. It includes the list of keepers, the logic of task execution, and keeper management.

PPAgentV2 is an upgradeable descendant, direct or indrect, of the PPAgentV2.sol contract.

Functions

The Agent is responsible for all operations in the PowerAgent network. It manages the interactions related to keepers, stakes, Jobs, and relays execution calls from the keepers to the target contracts.

The scheme above is non-exhaustive. It is only for general understanding.

Keeper Management

Registration, activation and deactivation.

In order to partake in the PowerAgent, a keeper must be register in the Agent and stake a minimum amount of CVP. See the Keeper page for detailed information about keepers. The keeper may be deactivated and reactivated (for example, to perform maintenance on the machine running the PowerAgent software).

Stake Management

A keeper owner may top up or withdraw CVP from the keeper’s balance. Note that staking occurs instantly, but withdrawal comes with a cooldown for security reasons.

Rewards Management

If a keeper is configured to accrue rewards on the Agent contract, the owner may withdraw the rewards from the Agent. Rewards withdrawal is not affected by cooldown.

Job Management

Users can automate their tasks by submitting a Job into the PowerAgent network. This is done through the Agent contract. See the Job section for more details.

Inside the Agent, the Job is represented as a binary data structure and contains target contract address, target function selector and various configuration entries.

Every keeper receives native token rewards for executions. For the Job to be executed, the Job Owner has to top up its balance (or select the Owner Balance as a source of reward).

The credits may be withdrawn at any time (if the remaining credit balance is too low for execution, the job will be automatically deactivated).

Transaction Execution

When the conditions for execution of a certain job are met, the keeper calls execute function of the Agent. The Agent ensures that the task indeed should be executed and all keeper checks are passed and then relays the call to the target function.

From the target contract point of view, the msg.sender is the Agent, and the tx.origin is the keeper which initiated the transaction.

Slashing

The PowerAgent has the algorithm of punishment for malicious or negligent keepers. Various tasks can have different cost of no execution, and expensive tasks require stable and reliable execution. To prevent keepers from misbehavior, the slashing system is implemented in the Agent. If the execution of a task is failed (or not performed in time), the keeper is slashed for a certain portion of their CVP stake. This portion depends on the task specific minimal CVP stake and the cost of no execution.

To execute the task (once the conditions for execution are met), the keeper invokes the Agent's execution endpoint. After a series of check-ups, the call is passed by the Agent to the Job contract and the task is executed, or in case of any errors, the execution will revert with a corresponding error.

Job Update

Most of the Job parameters (aside from the purely technical ones), like, for instance, the calldata source or the minimal admissible stake, can be changed by the Job owner via the interface.

Keeper Removal

A Keeper cannot be removed from the mapping, but he can be deactivated, and his stake can be withdrawn. A recommended procedure is to disable the keeper, wait for all the jobs assigned to it, if any, to slash (for this reason it is recommended to disable the keeper which has no jobs assigned), and initiate redemption of its stake. Once a cooldown period set by the Agent config passes, finalize redemption, and the previously staked CVP will have been freed.

Detailed information on the contract may be found .

More details are given on the .

🏛️
ℹ️
here
Schematic representation of the Agent structure
Keeper page