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
// SPDX-License-Identifier: BUSL-1.1pragmasolidity >=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 {functionbeforeOperatorRegistered(address_operator,uint256_numOfShares,uint256[4] calldata_blsKey) external;functionafterOperatorRegistered(address_operator,uint256_numOfShares,uint256[4] calldata_blsKey) external;functionbeforeOperatorUnregistered(address_operator) external;functionafterOperatorUnregistered(address_operator) external;}
The interface declares 4 functions, before and after operator registration and unregistration. Developers can implement custom logic during these events.
After implementation, you can deploy the contract on the same L1 network as the AvsGovernance. Note that you should deploy the Othentic contracts before deploying the Avs Governance Logic.
After deploying, you need to call the setAvsGovernanceLogic function on the AvsGovernance and pass in the address of the AvsGovernnaceLogic as the parameter. Now, the AVS contracts are set and ready to be used.
Examples
Gated Operators
As an AVS, you might wish to whitelist operators that register to your AVS. That can be done using the beforeOperatorRegister function. You can handle the whitelisting in your contract or use a token gating system.
Post Registration Benefits
Operators that register to your AVS can be minted NFTs or whitelisted to use certain services in your AVS. These can be enabled using the afterOperatorRegsiter function.