From b96bcd219dea359f170cae9c49f44deb8fb6d79c Mon Sep 17 00:00:00 2001 From: Manoj Patra Date: Thu, 16 May 2024 10:12:04 +0530 Subject: [PATCH] deploy-script-modifications --- script/HSETH.s.sol | 8 +++++--- script/StaderHavenStakingManager.s.sol | 20 +++++++++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/script/HSETH.s.sol b/script/HSETH.s.sol index 983c6f3..08ef784 100644 --- a/script/HSETH.s.sol +++ b/script/HSETH.s.sol @@ -28,12 +28,14 @@ contract DeployHSETH is Script { } function proxyDeploy() public { - address admin = vm.envAddress("HSETH_ADMIN"); + address tempAdmin = msg.sender; + // address admin = vm.envAddress("HSETH_ADMIN"); address proxyAdmin = vm.envAddress("PROXY_ADMIN"); vm.startBroadcast(); HSETH implementation = new HSETH(); - bytes memory initializationCalldata = abi.encodeWithSelector(implementation.initialize.selector, admin); - TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(implementation), proxyAdmin, initializationCalldata); + bytes memory initializationCalldata = abi.encodeWithSelector(implementation.initialize.selector, tempAdmin); + TransparentUpgradeableProxy proxy = + new TransparentUpgradeableProxy(address(implementation), proxyAdmin, initializationCalldata); console.log("hsETH Transparent Proxy: ", address(proxy)); emit HsETHProxy(address(proxy)); vm.stopBroadcast(); diff --git a/script/StaderHavenStakingManager.s.sol b/script/StaderHavenStakingManager.s.sol index 9a9cf5e..3fcfbe1 100644 --- a/script/StaderHavenStakingManager.s.sol +++ b/script/StaderHavenStakingManager.s.sol @@ -17,7 +17,10 @@ contract DeployStakingManager is Script { event StakingManagerProxy(address proxy); event StakingManagerUpgrade(address proxy, address implementation); + bytes32 constant ADMIN_ROLE = 0x00; + function proxyDeploy() public { + address tempAdmin = msg.sender; address admin = vm.envAddress("HSETH_ADMIN"); address proxyAdmin = vm.envAddress("PROXY_ADMIN"); address hsETH = vm.envAddress("HSETH"); @@ -25,14 +28,23 @@ contract DeployStakingManager is Script { address staderConfig = vm.envAddress("STADER_CONFIG"); vm.startBroadcast(); StaderHavenStakingManager implementation = new StaderHavenStakingManager(); - bytes memory initializationCalldata = abi.encodeWithSelector(implementation.initialize.selector, admin, hsETH, treasury, staderConfig); - TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(implementation), proxyAdmin, initializationCalldata); + bytes memory initializationCalldata = + abi.encodeWithSelector(implementation.initialize.selector, tempAdmin, hsETH, treasury, staderConfig); + TransparentUpgradeableProxy proxy = + new TransparentUpgradeableProxy(address(implementation), proxyAdmin, initializationCalldata); console.log("StakingManager Transparent Proxy: ", address(proxy)); StaderHavenStakingManager staderHavenStakingManager = StaderHavenStakingManager(address(proxy)); staderHavenStakingManager.grantRole(staderHavenStakingManager.MANAGER(), admin); HSETH hsETHToken = HSETH(hsETH); hsETHToken.grantRole(hsETHToken.MINTER_ROLE(), address(staderHavenStakingManager)); hsETHToken.grantRole(hsETHToken.BURNER_ROLE(), address(staderHavenStakingManager)); + + hsETHToken.grantRole(ADMIN_ROLE, admin); + staderHavenStakingManager.grantRole(ADMIN_ROLE, admin); + + hsETHToken.renounceRole(ADMIN_ROLE, tempAdmin); + staderHavenStakingManager.renounceRole(ADMIN_ROLE, tempAdmin); + emit StakingManagerProxy(address(proxy)); vm.stopBroadcast(); } @@ -44,7 +56,9 @@ contract DeployStakingManager is Script { StaderHavenStakingManager implementation = new StaderHavenStakingManager(); ITransparentUpgradeableProxy proxy = ITransparentUpgradeableProxy(proxyAddress); ProxyAdmin(proxyAdmin).upgrade(proxy, address(implementation)); - console.log("StakingManager Transparent Proxy Upgraded: ", address(proxyAddress), " to ", address(implementation)); + console.log( + "StakingManager Transparent Proxy Upgraded: ", address(proxyAddress), " to ", address(implementation) + ); emit StakingManagerUpgrade(address(proxyAddress), address(implementation)); vm.stopBroadcast(); }