From 56eecc2bebb702cfe8d20cb9af84ee345c76086e Mon Sep 17 00:00:00 2001 From: Jordan <45881807+jordaniza@users.noreply.github.com> Date: Fri, 8 Mar 2024 12:00:28 +0400 Subject: [PATCH] Revert "F/deploy script" --- packages/contracts/deploy/00_info/01_info.ts | 6 +- .../deploy/10_create_repo/11_create_repo.ts | 2 +- .../deploy/20_new_version/21_setup.ts | 46 +- .../20_new_version/22_setup_conclude.ts | 37 +- .../deploy/20_new_version/23_publish.ts | 74 +-- .../deploy/30_upgrade_repo/31_upgrade_repo.ts | 93 +-- .../{42_info.ts => 41_conclude.ts} | 0 .../40_conclude/41_transfer_ownership.ts | 111 ---- packages/contracts/deploy/helpers.ts | 596 ------------------ packages/contracts/hardhat.config.ts | 2 +- packages/contracts/plugin-settings.ts | 34 +- packages/contracts/utils/ens.ts | 91 --- packages/contracts/utils/environment.ts | 52 -- packages/contracts/utils/helpers.ts | 41 +- packages/contracts/utils/psp.ts | 5 - packages/contracts/utils/storage.ts | 18 - yarn.lock | 297 ++++----- 17 files changed, 198 insertions(+), 1307 deletions(-) rename packages/contracts/deploy/40_conclude/{42_info.ts => 41_conclude.ts} (100%) delete mode 100644 packages/contracts/deploy/40_conclude/41_transfer_ownership.ts delete mode 100644 packages/contracts/deploy/helpers.ts delete mode 100644 packages/contracts/utils/ens.ts delete mode 100644 packages/contracts/utils/environment.ts delete mode 100644 packages/contracts/utils/psp.ts delete mode 100644 packages/contracts/utils/storage.ts diff --git a/packages/contracts/deploy/00_info/01_info.ts b/packages/contracts/deploy/00_info/01_info.ts index ade3e9bb..9ebd2dc6 100644 --- a/packages/contracts/deploy/00_info/01_info.ts +++ b/packages/contracts/deploy/00_info/01_info.ts @@ -4,7 +4,6 @@ import { isLocal, } from '../../utils/helpers'; import {getNetworkByNameOrAlias} from '@aragon/osx-commons-configs'; -import {UnsupportedNetworkError} from '@aragon/osx-commons-sdk'; import {DeployFunction} from 'hardhat-deploy/types'; import {HardhatRuntimeEnvironment} from 'hardhat/types'; import path from 'path'; @@ -27,10 +26,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { ); // Fork the network provided in the `.env` file - const networkConfig = getNetworkByNameOrAlias(productionNetworkName); - if (networkConfig === null) { - throw new UnsupportedNetworkError(productionNetworkName); - } + const networkConfig = getNetworkByNameOrAlias(productionNetworkName)!; await hre.network.provider.request({ method: 'hardhat_reset', params: [ diff --git a/packages/contracts/deploy/10_create_repo/11_create_repo.ts b/packages/contracts/deploy/10_create_repo/11_create_repo.ts index b4ed1445..76fcef7d 100644 --- a/packages/contracts/deploy/10_create_repo/11_create_repo.ts +++ b/packages/contracts/deploy/10_create_repo/11_create_repo.ts @@ -70,7 +70,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { ); console.log( - `PluginRepo '${pluginEnsDomain(hre)}' deployed at '${pluginRepo.address}'.` + `'${pluginEnsDomain(hre)}' PluginRepo deployed at: ${pluginRepo.address}.` ); hre.aragonToVerifyContracts.push({ diff --git a/packages/contracts/deploy/20_new_version/21_setup.ts b/packages/contracts/deploy/20_new_version/21_setup.ts index a6bcc1fd..041e76bc 100644 --- a/packages/contracts/deploy/20_new_version/21_setup.ts +++ b/packages/contracts/deploy/20_new_version/21_setup.ts @@ -1,22 +1,10 @@ -import governanceERC20Artifact from '../../artifacts/src/ERC20/governance/GovernanceERC20.sol/GovernanceERC20.json'; -import governanceWrappedERC20Artifact from '../../artifacts/src/ERC20/governance/GovernanceWrappedERC20.sol/GovernanceWrappedERC20.json'; -import { - GOVERNANCE_ERC20_DEPLOY_ARGS, - GOVERNANCE_WRAPPED_ERC20_DEPLOY_ARGS, - PLUGIN_SETUP_CONTRACT_NAME, -} from '../../plugin-settings'; -import { - GOVERNANCE_ERC20_CONTRACT_NAME, - GOVERNANCE_WRAPPED_ERC20_CONTRACT_NAME, -} from '../../plugin-settings'; +import {PLUGIN_SETUP_CONTRACT_NAME} from '../../plugin-settings'; import {DeployFunction} from 'hardhat-deploy/types'; import {HardhatRuntimeEnvironment} from 'hardhat/types'; import path from 'path'; /** * Deploys the plugin setup contract with the plugin implementation inside. - * In the case of the token voting plugin, we also need to deploy the governance ERC20 - * and the wrapped variants. * @param {HardhatRuntimeEnvironment} hre */ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { @@ -26,39 +14,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const {deploy} = deployments; const {deployer} = await getNamedAccounts(); - // Deploy the bases for the TokenVotingSetup - const governanceERC20DeployResult = await deploy( - GOVERNANCE_ERC20_CONTRACT_NAME, - { - contract: governanceERC20Artifact, - from: deployer, - args: GOVERNANCE_ERC20_DEPLOY_ARGS, - log: true, - } - ); - - const governanceWrappedERC20DeployResult = await deploy( - GOVERNANCE_WRAPPED_ERC20_CONTRACT_NAME, - { - contract: governanceWrappedERC20Artifact, - from: deployer, - args: GOVERNANCE_WRAPPED_ERC20_DEPLOY_ARGS, - log: true, - } - ); - - const res = await deploy(PLUGIN_SETUP_CONTRACT_NAME, { + await deploy(PLUGIN_SETUP_CONTRACT_NAME, { from: deployer, - args: [ - governanceERC20DeployResult.address, - governanceWrappedERC20DeployResult.address, - ], + args: [], log: true, }); - - console.log( - `Deployed contract '${PLUGIN_SETUP_CONTRACT_NAME}' at ${res.address}.` - ); }; export default func; diff --git a/packages/contracts/deploy/20_new_version/22_setup_conclude.ts b/packages/contracts/deploy/20_new_version/22_setup_conclude.ts index fa64a5a6..1b514b68 100644 --- a/packages/contracts/deploy/20_new_version/22_setup_conclude.ts +++ b/packages/contracts/deploy/20_new_version/22_setup_conclude.ts @@ -1,11 +1,5 @@ -import { - GOVERNANCE_ERC20_CONTRACT_NAME, - GOVERNANCE_ERC20_DEPLOY_ARGS, - GOVERNANCE_WRAPPED_ERC20_CONTRACT_NAME, - GOVERNANCE_WRAPPED_ERC20_DEPLOY_ARGS, - PLUGIN_SETUP_CONTRACT_NAME, -} from '../../plugin-settings'; -import {TokenVotingSetup__factory, TokenVoting__factory} from '../../typechain'; +import {PLUGIN_SETUP_CONTRACT_NAME} from '../../plugin-settings'; +import {MyPluginSetup__factory, MyPlugin__factory} from '../../typechain'; import {DeployFunction} from 'hardhat-deploy/types'; import {HardhatRuntimeEnvironment} from 'hardhat/types'; import path from 'path'; @@ -23,45 +17,24 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // Get the plugin setup address const setupDeployment = await deployments.get(PLUGIN_SETUP_CONTRACT_NAME); - const setup = TokenVotingSetup__factory.connect( + const setup = MyPluginSetup__factory.connect( setupDeployment.address, deployer ); // Get the plugin implementation address - const implementation = TokenVoting__factory.connect( + const implementation = MyPlugin__factory.connect( await setup.implementation(), deployer ); - const governanceERC20DeployResult = await deployments.get( - GOVERNANCE_ERC20_CONTRACT_NAME - ); - const governanceWrappedERC20DeployResult = await deployments.get( - GOVERNANCE_WRAPPED_ERC20_CONTRACT_NAME - ); - // Queue the plugin setup and implementation for verification on the block explorers hre.aragonToVerifyContracts.push({ address: setup.address, args: setupDeployment.args, }); - hre.aragonToVerifyContracts.push({ address: implementation.address, - args: [ - governanceERC20DeployResult.address, - governanceWrappedERC20DeployResult.address, - ], - }); - - hre.aragonToVerifyContracts.push({ - address: governanceERC20DeployResult.address, - args: GOVERNANCE_ERC20_DEPLOY_ARGS, - }); - - hre.aragonToVerifyContracts.push({ - address: governanceWrappedERC20DeployResult.address, - args: GOVERNANCE_WRAPPED_ERC20_DEPLOY_ARGS, + args: [], }); }; diff --git a/packages/contracts/deploy/20_new_version/23_publish.ts b/packages/contracts/deploy/20_new_version/23_publish.ts index 0dbba782..ea146b9b 100644 --- a/packages/contracts/deploy/20_new_version/23_publish.ts +++ b/packages/contracts/deploy/20_new_version/23_publish.ts @@ -1,6 +1,5 @@ import { METADATA, - PLUGIN_CONTRACT_NAME, PLUGIN_REPO_ENS_SUBDOMAIN_NAME, PLUGIN_SETUP_CONTRACT_NAME, VERSION, @@ -8,8 +7,6 @@ import { import { findPluginRepo, getPastVersionCreatedEvents, - impersonatedManagementDaoSigner, - isLocal, pluginEnsDomain, } from '../../utils/helpers'; import { @@ -17,7 +14,6 @@ import { toHex, uploadToIPFS, } from '@aragon/osx-commons-sdk'; -import {writeFile} from 'fs/promises'; import {DeployFunction} from 'hardhat-deploy/types'; import {HardhatRuntimeEnvironment} from 'hardhat/types'; import path from 'path'; @@ -81,42 +77,25 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { ); } - if (setup == undefined || setup?.receipt == undefined) { - throw Error('setup deployment unavailable'); - } - - const isDeployerMaintainer = await pluginRepo.isGranted( - pluginRepo.address, - deployer.address, - PLUGIN_REPO_PERMISSIONS.MAINTAINER_PERMISSION_ID, - [] - ); - - // If this is a local deployment and the deployer doesn't have `MAINTAINER_PERMISSION_ID` permission - // we impersonate the management DAO for integration testing purposes. - const signer = - isDeployerMaintainer || !isLocal(hre) - ? deployer - : await impersonatedManagementDaoSigner(hre); - - // Check if the signer has the permission to maintain the plugin repo + // Create Version if ( - await pluginRepo.isGranted( + await pluginRepo.callStatic.isGranted( pluginRepo.address, - signer.address, + deployer.address, PLUGIN_REPO_PERMISSIONS.MAINTAINER_PERMISSION_ID, [] ) ) { - // Create the new version - const tx = await pluginRepo - .connect(signer) - .createVersion( - VERSION.release, - setup.address, - toHex(buildMetadataURI), - toHex(releaseMetadataURI) - ); + const tx = await pluginRepo.createVersion( + VERSION.release, + setup.address, + toHex(buildMetadataURI), + toHex(releaseMetadataURI) + ); + + if (setup == undefined || setup?.receipt == undefined) { + throw Error('setup deployment unavailable'); + } await tx.wait(); @@ -131,31 +110,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { `Published ${PLUGIN_SETUP_CONTRACT_NAME} at ${setup.address} in PluginRepo ${PLUGIN_REPO_ENS_SUBDOMAIN_NAME} at ${pluginRepo.address}.` ); } else { - // The deployer does not have `MAINTAINER_PERMISSION_ID` permission and we are not deploying to a production network, - // so we write the data into a file for a management DAO member to create a proposal from it. - const data = { - proposalTitle: `Publish '${PLUGIN_CONTRACT_NAME}' plugin v${VERSION.release}.${VERSION.build}`, - proposalSummary: `Publishes v${VERSION.release}.${VERSION.build} of the '${PLUGIN_CONTRACT_NAME}' plugin in the '${ensDomain}' plugin repo.`, - proposalDescription: `Publishes the '${PLUGIN_SETUP_CONTRACT_NAME}' deployed at '${setup.address}' - as v${VERSION.release}.${VERSION.build} in the '${ensDomain}' plugin repo at '${pluginRepo.address}', - with release metadata '${releaseMetadataURI}' and (immutable) build metadata '${buildMetadataURI}'.`, - actions: [ - { - to: pluginRepo.address, - createVersion: { - _release: VERSION.release, - _pluginSetup: setup.address, - _buildMetadata: toHex(buildMetadataURI), - _releaseMetadata: toHex(releaseMetadataURI), - }, - }, - ], - }; - - const path = `./createVersionProposalData-${hre.network.name}.json`; - await writeFile(path, JSON.stringify(data, null, 2)); - console.log( - `Saved data to '${path}'. Use this to create a proposal on the managing DAO calling the 'createVersion' function on the ${ensDomain} plugin repo deployed at ${pluginRepo.address}.` + throw Error( + `The new version cannot be published because the deployer ('${deployer.address}') is lacking the ${PLUGIN_REPO_PERMISSIONS.MAINTAINER_PERMISSION_ID} permission on repo (${pluginRepo.address}).` ); } }; diff --git a/packages/contracts/deploy/30_upgrade_repo/31_upgrade_repo.ts b/packages/contracts/deploy/30_upgrade_repo/31_upgrade_repo.ts index d8cf19c8..a6d47f77 100644 --- a/packages/contracts/deploy/30_upgrade_repo/31_upgrade_repo.ts +++ b/packages/contracts/deploy/30_upgrade_repo/31_upgrade_repo.ts @@ -1,41 +1,20 @@ -import { - findPluginRepo, - getProductionNetworkName, - impersonatedManagementDaoSigner, - isLocal, -} from '../../utils/helpers'; +import {findPluginRepo, getProductionNetworkName} from '../../utils/helpers'; import { getLatestNetworkDeployment, getNetworkNameByAlias, } from '@aragon/osx-commons-configs'; -import { - PLUGIN_REPO_PERMISSIONS, - UnsupportedNetworkError, -} from '@aragon/osx-commons-sdk'; +import {PLUGIN_REPO_PERMISSIONS} from '@aragon/osx-commons-sdk'; import {PluginRepo__factory} from '@aragon/osx-ethers'; import {BytesLike} from 'ethers'; -import {writeFile} from 'fs/promises'; import {DeployFunction} from 'hardhat-deploy/types'; import {HardhatRuntimeEnvironment} from 'hardhat/types'; import path from 'path'; type SemVer = [number, number, number]; -/** - * Upgrades the plugin repo to the latest implementation. - * @param {HardhatRuntimeEnvironment} hre - */ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const [deployer] = await hre.ethers.getSigners(); const productionNetworkName: string = getProductionNetworkName(hre); - const network = getNetworkNameByAlias(productionNetworkName); - if (network === null) { - throw new UnsupportedNetworkError(productionNetworkName); - } - const networkDeployments = getLatestNetworkDeployment(network); - if (networkDeployments === null) { - throw `Deployments are not available on network ${network}.`; - } // Get PluginRepo const {pluginRepo, ensDomain} = await findPluginRepo(hre); @@ -49,7 +28,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // Get the latest `PluginRepo` implementation as the upgrade target const latestPluginRepoImplementation = PluginRepo__factory.connect( - networkDeployments.PluginRepoBase.address, + getLatestNetworkDeployment(getNetworkNameByAlias(productionNetworkName)!)! + .PluginRepoBase.address, deployer ); @@ -73,36 +53,22 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // Re-initialization will happen through a call to `function initializeFrom(uint8[3] calldata _previousProtocolVersion, bytes calldata _initData)` // that Aragon might add to the `PluginRepo` contract once it's required. /* - // Define the `_initData` arguments + // Define the `initData` arguments that const initData: BytesLike[] = []; // Encode the call to `function initializeFrom(uint8[3] calldata _previousProtocolVersion, bytes calldata _initData)` with `initData` const initializeFromCalldata = - latestPluginRepoImplementation.interface.encodeFunctionData('initializeFrom', [ + newPluginRepoImplementation.interface.encodeFunctionData('initializeFrom', [ current, initData, ]); */ const initializeFromCalldata: BytesLike = []; - const isDeployerUpgrader = await pluginRepo.isGranted( - pluginRepo.address, - deployer.address, - PLUGIN_REPO_PERMISSIONS.UPGRADE_REPO_PERMISSION_ID, - [] - ); - - // If this is a local deployment and the deployer doesn't have `UPGRADE_REPO_PERMISSION_ID` permission - // we impersonate the management DAO for integration testing purposes. - const signer = - isDeployerUpgrader || !isLocal(hre) - ? deployer - : await impersonatedManagementDaoSigner(hre); - - // Check if the signer has the permission to upgrade the plugin repo + // Check if deployer has the permission to upgrade the plugin repo if ( await pluginRepo.isGranted( pluginRepo.address, - signer.address, + deployer.address, PLUGIN_REPO_PERMISSIONS.UPGRADE_REPO_PERMISSION_ID, [] ) @@ -118,35 +84,9 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { await pluginRepo.upgradeTo(latestPluginRepoImplementation.address); } } else { - // The deployer does not have `UPGRADE_REPO_PERMISSION_ID` permission and we are not deploying to a production network, - // so we write the data into a file for a management DAO member to create a proposal from it. - const upgradeAction = - initializeFromCalldata.length === 0 - ? { - to: pluginRepo.address, - upgradeTo: { - NewImplementation: latestPluginRepoImplementation.address, - }, - } - : { - to: pluginRepo.address, - upgradeToAndCall: { - NewImplementation: latestPluginRepoImplementation.address, - Data: initializeFromCalldata, - PayableAmount: 0, - }, - }; - const data = { - proposalTitle: `Upgrade the '${ensDomain}' plugin repo`, - proposalSummary: `Upgrades '${ensDomain}' plugin repo at '${pluginRepo.address}',' plugin in the '${ensDomain}' plugin repo.`, - proposalDescription: `TODO: Describe the changes to the 'PluginRepo' implementation.`, - actions: [upgradeAction], - }; - - const path = `./upgradeRepoProposalData-${hre.network.name}.json`; - await writeFile(path, JSON.stringify(data, null, 2)); - console.log( - `Saved data to '${path}'. Use this to create a proposal on the managing DAO calling the 'upgradeTo' or 'upgradeToAndCall' function on the ${ensDomain} plugin repo deployed at ${pluginRepo.address}.` + throw Error( + `The new version cannot be published because the deployer ('${deployer.address}') + is lacking the ${PLUGIN_REPO_PERMISSIONS.UPGRADE_REPO_PERMISSION_ID} permission.` ); } }; @@ -162,18 +102,11 @@ func.skip = async (hre: HardhatRuntimeEnvironment) => { const [deployer] = await hre.ethers.getSigners(); const productionNetworkName: string = getProductionNetworkName(hre); - const network = getNetworkNameByAlias(productionNetworkName); - if (network === null) { - throw new UnsupportedNetworkError(productionNetworkName); - } - const networkDeployments = getLatestNetworkDeployment(network); - if (networkDeployments === null) { - throw `Deployments are not available on network ${network}.`; - } // Get the latest `PluginRepo` implementation as the upgrade target const latestPluginRepoImplementation = PluginRepo__factory.connect( - networkDeployments.PluginRepoBase.address, + getLatestNetworkDeployment(getNetworkNameByAlias(productionNetworkName)!)! + .PluginRepoBase.address, deployer ); diff --git a/packages/contracts/deploy/40_conclude/42_info.ts b/packages/contracts/deploy/40_conclude/41_conclude.ts similarity index 100% rename from packages/contracts/deploy/40_conclude/42_info.ts rename to packages/contracts/deploy/40_conclude/41_conclude.ts diff --git a/packages/contracts/deploy/40_conclude/41_transfer_ownership.ts b/packages/contracts/deploy/40_conclude/41_transfer_ownership.ts deleted file mode 100644 index aac32467..00000000 --- a/packages/contracts/deploy/40_conclude/41_transfer_ownership.ts +++ /dev/null @@ -1,111 +0,0 @@ -import {findPluginRepo, getManagementDao} from '../../utils/helpers'; -import { - DAO_PERMISSIONS, - Operation, - PERMISSION_MANAGER_FLAGS, - PLUGIN_REPO_PERMISSIONS, -} from '@aragon/osx-commons-sdk'; -import {DAOStructs} from '@aragon/osx-ethers'; -import {DeployFunction} from 'hardhat-deploy/types'; -import {HardhatRuntimeEnvironment} from 'hardhat/types'; -import path from 'path'; - -/** - * Creates a plugin repo under Aragon's ENS base domain with subdomain requested in the `./plugin-settings.ts` file. - * @param {HardhatRuntimeEnvironment} hre - */ -const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { - // Get PluginRepo - const {pluginRepo, ensDomain} = await findPluginRepo(hre); - if (pluginRepo === null) { - throw `PluginRepo '${ensDomain}' does not exist yet.`; - } - - // Get the management DAO address - const managementDao = await getManagementDao(hre); - const [deployer] = await hre.ethers.getSigners(); - - console.log( - `Transferring ownership of the '${ensDomain}' plugin repo at '${pluginRepo.address}' from the deployer '${deployer.address}' to the management DAO at '${managementDao.address}'...` - ); - - const permissions: DAOStructs.MultiTargetPermissionStruct[] = [ - // Grant to the managment DAO - { - operation: Operation.Grant, - where: pluginRepo.address, - who: managementDao.address, - condition: PERMISSION_MANAGER_FLAGS.NO_CONDITION, - permissionId: PLUGIN_REPO_PERMISSIONS.MAINTAINER_PERMISSION_ID, - }, - { - operation: Operation.Grant, - where: pluginRepo.address, - who: managementDao.address, - condition: PERMISSION_MANAGER_FLAGS.NO_CONDITION, - permissionId: PLUGIN_REPO_PERMISSIONS.UPGRADE_REPO_PERMISSION_ID, - }, - { - operation: Operation.Grant, - where: pluginRepo.address, - who: managementDao.address, - condition: PERMISSION_MANAGER_FLAGS.NO_CONDITION, - permissionId: DAO_PERMISSIONS.ROOT_PERMISSION_ID, - }, - // Revoke from deployer - { - operation: Operation.Revoke, - where: pluginRepo.address, - who: deployer.address, - condition: PERMISSION_MANAGER_FLAGS.NO_CONDITION, - permissionId: PLUGIN_REPO_PERMISSIONS.MAINTAINER_PERMISSION_ID, - }, - { - operation: Operation.Revoke, - where: pluginRepo.address, - who: deployer.address, - condition: PERMISSION_MANAGER_FLAGS.NO_CONDITION, - permissionId: PLUGIN_REPO_PERMISSIONS.UPGRADE_REPO_PERMISSION_ID, - }, - { - operation: Operation.Revoke, - where: pluginRepo.address, - who: deployer.address, - condition: PERMISSION_MANAGER_FLAGS.NO_CONDITION, - permissionId: DAO_PERMISSIONS.ROOT_PERMISSION_ID, - }, - ]; - - await pluginRepo.connect(deployer).applyMultiTargetPermissions(permissions); -}; - -export default func; -func.tags = ['TransferOwnershipToManagmentDao']; - -/** - * Skips the transfer of ownership if it has already been transferred to the management DAO - * @param {HardhatRuntimeEnvironment} hre - */ -func.skip = async (hre: HardhatRuntimeEnvironment) => { - console.log(`\n🏗️ ${path.basename(__filename)}:`); - - const {pluginRepo, ensDomain} = await findPluginRepo(hre); - if (pluginRepo === null) { - throw `PluginRepo '${ensDomain}' does not exist yet.`; - } - const managementDao = await getManagementDao(hre); - - const mgmtDaoHasRootPerm = await pluginRepo.isGranted( - pluginRepo.address, - managementDao.address, - DAO_PERMISSIONS.ROOT_PERMISSION_ID, - [] - ); - - if (mgmtDaoHasRootPerm) - console.log( - `The ownership of the plugin repo '${ensDomain}' has already been transferred to the management DAO. Skipping...` - ); - - return mgmtDaoHasRootPerm; -}; diff --git a/packages/contracts/deploy/helpers.ts b/packages/contracts/deploy/helpers.ts deleted file mode 100644 index a717230a..00000000 --- a/packages/contracts/deploy/helpers.ts +++ /dev/null @@ -1,596 +0,0 @@ -import {VersionTag} from '../test/test-utils/psp/types'; -import { - ENSRegistry__factory, - PluginRepoFactory__factory, - PluginRepoRegistry__factory, - PluginRepo__factory, -} from '../typechain'; -import {VersionCreatedEvent} from '../typechain/PluginRepo'; -import {PluginRepoRegisteredEvent} from '../typechain/PluginRepoRegistry'; -import {isLocal, pluginDomainEnv} from '../utils/environment'; -import { - getNetworkNameByAlias, - getLatestNetworkDeployment, -} from '@aragon/osx-commons-configs'; -import {findEvent, findEventTopicLog, Operation} from '@aragon/osx-commons-sdk'; -import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers'; -import {Contract} from 'ethers'; -import {ethers} from 'hardhat'; -import {HardhatRuntimeEnvironment} from 'hardhat/types'; -import IPFS from 'ipfs-http-client'; - -// TODO: Add support for L2 such as Arbitrum. (https://discuss.ens.domains/t/register-using-layer-2/688) -// Make sure you own the ENS set in the {{NETWORK}}_ENS_DOMAIN variable in .env -export const ENS_ADDRESSES: {[key: string]: string} = { - mainnet: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', - goerli: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', - sepolia: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', -}; - -export const ENS_PUBLIC_RESOLVERS: {[key: string]: string} = { - goerli: '0x19c2d5d0f035563344dbb7be5fd09c8dad62b001', - mainnet: '0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41', - sepolia: '0x8FADE66B79cC9f707aB26799354482EB93a5B7dD', -}; - -export const MANAGEMENT_DAO_METADATA = { - name: 'Aragon Management DAO', - description: - 'Aragon OSx includes a group of global smart contracts that allow for a DAO ecosystem to be built on top. These contracts will require future improvements and general maintenance. The Management DAO is intended to perform such maintenance tasks and holds the permissions to deliver any new capabilities that are added in the future.', - avatar: - 'https://ipfs.eth.aragon.network/ipfs/QmVyy3ci7F2zHG6JUJ1XbcwLKuxWrQ6hqNvSnjmDmdYJzP/', - links: [ - { - name: 'Web site', - url: 'https://www.aragon.org', - }, - { - name: 'Developer Portal', - url: 'https://devs.aragon.org/', - }, - ], -}; - -export const DAO_PERMISSIONS = [ - 'ROOT_PERMISSION', - 'UPGRADE_DAO_PERMISSION', - 'SET_SIGNATURE_VALIDATOR_PERMISSION', - 'SET_TRUSTED_FORWARDER_PERMISSION', - 'SET_METADATA_PERMISSION', - 'REGISTER_STANDARD_CALLBACK_PERMISSION', -]; - -export async function uploadToIPFS( - metadata: string, - networkName: string -): Promise { - const client = IPFS.create({ - url: 'https://prod.ipfs.aragon.network/api/v0', - headers: { - 'X-API-KEY': 'b477RhECf8s8sdM7XrkLBs2wHc4kCMwpbcFC55Kt', - }, - }); - - if (networkName === 'hardhat' || networkName === 'localhost') { - // return a dummy path - return 'QmNnobxuyCjtYgsStCPhXKEiQR5cjsc3GtG9ZMTKFTTEFJ'; - } - - const res = await client.add(metadata); - await client.pin.add(res.cid); - console.log(`Uploaded to IPFS with cid ${res.cid.toString()}`); - return res.cid.toString(); -} - -export async function getContractAddress( - contractName: string, - hre: HardhatRuntimeEnvironment -): Promise { - const {deployments, network} = hre; - - let networkName = network.name; - - if (hre.testingFork.network) { - networkName = hre.testingFork.network; - } - - try { - const contract = await deployments.get(contractName); - if (contract) { - return contract.address; - } - } catch (e) { - // prettier-ignore - } - - try { - if (!hre.testingFork.osxVersion && !hre.testingFork.activeContracts) { - console.log('=========================='); - console.log('Warning: osxVersion is not set'); - console.log('=========================='); - } - - const activeContracts = hre.testingFork.activeContracts; - - if (activeContracts && activeContracts[networkName][contractName]) { - return activeContracts[networkName][contractName]; - } - } catch (e) { - // prettier-ignore - } - - return getLatestContractAddress(contractName, hre); -} - -export function getLatestContractAddress( - contractName: string, - hre: HardhatRuntimeEnvironment -): string { - let networkName = hre.network.name; - - if (hre.testingFork.network) { - networkName = hre.testingFork.network; - } - - const osxNetworkName = getNetworkNameByAlias(networkName); - if (!osxNetworkName) { - if (isLocal(hre.network)) { - return ''; - } - throw new Error(`Failed to find network ${networkName}`); - } - - const latestNetworkDeployment = getLatestNetworkDeployment(osxNetworkName); - if (latestNetworkDeployment && contractName in latestNetworkDeployment) { - // safe cast due to conditional above, but we return the fallback string anyhow - const key = contractName as keyof typeof latestNetworkDeployment; - return latestNetworkDeployment[key]?.address ?? ''; - } - return ''; -} - -export async function detemineDeployerNextAddress( - index: number, - deployer: SignerWithAddress -): Promise { - const [owner] = await ethers.getSigners(); - const nonce = await owner.getTransactionCount(); - const futureAddress = ethers.utils.getContractAddress({ - from: deployer.address, - nonce: nonce + index, - }); - return futureAddress; -} - -export async function createPluginRepo( - hre: HardhatRuntimeEnvironment, - pluginName: string, - subdomain: string -): Promise { - const {network} = hre; - const signers = await ethers.getSigners(); - - const pluginDomain = pluginDomainEnv(network); - if ( - await isENSDomainRegistered( - `${subdomain}.${pluginDomain}`, - await getENSAddress(hre), - signers[0] - ) - ) { - // not beeing able to register the plugin repo means that something is not right with the framework deployment used. - // Either a frontrun happened or something else. Thus we abort here - throw new Error(`${subdomain} is already present! Aborting...`); - } - - const pluginRepoFactoryAddress = await getContractAddress( - 'PluginRepoFactory', - hre - ); - - const pluginRepoFactoryFactory = new PluginRepoFactory__factory(signers[0]); - const pluginRepoFactoryContract = pluginRepoFactoryFactory.attach( - pluginRepoFactoryAddress - ); - - const {deployer} = await hre.getNamedAccounts(); - - const tx = await pluginRepoFactoryContract.createPluginRepo( - subdomain, - deployer - ); - console.log( - `Creating & registering repo for ${pluginName} with tx ${tx.hash}` - ); - await tx.wait(); - - const event = await findEventTopicLog( - tx, - PluginRepoRegistry__factory.createInterface(), - 'PluginRepoRegistered' - ); - const repoAddress = event.args.pluginRepo; - - hre.aragonPluginRepos[pluginName] = repoAddress; - - console.log( - `Created & registered repo for ${pluginName} at address: ${repoAddress}` //, with contentURI ${ethers.utils.toUtf8String(releaseMetadata)}` - ); -} - -export async function createVersion( - pluginRepoContract: string, - pluginSetupContract: string, - releaseNumber: number, - releaseMetadata: string, - buildMetadata: string -): Promise { - const signers = await ethers.getSigners(); - - const PluginRepo = new PluginRepo__factory(signers[0]); - const pluginRepo = PluginRepo.attach(pluginRepoContract); - - const tx = await pluginRepo.createVersion( - releaseNumber, - pluginSetupContract, - buildMetadata, - releaseMetadata - ); - - console.log(`Creating build for release ${releaseNumber} with tx ${tx.hash}`); - - await tx.wait(); - - const versionCreatedEvent = await findEvent( - tx, - 'VersionCreated' - ); - - console.log( - `Created build ${versionCreatedEvent.args.build} for release ${ - versionCreatedEvent.args.release - } with setup address: ${ - versionCreatedEvent.args.pluginSetup - }, with build metadata ${ethers.utils.toUtf8String( - buildMetadata - )} and release metadata ${ethers.utils.toUtf8String(releaseMetadata)}` - ); -} - -export type LatestVersion = { - versionTag: VersionTag; - pluginSetupContract: string; - releaseMetadata: string; - buildMetadata: string; -}; - -function isSorted(latestVersions: LatestVersion[]): boolean { - // The list of latest versions has to start with the first release, otherwise something is wrong and we must stop. - if (latestVersions[0].versionTag[0] != 1) { - return false; - } - - for (let i = 0; i < latestVersions.length - 1; i++) { - if ( - !( - latestVersions[i + 1].versionTag[0] == - latestVersions[i].versionTag[0] + 1 - ) - ) { - return false; - } - } - return true; -} - -export async function populatePluginRepo( - hre: HardhatRuntimeEnvironment, - pluginRepoName: string, - latestVersions: LatestVersion[] -): Promise { - // make sure that the latestVersions array is sorted by version tag - if (!isSorted(latestVersions)) { - throw new Error(`${latestVersions} is not sorted in ascending order`); - } - - for (const latestVersion of latestVersions) { - const releaseNumber = latestVersion.versionTag[0]; - const latestBuildNumber = latestVersion.versionTag[1]; - - const placeholderSetup = await getContractAddress('PlaceholderSetup', hre); - - const emptyJsonObject = ethers.utils.hexlify( - ethers.utils.toUtf8Bytes('{}') - ); - - for (let i = 1; i < latestBuildNumber; i++) { - await createVersion( - hre.aragonPluginRepos[pluginRepoName], - placeholderSetup, - releaseNumber, - emptyJsonObject, - ethers.utils.hexlify( - ethers.utils.toUtf8Bytes(`ipfs://${hre.placeholderBuildCIDPath}`) - ) - ); - } - - // create latest builds - await createVersion( - hre.aragonPluginRepos[pluginRepoName], - latestVersion.pluginSetupContract, - releaseNumber, - latestVersion.releaseMetadata, - latestVersion.buildMetadata - ); - } -} - -export async function checkSetManagementDao( - contract: Contract, - expectedDaoAddress: string -) { - const setDAO = await contract.dao(); - if (setDAO !== expectedDaoAddress) { - throw new Error( - `${contract.address} has wrong DAO. Expected ${setDAO} to be ${expectedDaoAddress}` - ); - } -} - -export type Permission = { - operation: Operation; - where: {name: string; address: string}; - who: {name: string; address: string}; - permission: string; - condition?: string; - data?: string; -}; - -export async function checkPermission( - permissionManagerContract: Contract, - permission: Permission -) { - const checkStatus = await isPermissionSetCorrectly( - permissionManagerContract, - permission - ); - if (!checkStatus) { - const {who, where, operation} = permission; - if (operation === Operation.Grant) { - throw new Error( - `(${who.name}: ${who.address}) doesn't have ${permission.permission} on (${where.name}: ${where.address}) in ${permissionManagerContract.address}` - ); - } - throw new Error( - `(${who.name}: ${who.address}) has ${permission.permission} on (${where.name}: ${where.address}) in ${permissionManagerContract.address}` - ); - } -} - -export async function isPermissionSetCorrectly( - permissionManagerContract: Contract, - {operation, where, who, permission, data = '0x'}: Permission -): Promise { - const permissionId = ethers.utils.id(permission); - const isGranted = await permissionManagerContract.isGranted( - where.address, - who.address, - permissionId, - data - ); - if (!isGranted && operation === Operation.Grant) { - return false; - } - - if (isGranted && operation === Operation.Revoke) { - return false; - } - return true; -} - -export async function managePermissions( - permissionManagerContract: Contract, - permissions: Permission[] -): Promise { - // filtering permission to only apply those that are needed - const items: Permission[] = []; - for (const permission of permissions) { - if (await isPermissionSetCorrectly(permissionManagerContract, permission)) { - continue; - } - items.push(permission); - } - - if (items.length === 0) { - console.log(`Contract call skipped. No permissions to set...`); - return; - } - - console.log( - `Setting ${items.length} permissions. Skipped ${ - permissions.length - items.length - }` - ); - const tx = await permissionManagerContract.applyMultiTargetPermissions( - items.map(item => [ - item.operation, - item.where.address, - item.who.address, - item.condition || ethers.constants.AddressZero, - ethers.utils.id(item.permission), - ]) - ); - console.log(`Set permissions with ${tx.hash}. Waiting for confirmation...`); - await tx.wait(); - - items.forEach(permission => { - console.log( - `${ - permission.operation === Operation.Grant ? 'Granted' : 'Revoked' - } the ${permission.permission} of (${permission.where.name}: ${ - permission.where.address - }) for (${permission.who.name}: ${permission.who.address}), see (tx: ${ - tx.hash - })` - ); - }); -} - -export async function isENSDomainRegistered( - domain: string, - ensRegistryAddress: string, - signer: SignerWithAddress -): Promise { - const ensRegistryContract = ENSRegistry__factory.connect( - ensRegistryAddress, - signer - ); - - return ensRegistryContract.recordExists(ethers.utils.namehash(domain)); -} - -export async function getENSAddress( - hre: HardhatRuntimeEnvironment -): Promise { - if (ENS_ADDRESSES[hre.network.name]) { - return ENS_ADDRESSES[hre.network.name]; - } - - const ensDeployment = await hre.deployments.get('ENSRegistry'); - if (ensDeployment) { - return ensDeployment.address; - } - - throw new Error('ENS address not found.'); -} - -export async function getPublicResolverAddress( - hre: HardhatRuntimeEnvironment -): Promise { - if (ENS_PUBLIC_RESOLVERS[hre.network.name]) { - return ENS_PUBLIC_RESOLVERS[hre.network.name]; - } - - const publicResolverDeployment = await hre.deployments.get('PublicResolver'); - if (publicResolverDeployment) { - return publicResolverDeployment.address; - } - - throw new Error('PublicResolver address not found.'); -} - -export async function registerSubnodeRecord( - domain: string, - owner: SignerWithAddress, - ensRegistryAddress: string, - publicResolver: string -): Promise { - const domainSplitted = domain.split('.'); - const subdomain = domainSplitted.splice(0, 1)[0]; - const parentDomain = domainSplitted.join('.'); - - const ensRegistryContract = ENSRegistry__factory.connect( - ensRegistryAddress, - owner - ); - const tx = await ensRegistryContract.setSubnodeRecord( - ethers.utils.namehash(parentDomain), - ethers.utils.keccak256(ethers.utils.toUtf8Bytes(subdomain)), - owner.address, - publicResolver, - 0 - ); - await tx.wait(); - return ensRegistryContract.owner(ethers.utils.namehash(domain)); -} - -export async function transferSubnodeRecord( - domain: string, - newOwner: string, - ensRegistryAddress: string -): Promise { - const domainSplitted = domain.split('.'); - const subdomain = domainSplitted.splice(0, 1)[0]; - const parentDomain = domainSplitted.join('.'); - - const [deployer] = await ethers.getSigners(); - - const ensRegistryContract = ENSRegistry__factory.connect( - ensRegistryAddress, - deployer - ); - - const tx = await ensRegistryContract.setSubnodeOwner( - ethers.utils.namehash(parentDomain), - ethers.utils.keccak256(ethers.utils.toUtf8Bytes(subdomain)), - newOwner - ); - console.log( - `Transfering owner of ${domain} to ${newOwner} with tx ${tx.hash}` - ); - await tx.wait(); -} - -// transfers owner ship of a domain and all parent domains to a new owner if it matches the expected current owner -export async function transferSubnodeChain( - fullDomain: string, - newOwner: string, - currentOwner: string, - ensRegistryAddress: string -): Promise { - const [deployer] = await ethers.getSigners(); - - const ensRegistryContract = ENSRegistry__factory.connect( - ensRegistryAddress, - deployer - ); - - const daoDomainSplitted = fullDomain.split('.').reverse(); - let domain = ''; - // +1 on length because we also need to check the owner of the empty domain - for (let i = 0; i < daoDomainSplitted.length + 1; i++) { - const domainOwner = await ensRegistryContract.callStatic.owner( - ethers.utils.namehash(domain) - ); - if (domainOwner !== newOwner && domainOwner === currentOwner) { - const tx = await ensRegistryContract.setOwner( - ethers.utils.namehash(domain), - newOwner - ); - console.log( - `Changing owner of ${domain} from (currentOwner) ${domainOwner} to ${newOwner} (newOwner)` - ); - await tx.wait(); - } - - domain = `${daoDomainSplitted[i]}.${domain}`; - if (i === 0) { - domain = daoDomainSplitted[i]; - } - } -} - -/** - * Returns the management DAO' multisig address defined in the environment variables. Throws if not found - * - * @export - * @param {HardhatRuntimeEnvironment} hre - * @return {string} - */ -export function getManagementDAOMultisigAddress( - hre: HardhatRuntimeEnvironment -): string { - const {network} = hre; - const address = - process.env[`${network.name.toUpperCase()}_MANAGEMENT_DAO_MULTISIG`]; - if (!address) { - throw new Error( - `Failed to find management DAO multisig address in env variables for ${network.name}` - ); - } - return address; -} - -// hh-deploy cannot process files without default exports -export default async () => {}; diff --git a/packages/contracts/hardhat.config.ts b/packages/contracts/hardhat.config.ts index b0a5a67e..b3c0337d 100644 --- a/packages/contracts/hardhat.config.ts +++ b/packages/contracts/hardhat.config.ts @@ -105,7 +105,7 @@ const config: HardhatUserConfig = { throwOnTransactionFailures: true, throwOnCallFailures: true, blockGasLimit: BigNumber.from(10).pow(6).mul(30).toNumber(), // 30 million, really high to test some things that are only possible with a higher block gas limit - gasPrice: BigNumber.from(10).pow(9).mul(1000).toNumber(), // 1000 gwei + gasPrice: BigNumber.from(10).pow(9).mul(150).toNumber(), // 150 gwei accounts: getHardhatNetworkAccountsConfig( Object.keys(namedAccounts).length ), diff --git a/packages/contracts/plugin-settings.ts b/packages/contracts/plugin-settings.ts index 8f1220f1..f19ee5bf 100644 --- a/packages/contracts/plugin-settings.ts +++ b/packages/contracts/plugin-settings.ts @@ -1,15 +1,10 @@ import buildMetadata from './src/build-metadata.json'; import releaseMetadata from './src/release-metadata.json'; import {VersionTag} from '@aragon/osx-commons-sdk'; -import {ethers} from 'hardhat'; -import { GovernanceERC20 } from './test/test-utils/typechain-versions'; -export const PLUGIN_CONTRACT_NAME = 'TokenVoting'; // This must match the filename `packages/contracts/src/MyPlugin.sol` and the contract name `MyPlugin` within. -export const PLUGIN_SETUP_CONTRACT_NAME = 'TokenVotingSetup'; // This must match the filename `packages/contracts/src/MyPluginSetup.sol` and the contract name `MyPluginSetup` within. -export const PLUGIN_REPO_ENS_SUBDOMAIN_NAME = 'token-voting'; // This will result in the ENS domain name 'my.plugin.dao.eth' - -export const GOVERNANCE_ERC20_CONTRACT_NAME = 'GovernanceERC20'; -export const GOVERNANCE_WRAPPED_ERC20_CONTRACT_NAME = 'GovernanceWrappedERC20'; +export const PLUGIN_CONTRACT_NAME = 'MyPlugin'; // This must match the filename `packages/contracts/src/MyPlugin.sol` and the contract name `MyPlugin` within. +export const PLUGIN_SETUP_CONTRACT_NAME = 'MyPluginSetup'; // This must match the filename `packages/contracts/src/MyPluginSetup.sol` and the contract name `MyPluginSetup` within. +export const PLUGIN_REPO_ENS_SUBDOMAIN_NAME = 'my'; // This will result in the ENS domain name 'my.plugin.dao.eth' export const VERSION: VersionTag = { release: 1, // Increment this number ONLY if breaking/incompatible changes were made. Updates between releases are NOT possible. @@ -21,26 +16,3 @@ export const METADATA = { build: buildMetadata, release: releaseMetadata, }; - -const zeroDaoAddress = ethers.constants.AddressZero; -const zeroTokenAddress = ethers.constants.AddressZero; -const emptyName = ''; -const emptySymbol = ''; - -export const emptyMintSettings: GovernanceERC20.MintSettingsStruct = { - receivers: [], - amounts: [], -}; - -export const GOVERNANCE_ERC20_DEPLOY_ARGS = [ - zeroDaoAddress, - emptyName, - emptySymbol, - emptyMintSettings, -]; - -export const GOVERNANCE_WRAPPED_ERC20_DEPLOY_ARGS = [ - zeroTokenAddress, - emptyName, - emptySymbol, -]; diff --git a/packages/contracts/utils/ens.ts b/packages/contracts/utils/ens.ts deleted file mode 100644 index c0a7c856..00000000 --- a/packages/contracts/utils/ens.ts +++ /dev/null @@ -1,91 +0,0 @@ -import ensRegistryArtifact from '../artifacts/@ensdomains/ens-contracts/contracts/registry/ENSRegistry.sol/ENSRegistry.json'; -import publicResolverArtifact from '../artifacts/@ensdomains/ens-contracts/contracts/resolvers/PublicResolver.sol/PublicResolver.json'; -import {ENSRegistry__factory} from '../typechain'; -import {ethers} from 'hardhat'; -import {HardhatRuntimeEnvironment} from 'hardhat/types'; - -export function ensLabelHash(label: string): string { - return ethers.utils.id(label); -} - -export function ensDomainHash(name: string): string { - return ethers.utils.namehash(name); -} - -export async function setupENS( - domains: string[], - hre: HardhatRuntimeEnvironment -): Promise { - const {deployments, ethers} = hre; - const {deploy} = deployments; - const [deployer] = await ethers.getSigners(); - - // Deploy the ENSRegistry - await deploy('ENSRegistry', { - contract: ensRegistryArtifact, - from: deployer.address, - args: [], - log: true, - }); - - const ensDeployment = await deployments.get('ENSRegistry'); - const ens = ENSRegistry__factory.connect(ensDeployment.address, deployer); - - // Deploy the Resolver - await deploy('PublicResolver', { - contract: publicResolverArtifact, - from: deployer.address, - args: [ensDeployment.address, ethers.constants.AddressZero], - }); - - const resolver = await deployments.get('PublicResolver'); - - for (let i = 0; i < domains.length; i++) { - console.log(`Registering subdomain ${domains[i]}`); - - const resolvedResolver = await ens.resolver(ensDomainHash(domains[i])); - if (resolvedResolver === resolver.address) { - console.log(`${domains[i]} already registered. Skipping...`); - continue; - } - - // Register subdomains in the reverse order - let domainNamesReversed = domains[i].split('.'); - domainNamesReversed.push(''); //add the root domain - domainNamesReversed = domainNamesReversed.reverse(); - - for (let i = 0; i < domainNamesReversed.length - 1; i++) { - // to support subdomains - const domain = domainNamesReversed - .map((value, index) => (index <= i ? value : '')) - .filter(value => value !== '') - .reverse() - .join('.'); - - // skipping if it is already set - const resolvedResolver = await ens.resolver( - ensDomainHash( - `${domainNamesReversed[i + 1]}${domain ? '.' + domain : ''}` - ) - ); - if (resolvedResolver !== ethers.constants.AddressZero) { - continue; - } - - const tx = await ens.setSubnodeRecord( - ensDomainHash(domain), - ensLabelHash(domainNamesReversed[i + 1]), - deployer.address, - resolver.address, - 0 - ); - await tx.wait(); - } - - console.log(`Registered subdomain ${domains[i]}`); - } - - console.log(`ENS Setup complete!`); - - return ens; -} diff --git a/packages/contracts/utils/environment.ts b/packages/contracts/utils/environment.ts deleted file mode 100644 index 263f1ffc..00000000 --- a/packages/contracts/utils/environment.ts +++ /dev/null @@ -1,52 +0,0 @@ -import {HARDHAT_NETWORK_NAME} from 'hardhat/plugins'; -import {Network} from 'hardhat/types'; - -export const isLocal = (network: Network): boolean => - [HARDHAT_NETWORK_NAME, 'localhost', 'coverage'].includes(network.name); - -// known hardhat accounts and private keys unlocked by default in the HH node -export const HARDHAT_ACCOUNTS: Array<{KEY: string; ADDRESS: string}> = [ - { - KEY: '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', - ADDRESS: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', - }, - { - KEY: '0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', - ADDRESS: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', - }, -] as const; - -/** - * Provides default values for environment variables if running in local - * else requires that the environment variables are set - * @param network The hardhat network object. - * @param name The name of the environment variable. - * @param defaultValue The fallback value to be used if not set and in development mode. - * @returns The value of the environment variable, or a fallback if possible. - */ -export function env( - network: Network, - name: string, - defaultValue: string -): string { - const value = process.env[name]; - if (!isLocal(network) && !value) { - throw new Error(`Missing env var: ${name}`); - } - return process.env[name] || defaultValue; -} - -/// Specific environment variables with hardcoded defaults in local environments - -export const daoDomainEnv = (network: Network): string => - env(network, `${network.name.toUpperCase()}_DAO_ENS_DOMAIN`, 'dao.eth'); - -export const pluginDomainEnv = (network: Network): string => - env( - network, - `${network.name.toUpperCase()}_PLUGIN_ENS_DOMAIN`, - 'plugin.dao.eth' - ); - -export const ethKeyEnv = (network: Network): string => - env(network, 'ETH_KEY', HARDHAT_ACCOUNTS[1].KEY); diff --git a/packages/contracts/utils/helpers.ts b/packages/contracts/utils/helpers.ts index 79e077a8..f40c8088 100644 --- a/packages/contracts/utils/helpers.ts +++ b/packages/contracts/utils/helpers.ts @@ -10,8 +10,6 @@ import { findEvent, } from '@aragon/osx-commons-sdk'; import { - DAO, - DAO__factory, ENSSubdomainRegistrar__factory, ENS__factory, IAddrResolver__factory, @@ -19,9 +17,7 @@ import { PluginRepoEvents, PluginRepo__factory, } from '@aragon/osx-ethers'; -import {setBalance} from '@nomicfoundation/hardhat-network-helpers'; -import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers'; -import {BigNumber, ContractTransaction} from 'ethers'; +import {ContractTransaction} from 'ethers'; import {LogDescription, defaultAbiCoder, keccak256} from 'ethers/lib/utils'; import {ethers} from 'hardhat'; import {HardhatRuntimeEnvironment} from 'hardhat/types'; @@ -190,38 +186,3 @@ export async function createVersion( export const AragonOSxAsciiArt = " ____ _____ \n /\\ / __ \\ / ____| \n / \\ _ __ __ _ __ _ ___ _ __ | | | | (_____ __ \n / /\\ \\ | '__/ _` |/ _` |/ _ \\| '_ \\ | | | |\\___ \\ \\/ / \n / ____ \\| | | (_| | (_| | (_) | | | | | |__| |____) > < \n /_/ \\_\\_| \\__,_|\\__, |\\___/|_| |_| \\____/|_____/_/\\_\\ \n __/ | \n |___/ \n"; - -export async function getManagementDao( - hre: HardhatRuntimeEnvironment -): Promise { - const [deployer] = await hre.ethers.getSigners(); - const productionNetworkName = getProductionNetworkName(hre); - const network = getNetworkNameByAlias(productionNetworkName); - if (network === null) { - throw new UnsupportedNetworkError(productionNetworkName); - } - const networkDeployments = getLatestNetworkDeployment(network); - if (networkDeployments === null) { - throw `Deployments are not available on network ${network}.`; - } - - return DAO__factory.connect( - networkDeployments.ManagementDAOProxy.address, - deployer - ); -} - -export async function impersonatedManagementDaoSigner( - hre: HardhatRuntimeEnvironment -): Promise { - return await (async () => { - const managementDaoProxy = getManagementDao(hre); - const signer = await hre.ethers.getImpersonatedSigner( - ( - await managementDaoProxy - ).address - ); - await setBalance(signer.address, BigNumber.from(10).pow(18)); - return signer; - })(); -} diff --git a/packages/contracts/utils/psp.ts b/packages/contracts/utils/psp.ts deleted file mode 100644 index d093c158..00000000 --- a/packages/contracts/utils/psp.ts +++ /dev/null @@ -1,5 +0,0 @@ -import {defaultAbiCoder, keccak256} from 'ethers/lib/utils'; - -export function hashHelpers(helpers: string[]) { - return keccak256(defaultAbiCoder.encode(['address[]'], [helpers])); -} diff --git a/packages/contracts/utils/storage.ts b/packages/contracts/utils/storage.ts deleted file mode 100644 index 543c0fa1..00000000 --- a/packages/contracts/utils/storage.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {defaultAbiCoder} from 'ethers/lib/utils'; -import {ethers} from 'hardhat'; - -// See https://eips.ethereum.org/EIPS/eip-1967 -export const ERC1967_IMPLEMENTATION_SLOT = - '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc'; // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1) - -export const OZ_INITIALIZED_SLOT_POSITION = 0; - -export async function readStorage( - contractAddress: string, - location: number | string, - types: string[] -): Promise { - return ethers.provider - .getStorageAt(contractAddress, location) - .then(encoded => defaultAbiCoder.decode(types, encoded)[0]); -} diff --git a/yarn.lock b/yarn.lock index 1d83c543..902c836c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,10 +7,10 @@ resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.22.13": - version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.23.4.tgz#03ae5af150be94392cb5c7ccd97db5a19a5da6aa" - integrity sha512-r1IONyb6Ia+jYR2vvIDhdWdlTGhqbBoFqLTQidzZ4kepUFH15ejXvFHxCVbtl7BOXIudsIubf4E81xeA3h3IXA== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.22.13", "@babel/code-frame@^7.23.5": + version "7.23.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244" + integrity sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA== dependencies: "@babel/highlight" "^7.23.4" chalk "^2.4.2" @@ -25,11 +25,11 @@ source-map "^0.5.0" "@babel/generator@^7.23.0": - version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.4.tgz#4a41377d8566ec18f807f42962a7f3551de83d1c" - integrity sha512-esuS49Cga3HcThFNebGhlgsrVLkvhqvYDTzgjfFFlHJcIfLe5jFmRRfCQ1KuBfc4Jrtn3ndLgKWAKjBE+IraYQ== + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.6.tgz#9e1fca4811c77a10580d17d26b57b036133f3c2e" + integrity sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw== dependencies: - "@babel/types" "^7.23.4" + "@babel/types" "^7.23.6" "@jridgewell/gen-mapping" "^0.3.2" "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" @@ -80,19 +80,19 @@ chalk "^2.4.2" js-tokens "^4.0.0" -"@babel/parser@^7.20.5", "@babel/parser@^7.22.15", "@babel/parser@^7.23.0": - version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.4.tgz#409fbe690c333bb70187e2de4021e1e47a026661" - integrity sha512-vf3Xna6UEprW+7t6EtOmFpHNAuxw3xqPZghy+brsnusscJRW5BMUzzHZc5ICjULee81WeUV2jjakG09MDglJXQ== +"@babel/parser@^7.20.5", "@babel/parser@^7.23.0", "@babel/parser@^7.24.0": + version "7.24.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.0.tgz#26a3d1ff49031c53a97d03b604375f028746a9ac" + integrity sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg== "@babel/template@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" - integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== + version "7.24.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.0.tgz#c6a524aa93a4a05d66aaf31654258fae69d87d50" + integrity sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA== dependencies: - "@babel/code-frame" "^7.22.13" - "@babel/parser" "^7.22.15" - "@babel/types" "^7.22.15" + "@babel/code-frame" "^7.23.5" + "@babel/parser" "^7.24.0" + "@babel/types" "^7.24.0" "@babel/traverse@7.23.2": version "7.23.2" @@ -118,10 +118,10 @@ "@babel/helper-validator-identifier" "^7.16.7" to-fast-properties "^2.0.0" -"@babel/types@^7.17.0", "@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.4": - version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.4.tgz#7206a1810fc512a7f7f7d4dace4cb4c1c9dbfb8e" - integrity sha512-7uIFwVYpoplT5jp/kVv6EF93VaJ8H+Yn5IczYiaAi98ajzjfoZfslet/e0sLh+wVBjb2qqIut1b0S26VSafsSQ== +"@babel/types@^7.17.0", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.6", "@babel/types@^7.24.0": + version "7.24.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.0.tgz#3b951f435a92e7333eba05b7566fd297960ea1bf" + integrity sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w== dependencies: "@babel/helper-string-parser" "^7.23.4" "@babel/helper-validator-identifier" "^7.22.20" @@ -139,10 +139,10 @@ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== -"@eslint/eslintrc@^2.1.3": - version "2.1.3" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.3.tgz#797470a75fe0fbd5a53350ee715e85e87baff22d" - integrity sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA== +"@eslint/eslintrc@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad" + integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ== dependencies: ajv "^6.12.4" debug "^4.3.2" @@ -154,18 +154,18 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.54.0": - version "8.54.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.54.0.tgz#4fab9a2ff7860082c304f750e94acd644cf984cf" - integrity sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ== +"@eslint/js@8.57.0": + version "8.57.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.0.tgz#a5417ae8427873f1dd08b70b3574b453e67b5f7f" + integrity sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g== -"@humanwhocodes/config-array@^0.11.13": - version "0.11.13" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.13.tgz#075dc9684f40a531d9b26b0822153c1e832ee297" - integrity sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ== +"@humanwhocodes/config-array@^0.11.14": + version "0.11.14" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b" + integrity sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg== dependencies: - "@humanwhocodes/object-schema" "^2.0.1" - debug "^4.1.1" + "@humanwhocodes/object-schema" "^2.0.2" + debug "^4.3.1" minimatch "^3.0.5" "@humanwhocodes/module-importer@^1.0.1": @@ -173,29 +173,29 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== -"@humanwhocodes/object-schema@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz#e5211452df060fa8522b55c7b3c0c4d1981cb044" - integrity sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw== +"@humanwhocodes/object-schema@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz#d9fae00a2d5cb40f92cfe64b47ad749fbc38f917" + integrity sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw== "@jridgewell/gen-mapping@^0.3.2": - version "0.3.3" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" - integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== + version "0.3.4" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.4.tgz#9b18145d26cf33d08576cf4c7665b28554480ed7" + integrity sha512-Oud2QPM5dHviZNn4y/WhhYKSXksv+1xLEIsNrAbGcFzUN3ubqWRFT5gwPchNc5NuzILOU4tPBDTZ4VwhL8Y7cw== dependencies: "@jridgewell/set-array" "^1.0.1" "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.9" "@jridgewell/resolve-uri@^3.1.0": - version "3.1.1" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" - integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== "@jridgewell/set-array@^1.0.1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" - integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== + version "1.2.1" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" + integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": version "1.4.15" @@ -203,9 +203,9 @@ integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": - version "0.3.20" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz#72e45707cf240fa6b081d0366f8265b0cd10197f" - integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q== + version "0.3.23" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.23.tgz#afc96847f3f07841477f303eed687707a5aacd80" + integrity sha512-9/4foRoUKp8s96tSkh8DlAAc5A0Ty8vLXld+l9gjKKY6ckwI8G15f0hskGmuLZu78ZlGa1vtsfOa+lnB4vG6Jg== dependencies: "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" @@ -231,13 +231,18 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@solidity-parser/parser@^0.16.0", "@solidity-parser/parser@^0.16.2": +"@solidity-parser/parser@^0.16.0": version "0.16.2" resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.16.2.tgz#42cb1e3d88b3e8029b0c9befff00b634cd92d2fa" integrity sha512-PI9NfoA3P8XK2VBkK5oIfRgKDsicwDZfkVq9ZTBCQYGOP1N2owgY2dyLGyU5/J/hQs8KRk55kdmvTLjy3Mu3vg== dependencies: antlr4ts "^0.5.0-alpha.4" +"@solidity-parser/parser@^0.17.0": + version "0.17.0" + resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.17.0.tgz#52a2fcc97ff609f72011014e4c5b485ec52243ef" + integrity sha512-Nko8R0/kUo391jsEHHxrGM07QFdnPGvlmox4rmH0kNiNAashItAilhy4Mv4pK5gQmW5f4sXAF58fwJbmlkGcVw== + "@trivago/prettier-plugin-sort-imports@^4.1.1": version "4.3.0" resolved "https://registry.yarnpkg.com/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.3.0.tgz#725f411646b3942193a37041c84e0b2116339789" @@ -256,20 +261,20 @@ integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== "@types/semver@^7.5.0": - version "7.5.6" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.6.tgz#c65b2bfce1bec346582c07724e3f8c1017a20339" - integrity sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A== + version "7.5.8" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" + integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== "@typescript-eslint/eslint-plugin@^6.12.0": - version "6.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.12.0.tgz#2a647d278bb48bf397fef07ba0507612ff9dd812" - integrity sha512-XOpZ3IyJUIV1b15M7HVOpgQxPPF7lGXgsfcEIu3yDxFPaf/xZKt7s9QO/pbk7vpWQyVulpJbu4E5LwpZiQo4kA== + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz#30830c1ca81fd5f3c2714e524c4303e0194f9cd3" + integrity sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA== dependencies: "@eslint-community/regexpp" "^4.5.1" - "@typescript-eslint/scope-manager" "6.12.0" - "@typescript-eslint/type-utils" "6.12.0" - "@typescript-eslint/utils" "6.12.0" - "@typescript-eslint/visitor-keys" "6.12.0" + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/type-utils" "6.21.0" + "@typescript-eslint/utils" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" debug "^4.3.4" graphemer "^1.4.0" ignore "^5.2.4" @@ -278,71 +283,72 @@ ts-api-utils "^1.0.1" "@typescript-eslint/parser@^6.12.0": - version "6.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.12.0.tgz#9fb21ed7d88065a4a2ee21eb80b8578debb8217c" - integrity sha512-s8/jNFPKPNRmXEnNXfuo1gemBdVmpQsK1pcu+QIvuNJuhFzGrpD7WjOcvDc/+uEdfzSYpNu7U/+MmbScjoQ6vg== - dependencies: - "@typescript-eslint/scope-manager" "6.12.0" - "@typescript-eslint/types" "6.12.0" - "@typescript-eslint/typescript-estree" "6.12.0" - "@typescript-eslint/visitor-keys" "6.12.0" + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.21.0.tgz#af8fcf66feee2edc86bc5d1cf45e33b0630bf35b" + integrity sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ== + dependencies: + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/typescript-estree" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@6.12.0": - version "6.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.12.0.tgz#5833a16dbe19cfbad639d4d33bcca5e755c7044b" - integrity sha512-5gUvjg+XdSj8pcetdL9eXJzQNTl3RD7LgUiYTl8Aabdi8hFkaGSYnaS6BLc0BGNaDH+tVzVwmKtWvu0jLgWVbw== +"@typescript-eslint/scope-manager@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1" + integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg== dependencies: - "@typescript-eslint/types" "6.12.0" - "@typescript-eslint/visitor-keys" "6.12.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" -"@typescript-eslint/type-utils@6.12.0": - version "6.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.12.0.tgz#968f7c95162808d69950ab5dff710ad730e58287" - integrity sha512-WWmRXxhm1X8Wlquj+MhsAG4dU/Blvf1xDgGaYCzfvStP2NwPQh6KBvCDbiOEvaE0filhranjIlK/2fSTVwtBng== +"@typescript-eslint/type-utils@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz#6473281cfed4dacabe8004e8521cee0bd9d4c01e" + integrity sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag== dependencies: - "@typescript-eslint/typescript-estree" "6.12.0" - "@typescript-eslint/utils" "6.12.0" + "@typescript-eslint/typescript-estree" "6.21.0" + "@typescript-eslint/utils" "6.21.0" debug "^4.3.4" ts-api-utils "^1.0.1" -"@typescript-eslint/types@6.12.0": - version "6.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.12.0.tgz#ffc5297bcfe77003c8b7b545b51c2505748314ac" - integrity sha512-MA16p/+WxM5JG/F3RTpRIcuOghWO30//VEOvzubM8zuOOBYXsP+IfjoCXXiIfy2Ta8FRh9+IO9QLlaFQUU+10Q== +"@typescript-eslint/types@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d" + integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg== -"@typescript-eslint/typescript-estree@6.12.0": - version "6.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.12.0.tgz#764ccc32598549e5b48ec99e3b85f89b1385310c" - integrity sha512-vw9E2P9+3UUWzhgjyyVczLWxZ3GuQNT7QpnIY3o5OMeLO/c8oHljGc8ZpryBMIyympiAAaKgw9e5Hl9dCWFOYw== +"@typescript-eslint/typescript-estree@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46" + integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ== dependencies: - "@typescript-eslint/types" "6.12.0" - "@typescript-eslint/visitor-keys" "6.12.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" + minimatch "9.0.3" semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/utils@6.12.0": - version "6.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.12.0.tgz#c6ce8c06fe9b0212620e5674a2036f6f8f611754" - integrity sha512-LywPm8h3tGEbgfyjYnu3dauZ0U7R60m+miXgKcZS8c7QALO9uWJdvNoP+duKTk2XMWc7/Q3d/QiCuLN9X6SWyQ== +"@typescript-eslint/utils@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.21.0.tgz#4714e7a6b39e773c1c8e97ec587f520840cd8134" + integrity sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ== dependencies: "@eslint-community/eslint-utils" "^4.4.0" "@types/json-schema" "^7.0.12" "@types/semver" "^7.5.0" - "@typescript-eslint/scope-manager" "6.12.0" - "@typescript-eslint/types" "6.12.0" - "@typescript-eslint/typescript-estree" "6.12.0" + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/typescript-estree" "6.21.0" semver "^7.5.4" -"@typescript-eslint/visitor-keys@6.12.0": - version "6.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.12.0.tgz#5877950de42a0f3344261b7a1eee15417306d7e9" - integrity sha512-rg3BizTZHF1k3ipn8gfrzDXXSFKyOEB5zxYXInQ6z0hUvmQlhaZQzK+YmHmNViMA9HzW5Q9+bPPt90bU6GQwyw== +"@typescript-eslint/visitor-keys@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47" + integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A== dependencies: - "@typescript-eslint/types" "6.12.0" + "@typescript-eslint/types" "6.21.0" eslint-visitor-keys "^3.4.1" "@ungap/structured-clone@^1.2.0": @@ -356,9 +362,9 @@ acorn-jsx@^5.3.2: integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn@^8.9.0: - version "8.11.2" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.2.tgz#ca0d78b51895be5390a5903c5b3bdcdaf78ae40b" - integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w== + version "8.11.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" + integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== ajv@^6.12.4, ajv@^6.12.6: version "6.12.6" @@ -531,7 +537,7 @@ cross-spawn@^7.0.2: shebang-command "^2.0.0" which "^2.0.1" -debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: +debug@^4.1.0, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -598,15 +604,15 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4 integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== eslint@^8.41.0: - version "8.54.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.54.0.tgz#588e0dd4388af91a2e8fa37ea64924074c783537" - integrity sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA== + version "8.57.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.0.tgz#c786a6fd0e0b68941aaf624596fb987089195668" + integrity sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.6.1" - "@eslint/eslintrc" "^2.1.3" - "@eslint/js" "8.54.0" - "@humanwhocodes/config-array" "^0.11.13" + "@eslint/eslintrc" "^2.1.4" + "@eslint/js" "8.57.0" + "@humanwhocodes/config-array" "^0.11.14" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" "@ungap/structured-clone" "^1.2.0" @@ -706,9 +712,9 @@ fast-levenshtein@^2.0.6: integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== fastq@^1.6.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" - integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== + version "1.17.1" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" + integrity sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w== dependencies: reusify "^1.0.4" @@ -744,9 +750,9 @@ flat-cache@^3.0.4: rimraf "^3.0.2" flatted@^3.2.9: - version "3.2.9" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf" - integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ== + version "3.3.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" + integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== fs.realpath@^1.0.0: version "1.0.0" @@ -796,9 +802,9 @@ globals@^11.1.0: integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== globals@^13.19.0: - version "13.23.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.23.0.tgz#ef31673c926a0976e1f61dab4dca57e0c0a8af02" - integrity sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA== + version "13.24.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.24.0.tgz#8432a19d78ce0c1e833949c36adb345400bb1171" + integrity sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ== dependencies: type-fest "^0.20.2" @@ -830,9 +836,9 @@ has-flag@^4.0.0: integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== ignore@^5.2.0, ignore@^5.2.4: - version "5.3.0" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.0.tgz#67418ae40d34d6999c95ff56016759c718c82f78" - integrity sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg== + version "5.3.1" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" + integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== import-fresh@^3.2.1, import-fresh@^3.3.0: version "3.3.0" @@ -1006,6 +1012,13 @@ micromatch@^4.0.4: braces "^3.0.2" picomatch "^2.3.1" +minimatch@9.0.3: + version "9.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" + integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== + dependencies: + brace-expansion "^2.0.1" + minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -1123,13 +1136,13 @@ prettier-linter-helpers@^1.0.0: fast-diff "^1.1.2" prettier-plugin-solidity@^1.1.3: - version "1.2.0" - resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.2.0.tgz#dc620b4fc7708a60687a87cdc803e57a1856b6fd" - integrity sha512-fgxcUZpVAP+LlRfy5JI5oaAkXGkmsje2VJ5krv/YMm+rcTZbIUwFguSw5f+WFuttMjpDm6wB4UL7WVkArEfiVA== + version "1.3.1" + resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.3.1.tgz#59944d3155b249f7f234dee29f433524b9a4abcf" + integrity sha512-MN4OP5I2gHAzHZG1wcuJl0FsLS3c4Cc5494bbg+6oQWBPuEamjwDvmGfFMZ6NFzsh3Efd9UUxeT7ImgjNH4ozA== dependencies: - "@solidity-parser/parser" "^0.16.2" + "@solidity-parser/parser" "^0.17.0" semver "^7.5.4" - solidity-comments-extractor "^0.0.7" + solidity-comments-extractor "^0.0.8" prettier@^2.8.3, prettier@^2.8.8: version "2.8.8" @@ -1176,9 +1189,9 @@ run-parallel@^1.1.9: queue-microtask "^1.2.2" semver@^7.5.2, semver@^7.5.4: - version "7.5.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" - integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + version "7.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" + integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== dependencies: lru-cache "^6.0.0" @@ -1240,10 +1253,10 @@ solhint@^3.6.2: optionalDependencies: prettier "^2.8.3" -solidity-comments-extractor@^0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/solidity-comments-extractor/-/solidity-comments-extractor-0.0.7.tgz#99d8f1361438f84019795d928b931f4e5c39ca19" - integrity sha512-wciNMLg/Irp8OKGrh3S2tfvZiZ0NEyILfcRCXCD4mp7SgK/i9gzLfhY2hY7VMCQJ3kH9UB9BzNdibIVMchzyYw== +solidity-comments-extractor@^0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/solidity-comments-extractor/-/solidity-comments-extractor-0.0.8.tgz#f6e148ab0c49f30c1abcbecb8b8df01ed8e879f8" + integrity sha512-htM7Vn6LhHreR+EglVMd2s+sZhcXAirB1Zlyrv5zBuTxieCvjfnRpd7iZk75m/u6NOlEyQ94C6TWbBn2cY7w8g== source-map@^0.5.0: version "0.5.7" @@ -1314,9 +1327,9 @@ to-regex-range@^5.0.1: is-number "^7.0.0" ts-api-utils@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331" - integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg== + version "1.2.1" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.2.1.tgz#f716c7e027494629485b21c0df6180f4d08f5e8b" + integrity sha512-RIYA36cJn2WiH9Hy77hdF9r7oEwxAtB/TS9/S4Qd90Ap4z5FSiin5zEiTL44OII1Y3IIlEvxwxFUVgrHSZ/UpA== type-check@^0.4.0, type-check@~0.4.0: version "0.4.0"