-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement deployment script, deploy to Holesky
- Loading branch information
1 parent
91e985e
commit 38bc698
Showing
17 changed files
with
292 additions
and
38 deletions.
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ out/ | |
!/broadcast | ||
/broadcast/*/31337/ | ||
/broadcast/**/dry-run/ | ||
broadcast/ | ||
|
||
# Docs | ||
docs/ | ||
|
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,5 @@ | ||
[profile.default] | ||
src = "src" | ||
src = "contracts" | ||
out = "out" | ||
libs = ["lib"] | ||
|
||
|
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,53 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
// solhint-disable no-console | ||
pragma solidity 0.8.16; | ||
|
||
import { Script, console } from "forge-std/Script.sol"; | ||
import { ProxyAdmin } from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; | ||
|
||
import { | ||
ITransparentUpgradeableProxy, | ||
TransparentUpgradeableProxy | ||
} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
|
||
import { HSETH } from "../contracts/HSETH.sol"; | ||
|
||
contract DeployHSETH is Script { | ||
event ProxyAdminCreated(address admin); | ||
event HsETHProxy(address proxy); | ||
event HsETHUpgrade(address proxy, address implementation); | ||
|
||
function deployAdmin() public { | ||
address admin = vm.envAddress("HSETH_ADMIN"); | ||
vm.startBroadcast(); | ||
ProxyAdmin proxyAdmin = new ProxyAdmin(); | ||
console.log("ProxyAdmin: ", address(proxyAdmin)); | ||
proxyAdmin.transferOwnership(admin); | ||
emit ProxyAdminCreated(address(proxyAdmin)); | ||
vm.stopBroadcast(); | ||
} | ||
|
||
function proxyDeploy() public { | ||
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); | ||
console.log("hsETH Transparent Proxy: ", address(proxy)); | ||
emit HsETHProxy(address(proxy)); | ||
vm.stopBroadcast(); | ||
} | ||
|
||
function proxyUpgrade() public { | ||
address proxyAdmin = vm.envAddress("PROXY_ADMIN"); | ||
address proxyAddress = vm.envAddress("PROXY_ADDRESS"); | ||
vm.startBroadcast(); | ||
HSETH implementation = new HSETH(); | ||
ITransparentUpgradeableProxy proxy = ITransparentUpgradeableProxy(proxyAddress); | ||
ProxyAdmin(proxyAdmin).upgrade(proxy, address(implementation)); | ||
console.log("hsETH Transparent Proxy Upgraded: ", address(proxyAddress), " to ", address(implementation)); | ||
emit HsETHUpgrade(address(proxyAddress), address(implementation)); | ||
vm.stopBroadcast(); | ||
} | ||
} |
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,51 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
// solhint-disable no-console | ||
pragma solidity 0.8.16; | ||
|
||
import { Script, console } from "forge-std/Script.sol"; | ||
import { ProxyAdmin } from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; | ||
|
||
import { | ||
ITransparentUpgradeableProxy, | ||
TransparentUpgradeableProxy | ||
} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
|
||
import { StaderHavenStakingManager } from "../contracts/StaderHavenStakingManager.sol"; | ||
import { HSETH } from "../contracts/HSETH.sol"; | ||
|
||
contract DeployStakingManager is Script { | ||
event StakingManagerProxy(address proxy); | ||
event StakingManagerUpgrade(address proxy, address implementation); | ||
|
||
function proxyDeploy() public { | ||
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); | ||
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)); | ||
emit StakingManagerProxy(address(proxy)); | ||
vm.stopBroadcast(); | ||
} | ||
|
||
function proxyUpgrade() public { | ||
address proxyAdmin = vm.envAddress("PROXY_ADMIN"); | ||
address proxyAddress = vm.envAddress("PROXY_ADDRESS"); | ||
vm.startBroadcast(); | ||
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)); | ||
emit StakingManagerUpgrade(address(proxyAddress), address(implementation)); | ||
vm.stopBroadcast(); | ||
} | ||
} |
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
Oops, something went wrong.