diff --git a/.gitignore b/.gitignore index 23a3f3e..4f25e0f 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ packages/subgraph/tests/.bin coverage.json packages/contracts/plugin-repo-info-dev.json +packages/contracts/deployments packages/subgraph/deploy-output.txt packages/subgraph/subgraph.yaml diff --git a/README_DEPLOYMENT.md b/README_DEPLOYMENT.md index 4f1d54f..87f6cfa 100644 --- a/README_DEPLOYMENT.md +++ b/README_DEPLOYMENT.md @@ -37,29 +37,40 @@ yarn build - Open the [DEPLOYMENT_CHECKLIST.md](https://github.com/aragon/osx/blob/deployments/simpler-deployment/DEPLOYMENT_CHECKLIST.md) file and follow the instructions -Write down the address of the deployed contracts. The result should look similar to this: - -```json -{ - "managingDAOImplementation": "0x731b7F3d74C9dc25A90af73B960ad51f42481d6c", - "managingDAO": "0x1C57A251B1902656693f689aA69389f2a6f2a432", - "ENSRegistry": "0xE847017f1e18F7bF35b180fD45b4dAC18E81d568", - "PublicResolver": "0xE3B1288048f898A28a78FCf9942E14Cc853fFEF2", - "DAO_ENSSubdomainRegistrar_Implementation": "0xd92C33f309D6e795DCe1980aBc42D3431b0af0e7", - "DAO_ENSSubdomainRegistrar": "0xcf9D94Ddd248694B66D1D445b85ccbE385634Cc8", - "Plugin_ENSSubdomainRegistrar_Implementation": "0x7BC82fCba3521B15792423ac4E6076582235263B", - "Plugin_ENSSubdomainRegistrar": "0xd14C706586c6177d54D201df009b75FB14E8AB5E", - "DAORegistry_Implementation": "0x66a19CC345dAB31dfb6295017819d54dB594DE56", - "DAORegistry": "0x11d3B1B24C19B5672b92CD535d2F1F35C53AC543", - "PluginRepoRegistry_Implementation": "0x38b112318cfd563Fa5de538E7c219bf72F1CcA6a", - "PluginRepoRegistry": "0x9b51505f7bf3A45BC92F6bE269324096abEC0A73", - "PluginRepoFactory": "0xA69347F49dD615cb4577670D0728684AfAa01197", - "PluginSetupProcessor": "0xAc7e4fB4a2158b7EA5516f47b6f804956Faf0134", - "DAOFactory": "0x2d11E9413264e3814C2a21160cBCcb9Dc3C96890" -} +Before the contract verification, you should see an output like this: + +``` +Printing deployed contracts. +Managing DAO: 0x8F78E43a1eF0916d048fD391ecfd71B44fF4DD0C +DAOFactory: 0x362D9e4DE500F6faA71E765394e2Df60a06C21E0 +DAORegistry: 0xB928B54B7a419666192d8a76534B28e15e3f4498 +DAORegistry_Implementation: 0xfDDfB1b64B90cDB784699fccc65e085EFcB774b6 +DAO_ENSSubdomainRegistrar: 0x3b91b927148C66f8572275f809748eF93e0d4016 +DAO_ENSSubdomainRegistrar_Implementation: 0xFee26363AfBb684652e895F507cA1F4489E14de8 +Managing DAO Implementation: 0x2D941aBAFd05b1DA425E4d04293A0C49d4df9425 +ENSRegistry: 0x3099238BC70914F6F4CE007E2F3a86200b924150 +PluginRepoFactory: 0x5aBd4d84C00661310ddEa7a8b88C309c420F1c47 +PluginRepoRegistry: 0x46614c13b7dFbEE8B5D810546E4385A423f65ef6 +PluginRepoRegistry_Implementation: 0xf7A702D8f197e6D510eaF740998c2029744078B5 +PluginSetupProcessor: 0x01aeE1a16C8807DF52f2DA9191Cec8058e747F4A +Plugin_ENSSubdomainRegistrar: 0xb63C2A08246df16f8534282F807683dCcA34c7A3 +Plugin_ENSSubdomainRegistrar_Implementation: 0x98ee670Fa61cB6504eC1E372384A4A73Ca5F713a +PublicResolver: 0x2B7222146A805bBa0DBb61869C4b3a03209DffBa +... +``` + +These values can also be found in the `packages/contracts/deployed_contracts.json` file on your OSx folder. + +```sh +cat deployed_contracts.json | egrep "managingDAO|PluginRepoFactory|PluginSetupProcessor" | grep -v "Implementation" + + "managingDAO": "0x8F78E43a1eF0916d048fD391ecfd71B44fF4DD0C", + "PluginRepoFactory": "0x5aBd4d84C00661310ddEa7a8b88C309c420F1c47", + "PluginSetupProcessor": "0x01aeE1a16C8807DF52f2DA9191Cec8058e747F4A", + ``` -Copy the `PluginRepoFactory`, the `PluginSetupProcessor` and the `managingDAO` addresses for the next step. +Copy the resulting `PluginRepoFactory`, the `PluginSetupProcessor` and the `managingDAO` addresses for the next step. #### 2) Run the plugin deployment script @@ -67,7 +78,9 @@ Back to this repository: - Update the `.env` file with the values that correspond to your target blockchain - `NETWORK_NAME` and `DEPLOYMENT_RPC_ENDPOINT` - - Alternatively, edit the `packages/contracts/hardhat.config.ts` to manually customize the HardHat client + - Check the `packages/contracts/hardhat.config.ts` to manually customize the HardHat client + - `DEPLOYMENT_RPC_ENDPOINT` is initially used for a newtork called `custom` + - Rename it to your convenience - Define the deployment wallet's `PRIVATE_KEY` - Define the protocol addresses [you copied before](#1-deploy-osx): - `PLUGIN_REPO_FACTORY_ADDRESS`, `PLUGIN_SETUP_PROCESSOR_ADDRESS` and `MANAGING_DAO_ADDRESS` @@ -112,9 +125,21 @@ MGMT_DAO_INITIAL_EDITORS="0x1234,0x2345,0x3456,0x4567..." # Comma separated addr $ yarn managing-dao-setup ``` -By running the `managing-dao-setup.ts` script, you will be: +By running `yarn managing-dao-setup`, the `managing-dao-setup.ts` script will be: 1. Asking the [PSP from OSx](#1-deploy-osx) to run `prepareInstallation()` and deploy a new Governance plugin instance 2. Ask the Managing DAO to call `applyInstallation()` on the PSP for the deployed plugin 3. Make the Managing DAO revoke the remaining deployment wallet permissions 4. Checking that the Managing DAO's permissions are correctly configured + +## Other + +### Rerunning the deployment script + +If you need to restart the redeployment process and want HardHat to not reuse the existing contracts: + +```sh +rm -R deployments/ # replace with the actual name +``` + +Also, make sure to select a different ENS subdomain for the new plugin's, as they will collide with the previously deployed ones. diff --git a/packages/contracts/deploy/99_verification/20_summary.ts b/packages/contracts/deploy/99_verification/20_summary.ts index c17950e..3f9bb91 100644 --- a/packages/contracts/deploy/99_verification/20_summary.ts +++ b/packages/contracts/deploy/99_verification/20_summary.ts @@ -26,7 +26,7 @@ MGMT_DAO_PROPOSAL_SUPPORT_THRESHOLD="500000" # 50% MGMT_DAO_INITIAL_EDITORS="0x1234,0x2345,0x3456,0x4567..." # Comma separated addresses 3) Run the following command: -$ npx ts-node scripts/managing-dao-setup.ts +$ yarn managing-dao-setup `); }; diff --git a/packages/contracts/scripts/managing-dao-setup.ts b/packages/contracts/scripts/managing-dao-setup.ts index 6d156d2..56ba4a8 100644 --- a/packages/contracts/scripts/managing-dao-setup.ts +++ b/packages/contracts/scripts/managing-dao-setup.ts @@ -79,7 +79,7 @@ async function main() { await applyInstallation(preparedInstallation); // Drop the execute permission - await dropDeployerWalletPermission(); + await dropDeployerWalletPermissions(); // Check the final permissions await checkManagingDaoPost(preparedInstallation); @@ -276,18 +276,30 @@ async function applyInstallation( console.log('Installation confirmed'); } -async function dropDeployerWalletPermission() { +async function dropDeployerWalletPermissions() { const mgmtDAO = DAO__factory.connect(MANAGING_DAO_ADDRESS!, deployer); + const EXECUTE_PERMISSION_ID = await mgmtDAO.EXECUTE_PERMISSION_ID(); const ROOT_PERMISSION_ID = await mgmtDAO.ROOT_PERMISSION_ID(); + console.log('Revoking the EXECUTE permission from the deployment wallet'); + + const tx1 = await mgmtDAO.revoke( + MANAGING_DAO_ADDRESS!, + deployer.address, + EXECUTE_PERMISSION_ID + ); + await tx1.wait(); + + console.log('Permission revoked'); + console.log('Revoking the ROOT permission from the deployment wallet'); - const tx = await mgmtDAO.revoke( + const tx2 = await mgmtDAO.revoke( MANAGING_DAO_ADDRESS!, deployer.address, ROOT_PERMISSION_ID ); - await tx.wait(); + await tx2.wait(); console.log('Permission revoked'); }