From 6af6805d7064c00bf3221afd49f4467a67794861 Mon Sep 17 00:00:00 2001 From: Bowen Li Date: Tue, 18 Feb 2025 10:03:46 -0800 Subject: [PATCH] feat: add doc --- docs/core/AllocationManager.md | 166 +++++++++++++++++---------------- 1 file changed, 88 insertions(+), 78 deletions(-) diff --git a/docs/core/AllocationManager.md b/docs/core/AllocationManager.md index b7ad01e3c..0b5fe12dd 100644 --- a/docs/core/AllocationManager.md +++ b/docs/core/AllocationManager.md @@ -22,7 +22,9 @@ Libraries and Mixins: ## Overview -The `AllocationManager` manages registration and deregistration of operators to operator sets, handles allocation and slashing of operators' slashable stake, and is the entry point an AVS uses to slash an operator. The `AllocationManager's` responsibilities are broken down into the following concepts: +The `AllocationManager` manages AVS metadata registration, registration and deregistration of operators to operator sets, handles allocation and slashing of operators' slashable stake, and is the entry point an AVS uses to slash an operator. The `AllocationManager's` responsibilities are broken down into the following concepts: + +* [AVS Metadata](#avs-metadata) * [Operator Sets](#operator-sets) * [Allocations and Slashing](#allocations-and-slashing) * [Config](#config) @@ -38,6 +40,91 @@ The `AllocationManager` manages registration and deregistration of operators to --- +## AVS Metadata + +AVSs must register their metadata to declare themselves who they are as the first step, before they can create operator sets or register operators into operator sets. `AllocationManager` keeps track of AVSs that have registered metadata. + +**Methods:** +* [`updateAVSMetadataURI`](#updateavsmetadatauri) + + +#### `updateAVSMetadataURI` + +```solidity +/** + * @notice Called by an AVS to emit an `AVSMetadataURIUpdated` event indicating the information has updated. + * + * @param metadataURI The URI for metadata associated with an AVS. + * + * @dev Note that the `metadataURI` is *never stored* and is only emitted in the `AVSMetadataURIUpdated` event. + */ +function updateAVSMetadataURI( + address avs, + string calldata metadataURI +) + external + checkCanCall(avs) +``` + +_Note: this method can be called directly by an AVS, or by a caller authorized by the AVS. See [`PermissionController.md`](../permissions/PermissionController.md) for details._ + +Below is the format AVSs should use when updating their metadata URI. This is not validated onchain. + +```json +{ + "name": "AVS", + "website": "https.avs.xyz/", + "description": "Some description about", + "logo": "http://github.com/logo.png", + "twitter": "https://twitter.com/avs", + "operatorSets": [ + { + "name": "ETH Set", + "id": "1", // Note: we use this param to match the opSet id in the Allocation Manager + "description": "The ETH operatorSet for AVS", + "software": [ + { + "name": "NetworkMonitor", + "description": "", + "url": "https://link-to-binary-or-github.com" + }, + { + "name": "ValidatorClient", + "description": "", + "url": "https://link-to-binary-or-github.com" + } + ], + "slashingConditions": ["Condition A", "Condition B"] + }, + { + "name": "EIGEN Set", + "id": "2", // Note: we use this param to match the opSet id in the Allocation Manager + "description": "The EIGEN operatorSet for AVS", + "software": [ + { + "name": "NetworkMonitor", + "description": "", + "url": "https://link-to-binary-or-github.com" + }, + { + "name": "ValidatorClient", + "description": "", + "url": "https://link-to-binary-or-github.com" + } + ], + "slashingConditions": ["Condition A", "Condition B"] + } + ] +} +``` + +*Effects*: +* Emits an `AVSMetadataURIUpdated` event for use in offchain services + +*Requirements*: +* Caller MUST be authorized, either as the AVS itself or an admin/appointee (see [`PermissionController.md`](../permissions/PermissionController.md)) + + ## Operator Sets Operator sets, as described in [ELIP-002](https://github.com/eigenfoundation/ELIPs/blob/main/ELIPs/ELIP-002.md#operator-sets), are useful for AVSs to configure operator groupings which can be assigned different tasks, rewarded based on their strategy allocations, and slashed according to different rules. Operator sets are defined in [`libraries/OperatorSetLib.sol`](../../src/contracts/libraries/OperatorSetLib.sol): @@ -665,7 +752,6 @@ Once slashing is processed for a strategy, [slashed stake is burned via the `Del **Methods:** * [`setAllocationDelay`](#setallocationdelay) * [`setAVSRegistrar`](#setavsregistrar) -* [`updateAVSMetadataURI`](#updateavsmetadatauri) #### `setAllocationDelay` @@ -756,79 +842,3 @@ Note that when an operator registers, registration will FAIL if the call to `IAV *Requirements*: * Caller MUST be authorized, either as the AVS itself or an admin/appointee (see [`PermissionController.md`](../permissions/PermissionController.md)) - -#### `updateAVSMetadataURI` - -```solidity -/** - * @notice Called by an AVS to emit an `AVSMetadataURIUpdated` event indicating the information has updated. - * - * @param metadataURI The URI for metadata associated with an AVS. - * - * @dev Note that the `metadataURI` is *never stored* and is only emitted in the `AVSMetadataURIUpdated` event. - */ -function updateAVSMetadataURI( - address avs, - string calldata metadataURI -) - external - checkCanCall(avs) -``` - -_Note: this method can be called directly by an AVS, or by a caller authorized by the AVS. See [`PermissionController.md`](../permissions/PermissionController.md) for details._ - -Below is the format AVSs should use when updating their metadata URI. This is not validated onchain. - -```json -{ - "name": "AVS", - "website": "https.avs.xyz/", - "description": "Some description about", - "logo": "http://github.com/logo.png", - "twitter": "https://twitter.com/avs", - "operatorSets": [ - { - "name": "ETH Set", - "id": "1", // Note: we use this param to match the opSet id in the Allocation Manager - "description": "The ETH operatorSet for AVS", - "software": [ - { - "name": "NetworkMonitor", - "description": "", - "url": "https://link-to-binary-or-github.com" - }, - { - "name": "ValidatorClient", - "description": "", - "url": "https://link-to-binary-or-github.com" - } - ], - "slashingConditions": ["Condition A", "Condition B"] - }, - { - "name": "EIGEN Set", - "id": "2", // Note: we use this param to match the opSet id in the Allocation Manager - "description": "The EIGEN operatorSet for AVS", - "software": [ - { - "name": "NetworkMonitor", - "description": "", - "url": "https://link-to-binary-or-github.com" - }, - { - "name": "ValidatorClient", - "description": "", - "url": "https://link-to-binary-or-github.com" - } - ], - "slashingConditions": ["Condition A", "Condition B"] - } - ] -} -``` - -*Effects*: -* Emits an `AVSMetadataURIUpdated` event for use in offchain services - -*Requirements*: -* Caller MUST be authorized, either as the AVS itself or an admin/appointee (see [`PermissionController.md`](../permissions/PermissionController.md)) \ No newline at end of file