Skip to content

Commit

Permalink
deploy proxyAdmind
Browse files Browse the repository at this point in the history
  • Loading branch information
aroralanuk committed May 9, 2024
1 parent e62daa4 commit b2e1643
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 22 deletions.
19 changes: 16 additions & 3 deletions solidity/contracts/avs/ECDSAServiceManagerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ abstract contract ECDSAServiceManagerBase is
/// @notice Address of the AVS directory contract, which manages AVS-related data for registered operators.
address public immutable avsDirectory;

/// @notice Address of the payment coordinator contract, which handles payment distributions.
address internal immutable paymentCoordinator;

/// @notice Address of the delegation manager contract, which manages staker delegations to operators.
address internal immutable delegationManager;

// ============ Public Storage ============

/// @notice Address of the payment coordinator contract, which handles payment distributions. Will be set once live on Eigenlayer.
address internal paymentCoordinator;

// ============ Modifiers ============

/**
Expand Down Expand Up @@ -136,6 +138,17 @@ abstract contract ECDSAServiceManagerBase is
return _getOperatorRestakedStrategies(_operator);
}

/**
* @notice Sets the address of the payment coordinator contract.
* @dev This function is only callable by the contract owner.
* @param _paymentCoordinator The address of the payment coordinator contract.
*/
function setPaymentCoordinator(
address _paymentCoordinator

Check notice

Code scanning / Slither

Missing zero address validation Low

) external virtual onlyOwner {
paymentCoordinator = _paymentCoordinator;
}

/**
* @notice Forwards the call to update AVS metadata URI in the AVSDirectory contract.
* @dev This internal function is a proxy to the `updateAVSMetadataURI` function of the AVSDirectory contract.
Expand Down
49 changes: 32 additions & 17 deletions solidity/script/avs/DeployAVS.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ contract DeployAVS is Script {
);
string memory json = vm.readFile(path);

proxyAdmin = ProxyAdmin(
json.readAddress(
string(abi.encodePacked(".", targetEnv, ".proxyAdmin"))
)
);
avsDirectory = IAVSDirectory(
json.readAddress(
string(abi.encodePacked(".", targetEnv, ".avsDirectory"))
Expand Down Expand Up @@ -77,7 +72,7 @@ contract DeployAVS is Script {
for (uint96 i = 0; i < strategyCount; i++) {
// the multipliers need to add up to 10,000, so we divide the total by the number of strategies for the first n-1 strategies
// and then the last strategy gets the remainder
if (i < strategies.length - 1) {
if (i < strategyCount - 1) {
multiplier = totalMultipliers / uint96(strategyCount);
} else {
multiplier =
Expand All @@ -100,12 +95,20 @@ contract DeployAVS is Script {

vm.startBroadcast(deployerPrivateKey);

proxyAdmin = new ProxyAdmin();

ECDSAStakeRegistry stakeRegistryImpl = new ECDSAStakeRegistry(
delegationManager
);
TransparentUpgradeableProxy stakeRegistryProxy = new TransparentUpgradeableProxy(
address(stakeRegistryImpl),
address(proxyAdmin),
""
);

HyperlaneServiceManager strategyManagerImpl = new HyperlaneServiceManager(
address(avsDirectory),
address(stakeRegistryImpl),
address(stakeRegistryProxy),
address(paymentCoordinator),
address(delegationManager)
);
Expand All @@ -118,16 +121,28 @@ contract DeployAVS is Script {
msg.sender
)
);
TransparentUpgradeableProxy stakeRegistryProxy = new TransparentUpgradeableProxy(
address(stakeRegistryImpl),
address(proxyAdmin),
abi.encodeWithSelector(
ECDSAStakeRegistry.initialize.selector,
address(hsmProxy),
thresholdWeight,
quorum
)
);

// Initialize the ECDSAStakeRegistry once we have the HyperlaneServiceManager proxy
(bool success, ) = address(stakeRegistryProxy).call(
abi.encodeWithSelector(
ECDSAStakeRegistry.initialize.selector,
address(hsmProxy),
thresholdWeight,
quorum
)
);
require(success, "Failed to initialize ECDSAStakeRegistry");

console.log(
"ECDSAStakeRegistry Implementation: ",
address(stakeRegistryImpl)
);
console.log(
"HyperlaneServiceManager Implementation: ",
address(strategyManagerImpl)
);
console.log("StakeRegistry Proxy: ", address(stakeRegistryProxy));
console.log("HyperlaneServiceManager Proxy: ", address(hsmProxy));

vm.stopBroadcast();
}
Expand Down
2 changes: 0 additions & 2 deletions solidity/script/avs/eigenlayer_addresses.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"ethereum": {
"proxyAdmin": "0x75EE15Ee1B4A75Fa3e2fDF5DF3253c25599cc659",
"delegationManager": "0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A",
"avsDirectory": "0x135DDa560e946695d6f155dACaFC6f1F25C1F5AF",
"paymentCoordinator": "",
Expand All @@ -20,7 +19,6 @@
]
},
"holesky": {
"proxyAdmin": "",
"delegationManager": "0xA44151489861Fe9e3055d95adC98FbD462B948e7",
"avsDirectory": "0x055733000064333CaDDbC92763c58BF0192fFeBf",
"paymentCoordinator": "",
Expand Down

0 comments on commit b2e1643

Please sign in to comment.