-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4fa900
commit d5dd7b3
Showing
6 changed files
with
552 additions
and
179 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ script/output/M1_deployment_data.json | |
/docs/docgen/ | ||
|
||
script/misc | ||
script/output | ||
|
||
test.sh | ||
|
||
|
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
44 changes: 44 additions & 0 deletions
44
script/configs/devnet/M2_deploy_from_scratch.devnet.config.json
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,44 @@ | ||
{ | ||
"maintainer": "[email protected]", | ||
"multisig_addresses": { | ||
"operationsMultisig": "0x4a3Ee341f8ceEdB790F511A18899fBC1fdEb35af", | ||
"pauserMultisig": "0x4a3Ee341f8ceEdB790F511A18899fBC1fdEb35af", | ||
"executorMultisig": "0x4a3Ee341f8ceEdB790F511A18899fBC1fdEb35af" | ||
}, | ||
"strategies": [], | ||
"strategyManager": { | ||
"init_paused_status": 0, | ||
"init_withdrawal_delay_blocks": 1 | ||
}, | ||
"eigenPod": { | ||
"PARTIAL_WITHDRAWAL_FRAUD_PROOF_PERIOD_BLOCKS": 1, | ||
"MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR": "32000000000" | ||
}, | ||
"eigenPodManager": { | ||
"init_paused_status": 30 | ||
}, | ||
"delayedWithdrawalRouter": { | ||
"init_paused_status": 0, | ||
"init_withdrawal_delay_blocks": 1 | ||
}, | ||
"slasher": { | ||
"init_paused_status": 0 | ||
}, | ||
"delegation": { | ||
"init_paused_status": 0, | ||
"init_withdrawal_delay_blocks": 1 | ||
}, | ||
"rewardsCoordinator": { | ||
"init_paused_status": 0, | ||
"CALCULATION_INTERVAL_SECONDS": 604800, | ||
"MAX_REWARDS_DURATION": 6048000, | ||
"MAX_RETROACTIVE_LENGTH": 7776000, | ||
"MAX_FUTURE_LENGTH": 2592000, | ||
"GENESIS_REWARDS_TIMESTAMP": 1710979200, | ||
"rewards_updater_address": "0x18a0f92Ad9645385E8A8f3db7d0f6CF7aBBb0aD4", | ||
"activation_delay": 7200, | ||
"calculation_interval_seconds": 604800, | ||
"global_operator_commission_bips": 1000 | ||
}, | ||
"ethPOSDepositAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa" | ||
} |
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,151 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.12; | ||
|
||
import {stdJson} from "forge-std/StdJson.sol"; | ||
import {console2} from "forge-std/console2.sol"; | ||
import {VmSafe} from "forge-std/Vm.sol"; | ||
|
||
struct ContractDeployment { | ||
address avsDirectory; | ||
address avsDirectoryImplementation; | ||
address baseStrategyImplementation; | ||
address delegationManager; | ||
address delegationManagerImplementation; | ||
address eigenPodBeacon; | ||
address eigenPodImplementation; | ||
address eigenPodManager; | ||
address eigenPodManagerImplementation; | ||
address emptyContract; | ||
address pauserRegistry; | ||
address proxyAdmin; | ||
address rewardsCoordinator; | ||
address rewardsCoordinatorImplementation; | ||
address slasher; | ||
address slasherImplementation; | ||
address strategyManager; | ||
address strategyManagerImplementation; | ||
address ethDepositAddress; | ||
} | ||
|
||
library DeploymentDetails { | ||
VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); | ||
|
||
function write( | ||
ContractDeployment calldata deploymentDetails, | ||
address executorMultisig, | ||
address operationsMultisig, | ||
address nilContract | ||
) external { | ||
// WRITE JSON DATA | ||
string memory parentObject = "parent object"; | ||
|
||
string memory deployedAddresses = "address"; | ||
vm.serializeAddress(deployedAddresses, "proxyAdmin", deploymentDetails.proxyAdmin); | ||
vm.serializeAddress(deployedAddresses, "pauserRegistry", deploymentDetails.pauserRegistry); | ||
vm.serializeAddress(deployedAddresses, "slasher", deploymentDetails.slasher); | ||
vm.serializeAddress(deployedAddresses, "slasherImplementation", deploymentDetails.slasherImplementation); | ||
vm.serializeAddress(deployedAddresses, "delegationManager", deploymentDetails.delegationManager); | ||
vm.serializeAddress( | ||
deployedAddresses, | ||
"delegationManagerImplementation", | ||
deploymentDetails.delegationManagerImplementation | ||
); | ||
vm.serializeAddress(deployedAddresses, "avsDirectory", deploymentDetails.avsDirectory); | ||
vm.serializeAddress( | ||
deployedAddresses, | ||
"avsDirectoryImplementation", | ||
deploymentDetails.avsDirectoryImplementation | ||
); | ||
vm.serializeAddress(deployedAddresses, "strategyManager", deploymentDetails.strategyManager); | ||
vm.serializeAddress( | ||
deployedAddresses, | ||
"strategyManagerImplementation", | ||
deploymentDetails.strategyManagerImplementation | ||
); | ||
vm.serializeAddress(deployedAddresses, "eigenPodManager", deploymentDetails.eigenPodManager); | ||
vm.serializeAddress( | ||
deployedAddresses, | ||
"eigenPodManagerImplementation", | ||
deploymentDetails.eigenPodManagerImplementation | ||
); | ||
vm.serializeAddress(deployedAddresses, "rewardsCoordinator", deploymentDetails.rewardsCoordinator); | ||
vm.serializeAddress( | ||
deployedAddresses, | ||
"rewardsCoordinatorImplementation", | ||
deploymentDetails.rewardsCoordinatorImplementation | ||
); | ||
vm.serializeAddress(deployedAddresses, "eigenPodBeacon", deploymentDetails.eigenPodBeacon); | ||
vm.serializeAddress(deployedAddresses, "eigenPodImplementation", deploymentDetails.eigenPodImplementation); | ||
vm.serializeAddress( | ||
deployedAddresses, | ||
"baseStrategyImplementation", | ||
deploymentDetails.baseStrategyImplementation | ||
); | ||
vm.serializeAddress(deployedAddresses, "emptyContract", nilContract); | ||
vm.serializeAddress(deployedAddresses, "ethDepositAddress", deploymentDetails.ethDepositAddress); | ||
|
||
string memory deployedAddressesOutput = vm.serializeString(deployedAddresses, "strategies", ""); | ||
|
||
string memory parameters = "parameters"; | ||
vm.serializeAddress(parameters, "executorMultisig", executorMultisig); | ||
string memory parametersOutput = vm.serializeAddress(parameters, "operationsMultisig", operationsMultisig); | ||
|
||
string memory chainInfo = "chainInfo"; | ||
vm.serializeUint(chainInfo, "deploymentBlock", block.number); | ||
string memory chainInfo_output = vm.serializeUint(chainInfo, "chainId", block.chainid); | ||
|
||
// serialize all the data | ||
vm.serializeString(parentObject, deployedAddresses, deployedAddressesOutput); | ||
vm.serializeString(parentObject, chainInfo, chainInfo_output); | ||
string memory finalJson = vm.serializeString(parentObject, parameters, parametersOutput); | ||
// TODO: should output to different file depending on configFile passed to run() | ||
// so that we don't override mainnet output by deploying to goerli for eg. | ||
vm.writeJson(finalJson, "script/output/devnet/M2_deploy_from_scratch_deployment_data.json"); | ||
console2.log("Deployment data written to script/output/devnet/M2_deploy_from_scratch_deployment_data.json"); | ||
} | ||
|
||
function read(string memory deploymentFileName) external returns (ContractDeployment memory) { | ||
string memory deployDetailsPath = string(bytes(string.concat("script/output/devnet/", deploymentFileName))); | ||
string memory deployData = vm.readFile(deployDetailsPath); | ||
ContractDeployment memory deploymentDetails; | ||
deploymentDetails.avsDirectory = stdJson.readAddress(deployData, ".address.avsDirectory"); | ||
deploymentDetails.avsDirectoryImplementation = stdJson.readAddress( | ||
deployData, | ||
".address.avsDirectoryImplementation" | ||
); | ||
deploymentDetails.baseStrategyImplementation = stdJson.readAddress( | ||
deployData, | ||
".address.baseStrategyImplementation" | ||
); | ||
deploymentDetails.delegationManager = stdJson.readAddress(deployData, ".address.delegationManager"); | ||
deploymentDetails.delegationManagerImplementation = stdJson.readAddress( | ||
deployData, | ||
".address.delegationManagerImplementation" | ||
); | ||
deploymentDetails.eigenPodBeacon = stdJson.readAddress(deployData, ".address.eigenPodBeacon"); | ||
deploymentDetails.eigenPodImplementation = stdJson.readAddress(deployData, ".address.eigenPodImplementation"); | ||
deploymentDetails.eigenPodManager = stdJson.readAddress(deployData, ".address.eigenPodManager"); | ||
deploymentDetails.eigenPodManagerImplementation = stdJson.readAddress( | ||
deployData, | ||
".address.eigenPodManagerImplementation" | ||
); | ||
deploymentDetails.emptyContract = stdJson.readAddress(deployData, ".address.emptyContract"); | ||
deploymentDetails.pauserRegistry = stdJson.readAddress(deployData, ".address.pauserRegistry"); | ||
deploymentDetails.proxyAdmin = stdJson.readAddress(deployData, ".address.proxyAdmin"); | ||
deploymentDetails.rewardsCoordinator = stdJson.readAddress(deployData, ".address.rewardsCoordinator"); | ||
deploymentDetails.rewardsCoordinatorImplementation = stdJson.readAddress( | ||
deployData, | ||
".address.rewardsCoordinatorImplementation" | ||
); | ||
deploymentDetails.slasher = stdJson.readAddress(deployData, ".address.slasher"); | ||
deploymentDetails.slasherImplementation = stdJson.readAddress(deployData, ".address.slasherImplementation"); | ||
deploymentDetails.strategyManager = stdJson.readAddress(deployData, ".address.strategyManager"); | ||
deploymentDetails.strategyManagerImplementation = stdJson.readAddress( | ||
deployData, | ||
".address.strategyManagerImplementation" | ||
); | ||
deploymentDetails.ethDepositAddress = stdJson.readAddress(deployData, ".address.ethDepositAddress"); | ||
|
||
return deploymentDetails; | ||
} | ||
} |
Oops, something went wrong.