Skip to content

Commit

Permalink
deploy-script-modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
manoj9april committed May 16, 2024
1 parent 5ebe313 commit b96bcd2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
8 changes: 5 additions & 3 deletions script/HSETH.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
20 changes: 17 additions & 3 deletions script/StaderHavenStakingManager.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,34 @@ 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");
address treasury = vm.envAddress("TREASURY");
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();
}
Expand All @@ -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();
}
Expand Down

0 comments on commit b96bcd2

Please sign in to comment.