Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy-script-modifications #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, deployerAdmin

// 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this makes sense. Lets call that 'deployerAdmin'

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
Loading