Operator Management

Overview

The AVSGovernance contract is responsible for operator registration and deregistration. The Othentic Stack allows developers to implement their custom logics during this process.

The IAVSGovernanceLogic provides pre and post execution hooks for operator registration and deregistration on-chain.

Interface

The interface defines four functions: before and after operator registration, as well as before and after unregistration. Developers can use these functions to implement custom logic during these events.

// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.20;

/**
 * @author Othentic Labs LTD.
 * @notice Terms of Service: https://www.othentic.xyz/terms-of-service
 * @notice Depending on the application, it may be necessary to add reentrancy gaurds to hooks
 */
interface IAvsGovernanceLogic {
    function beforeOperatorRegistered(address _operator, uint256 _numOfShares, uint256[4] calldata _blsKey) external;
    function afterOperatorRegistered(address _operator, uint256 _numOfShares, uint256[4] calldata _blsKey) external;
    function beforeOperatorUnregistered(address _operator) external;
    function afterOperatorUnregistered(address _operator) external;
}

These functions are called inside the registerAsOperator and unRegisterAsOperator functions respectively.

function _registerAsOperator(address _operator, uint256[4] calldata _blsKey) internal {
        AvsGovernanceStorageData storage _avsGovernanceStorageData = _getStorage();
        IAvsGovernanceLogic _avsGovernanceLogic = _avsGovernanceStorageData.avsGovernanceLogic;
        bool _isAvsGovernanceLogicSet = address(_avsGovernanceLogic) != address(0);
        
        if (_isAvsGovernanceLogicSet) {
            _avsGovernanceLogic.beforeOperatorRegistered(_operator, _numOfShares, _blsKey);
        }
        ...
        if (_isAvsGovernanceLogicSet) {
            _avsGovernanceLogic.afterOperatorRegistered(_operator, _numOfShares, _blsKey);
        }
    }

Use cases

Dynamic Operator Allocation to Task Definition

AVSs may require dynamically assigning specific operators to Task Definition based on predefined conditions. This can be implemented using the beforeOperatorRegistered and afterOperatorRegistered hooks.

Usage

  • Operators can be assigned dynamically to specific Task definition based on their expertise.

function afterOperatorRegistered(address _operator, uint256 _numOfShares, uint256[4] calldata _blsKey) external override {
         _assignOperatorToTasks(_operator);
         emit OperatorAssignedToTask();
}
 
function _assignOperatorToTasks(address _operator) internal {
     // Custom logic to dynamically set operators for tasks
}

Gated Operator Registrations

AVSs may require whitelisting operators before allowing registration. This can be enforced via the beforeOperatorRegistered function.

Usage

  • Whitelisting: Maintain a list of approved operators.

function beforeOperatorRegistered(address _operator, uint256 _numOfShares, uint256[4] calldata _blsKey) external {
    require(isWhitelisted[_operator], "Operator is not whitelisted");
}
  • Token-Gated Access: Require operators to hold a specific NFT or ERC-20 token.

  • Reputation-Based Selection: Only allow operators with a certain reputation score to register.


Post Registration Benefits

Operators that register to your AVS can be granted NFTs or whitelisted to use certain services in your AVS. These can be enabled using the afterOperatorRegistered function.

Usage

  • NFT Minting: Reward operators with a proof-of-registration NFT.

  • Exclusive Access: Enable operators to use specific AVS features.

  • Token Incentives: Distribute rewards for registered operators.


Last updated