Keeper Registration and Update

To participate in PowerAgent network, the user has to register their keeper worker address in the Agent contract.

Overview

ā‹…ā‹…ā‹…\cdot \cdot \cdot

Specification

Keeper registration

The caller provides worker address (which is used in the off-chain keeper software configuration) and initial CVP deposit for stake.

Each new keeper is assigned an id (id of the previous registered keeper, incremented by 1, starting from 0).

function registerAsKeeper(
    
    //address of the keeper worker account
    address worker_,
    
    //initial CVP deposit amount to stake for this worker
    uint256 initialDepositAmount
    
    //returns id of the newly registered keeper
    ) public virtual returns (uint256 keeperId)
{
    //worker address is not already assigned to any registered keeper in the Agent contract
    _assertWorkerNotAssigned();
    
    //CVP is not less than the minimal allowed CVP stake
    _minKeeperCvpAssertion();
}

A single keeper address can have multiple workers assigned to the same Admin contract.

Once the registration is complete, the keeper is assumed to be up and running. It will start participating in the network as soon as the off-chain software is configured and launched.

Worker address update

If for any reason the keeper wants to change their worker address, a function setWorkerAddress is used.

The mappings workerKeeperIds and keepers are updated accordingly.

Upon successful change of the worker address the function emits

event SetWorkerAddress(
    //id of the keeper for which the worker address was changed
    keeperId_,
    
    //previous worker address
    prev,
    
    //new worker address
    worker
)

Last updated