Keeper (Old)

The Keeper is the one who initiates execution of a task.

Overview

The keeper is a combination of two blockchain addresses and an off-chain bot. The purpose of the bot is to watch all jobs available in the PowerAgent and offer its candidature for task execution as soon as the conditions for the execution are met.

Keeper is an externally owned account linked to an abstract Keeper object by a key-Worker (abstract object used in PowerAgent to represent keepers) relation; groups of Workers also may share Admins. The purpose of the keeper to invoke Agent's function execute_44g58pv when conditions are met.

Addresses

A keeper needs two addresses: Admin address for management and Worker address for execution.

  • Admin - this address is used for management of CVP stake and registration and configuration of Worker addresses.

  • Worker - is registered as the keeper address in the Agent contract. On behalf of this address the tasks are executed. The rewards may be configured to be paid immediately to this address or be collected on the Agent contract and thereafter withdrawn, refer to <section>.

Bot

The bot connects to the blockchain via a websocket RPC connection and continuously listens to events from the blockchain. When the conditions for the execution are met, the bot sends the transaction from the Worker address to the Agent contract. It is recommended to set up a private node to maintain the quality of connection on one's own.

\cdot \cdot \cdot

Specification

This section describes the on-chain part of the Keeper only. For off-chain software, refer to the <section>.

Structure

The Keeper is represented in the Agent as the following structure Keeper:

Mappings

All mappings related to the Keeper structure in the Agent:

RanDAO-specific mappings

Functions

The list of functions used to manage and update Keeper information:

registerAsKeeper

Registers a new keeper and stores the information in the corresponding mappings.

setWorkerAddress

Updates a keeper’s worker address. Should be called from keeper admin address.

withdrawCompensation

Immediately withdraws the keeper’s compensation in native tokens.

stake

Deposits CVP to a given keeper’s stake.

initiateRedeem

Prepares CVP for withdrawal by first burning staked tokens to compensate the slashed amount (if any) and then accumulating the remainder as amount pending for withdrawal. The cooldown period, specified by the agent config, is re-initiated after every call of the function, even if the pending value before the call was nonzero.

finalizeRedeem

Finalizes CVP withdrawal and sends the previously staked tokens to a specified address.

releaseJob

Manually releases a keeper from executing a job.

Last updated

Was this helpful?