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.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;}
After implementation, you can deploy the contract on the same L1 network as the AvsGovernance.
You should deploy the AVS contracts before deploying the AVSGovernanceLogic.
After deployment, you must call the setAvsGovernanceLogic function on the AvsGovernance , providing the address of the AvsGovernanceLogic contract as a parameter, as shown in the below example.
Note that only the AVS Governance Multisig is authorized to call this function.
Now, the AVS contracts are set and ready to be used ✅
Examples
Gated Operators
As an AVS, you might wish to whitelist operators' registrations. 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.