-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5ac704
commit 8873f20
Showing
6 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
pragma solidity >=0.8.0; | ||
|
||
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
|
||
import {ISignatureUtils} from "@eigenlayer/core/interfaces/ISignatureUtils.sol"; | ||
import {IAVSDirectory} from "@eigenlayer/core/interfaces/IAVSDirectory.sol"; | ||
|
||
import {IStakeRegistry} from "@eigenlayer/middleware/interfaces/IStakeRegistry.sol"; | ||
import {IServiceManager} from "@eigenlayer/middleware/interfaces/IServiceManager.sol"; | ||
|
||
contract HyperlaneServiceManager is IServiceManager, OwnableUpgradeable { | ||
IStakeRegistry internal immutable stakeRegistry; | ||
IAVSDirectory internal immutable elAvsDirectory; | ||
|
||
/// @notice when applied to a function, only allows the ECDSAStakeRegistry to call it | ||
modifier onlyStakeRegistry() { | ||
require( | ||
msg.sender == address(stakeRegistry), | ||
"HyperlaneServiceManager: caller is not the stake registry" | ||
); | ||
_; | ||
} | ||
|
||
constructor(IAVSDirectory _avsDirectory, IStakeRegistry _stakeRegistry) { | ||
elAvsDirectory = _avsDirectory; | ||
stakeRegistry = _stakeRegistry; | ||
_disableInitializers(); | ||
} | ||
|
||
/** | ||
* @notice Updates the metadata URI for the AVS | ||
* @param _metadataURI is the metadata URI for the AVS | ||
* @dev only callable by the owner | ||
*/ | ||
function updateAVSMetadataURI( | ||
string memory _metadataURI | ||
) public virtual onlyOwner { | ||
elAvsDirectory.updateAVSMetadataURI(_metadataURI); | ||
} | ||
|
||
/** | ||
* @notice Forwards a call to EigenLayer's AVSDirectory contract to confirm operator registration with the AVS | ||
* @param operator The address of the operator to register. | ||
* @param operatorSignature The signature, salt, and expiry of the operator's signature. | ||
*/ | ||
function registerOperatorToAVS( | ||
address operator, | ||
ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature | ||
) public virtual onlyStakeRegistry { | ||
elAvsDirectory.registerOperatorToAVS(operator, operatorSignature); | ||
} | ||
|
||
/** | ||
* @notice Forwards a call to EigenLayer's AVSDirectory contract to confirm operator deregistration from the AVS | ||
* @param operator The address of the operator to deregister. | ||
*/ | ||
function deregisterOperatorFromAVS( | ||
address operator | ||
) public virtual onlyStakeRegistry { | ||
elAvsDirectory.deregisterOperatorFromAVS(operator); | ||
} | ||
|
||
/** | ||
* @notice Returns the list of strategies that the AVS supports for restaking | ||
* @dev This function is intended to be called off-chain | ||
* @dev No guarantee is made on uniqueness of each element in the returned array. | ||
* The off-chain service should do that validation separately | ||
*/ | ||
function getRestakeableStrategies() | ||
external | ||
view | ||
returns (address[] memory) | ||
{ | ||
// TODO | ||
return new address[](0); | ||
} | ||
|
||
function getOperatorRestakedStrategies( | ||
address operator | ||
) external view returns (address[] memory) { | ||
// TODO | ||
return new address[](0); | ||
} | ||
|
||
/// @notice Returns the EigenLayer AVSDirectory contract. | ||
function avsDirectory() external view override returns (address) { | ||
return address(elAvsDirectory); | ||
} | ||
|
||
// storage gap for upgradeability | ||
// slither-disable-next-line shadowing-state | ||
uint256[50] private __GAP; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
pragma solidity >=0.8.0; | ||
|
||
/*@@@@@@@ @@@@@@@@@ | ||
@@@@@@@@@ @@@@@@@@@ | ||
@@@@@@@@@ @@@@@@@@@ | ||
@@@@@@@@@ @@@@@@@@@ | ||
@@@@@@@@@@@@@@@@@@@@@@@@@ | ||
@@@@@ HYPERLANE @@@@@@@ | ||
@@@@@@@@@@@@@@@@@@@@@@@@@ | ||
@@@@@@@@@ @@@@@@@@@ | ||
@@@@@@@@@ @@@@@@@@@ | ||
@@@@@@@@@ @@@@@@@@@ | ||
@@@@@@@@@ @@@@@@@@*/ | ||
|
||
interface ITownCrier { | ||
function challengeDelayBlocks() external view returns (uint256); | ||
function handleChallenge(address operator) external; | ||
} |
Submodule eigenlayer-contracts
added at
7229f2
Submodule eigenlayer-middleware
updated
131 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
@openzeppelin=../node_modules/@openzeppelin | ||
@openzeppelin/contracts-upgradeable/=../node_modules/@openzeppelin/contracts-upgradeable/ | ||
@layerzerolabs=../node_modules/@layerzerolabs | ||
@eth-optimism=../node_modules/@eth-optimism | ||
ds-test/=lib/forge-std/lib/ds-test/src/ | ||
forge-std/=lib/forge-std/src/ | ||
@eigenlayer/core/=lib/eigenlayer-contracts/src/contracts/ | ||
@eigenlayer/middleware/=lib/eigenlayer-middleware/src/ |