|
| 1 | +[middleware-repo]: https://github.com/Layr-Labs/eigenlayer-middleware/ |
| 2 | + |
| 3 | +## AVSDirectory |
| 4 | + |
| 5 | +| File | Type | Proxy | |
| 6 | +| -------- | -------- | -------- | |
| 7 | +| [`AVSDirectory.sol`](../src/contracts/core/AVSDirectory.sol) | Singleton | Transparent proxy | |
| 8 | + |
| 9 | +The `AVSDirectory` handles interactions between AVSs and the EigenLayer core contracts. Once registered as an Operator in EigenLayer core (via the `DelegationManager`), Operators can register with one or more AVSs (via the AVS's contracts) to begin providing services to them offchain. As a part of registering with an AVS, the AVS will record this registration in the core contracts by calling into the `AVSDirectory`. |
| 10 | + |
| 11 | +For more information on AVS contracts, see the [middleware repo][middleware-repo]. |
| 12 | + |
| 13 | +Currently, the only interactions between AVSs and the core contracts is to track whether Operators are currently registered for the AVS. This is handled by two methods: |
| 14 | +* [`AVSDirectory.registerOperatorToAVS`](#registeroperatortoavs) |
| 15 | +* [`AVSDirectory.deregisterOperatorFromAVS`](#deregisteroperatorfromavs) |
| 16 | + |
| 17 | +In a future release, this contract will implement additional interactions that relate to (i) paying Operators for the services they provide and (ii) slashing Operators that misbehave. Currently, these features are not implemented. |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +#### `registerOperatorToAVS` |
| 22 | + |
| 23 | +```solidity |
| 24 | +function registerOperatorToAVS( |
| 25 | + address operator, |
| 26 | + ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature |
| 27 | +) |
| 28 | + external |
| 29 | + onlyWhenNotPaused(PAUSED_OPERATOR_REGISTER_DEREGISTER_TO_AVS) |
| 30 | +``` |
| 31 | + |
| 32 | +Allows the caller (an AVS) to register an `operator` with itself, given the provided signature is valid. |
| 33 | + |
| 34 | +*Effects*: |
| 35 | +* Sets the `operator's` status to `REGISTERED` for the AVS |
| 36 | + |
| 37 | +*Requirements*: |
| 38 | +* Pause status MUST NOT be set: `PAUSED_OPERATOR_REGISTER_DEREGISTER_TO_AVS` |
| 39 | +* `operator` MUST already be a registered Operator (via the `DelegationManager`) |
| 40 | +* `operator` MUST NOT already be registered with the AVS |
| 41 | +* `operatorSignature` must be a valid, unused, unexpired signature from the `operator`. The signature is an ECDSA signature by the operator over the [`OPERATOR_AVS_REGISTRATION_TYPEHASH`](../../src/contracts/core/DelegationManagerStorage.sol). Expiry is a utc timestamp in seconds. Salt is used only once per signature to prevent replay attacks. |
| 42 | + |
| 43 | +*As of M2*: |
| 44 | +* Operator registration/deregistration does not have any sort of consequences for the Operator or its shares. Eventually, this will tie into payments for services and slashing for misbehavior. |
| 45 | + |
| 46 | +#### `deregisterOperatorFromAVS` |
| 47 | + |
| 48 | +```solidity |
| 49 | +function deregisterOperatorFromAVS( |
| 50 | + address operator |
| 51 | +) |
| 52 | + external |
| 53 | + onlyWhenNotPaused(PAUSED_OPERATOR_REGISTER_DEREGISTER_TO_AVS) |
| 54 | +``` |
| 55 | + |
| 56 | +Allows the caller (an AVS) to deregister an `operator` with itself |
| 57 | + |
| 58 | +*Effects*: |
| 59 | +* Sets the `operator's` status to `UNREGISTERED` for the AVS |
| 60 | + |
| 61 | +*Requirements*: |
| 62 | +* Pause status MUST NOT be set: `PAUSED_OPERATOR_REGISTER_DEREGISTER_TO_AVS` |
| 63 | +* `operator` MUST already be registered with the AVS |
| 64 | + |
| 65 | +*As of M2*: |
| 66 | +* Operator registration/deregistration does not have any sort of consequences for the Operator or its shares. Eventually, this will tie into payments for services and slashing for misbehavior. |
0 commit comments