Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: hardhat typescript typing #347

Merged
merged 2 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {DeployFunction} from 'hardhat-deploy/types';
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`\nDeploying ManagingDao.`);

const {deployments, getNamedAccounts, ethers, network} = hre;
const {deployments, getNamedAccounts, ethers} = hre;
const {deploy} = deployments;
const {deployer} = await getNamedAccounts();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {EHRE, Operation} from '../../utils/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {Operation} from '../../utils/types';
import {getContractAddress, managePermissions} from '../helpers';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {getNamedAccounts, ethers} = hre;
const {deployer} = await getNamedAccounts();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {EHRE} from '../../utils/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding ManagingDao deployment.\n`);

const {deployments} = hre;
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/deploy/10_framework/00_ens_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {DeployFunction} from 'hardhat-deploy/types';

import {setupENS} from '../../utils/ens';

import {ENS_ADDRESSES, getContractAddress} from '../helpers';
import {ENS_ADDRESSES} from '../helpers';

// Make sure you own the ENS set in the {{NETWORK}}_ENS_DOMAIN variable in .env
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/deploy/10_framework/01_ens_subdomains.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {EHRE} from '../../utils/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {
getContractAddress,
getENSAddress,
Expand All @@ -8,7 +8,7 @@ import {
transferSubnodeChain,
} from '../helpers';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {ethers, network, getNamedAccounts} = hre;
const {deployer} = await getNamedAccounts();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DAO} from '../../typechain';
import {EHRE} from '../../utils/types';
import {getContractAddress, getENSAddress} from '../helpers';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts, ethers, network} = hre;
const {deploy} = deployments;
const {deployer} = await getNamedAccounts();
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/deploy/10_framework/09_ens_conclude.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {EHRE} from '../../utils/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding ENS deployment.\n`);

const {deployments} = hre;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {EHRE} from '../../utils/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding DAO Registry deployment.\n`);

const {deployments} = hre;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {EHRE} from '../../utils/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding Plugin Repo Registry deployment.\n`);

const {deployments} = hre;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {EHRE} from '../../utils/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {PluginRepoFactory__factory} from '../../typechain';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding Plugin Repo Registry deployment.\n`);

const [deployer] = await hre.ethers.getSigners();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {EHRE} from '../../utils/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding Plugin Setup Processor deployment.\n`);

const {deployments} = hre;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DAOFactory__factory} from '../../typechain';
import {EHRE} from '../../utils/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding DAOFactory deployment.\n`);
const [deployer] = await hre.ethers.getSigners();

Expand Down
3 changes: 1 addition & 2 deletions packages/contracts/deploy/10_framework/99_verifiy_step.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import {checkSetManagingDao, getContractAddress} from '../helpers';
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log('\nVerifying framework deployment.');

const {getNamedAccounts, ethers} = hre;
const {deployer} = await getNamedAccounts();
const {ethers} = hre;

// Get `managingDAO` address.
const managingDAOAddress = await getContractAddress('DAO', hre);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {setTimeout} from 'timers/promises';
import {AddresslistVotingSetup__factory} from '../../../typechain';
import {EHRE} from '../../../utils/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding addresslist voting setup deployment.\n`);
const [deployer] = await hre.ethers.getSigners();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {ethers} from 'ethers';
import {DeployFunction} from 'hardhat-deploy/types';
import {TokenVotingSetup__factory} from '../../../typechain';
import {EHRE} from '../../../utils/types';
import {setTimeout} from 'timers/promises';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding token voting setup deployment.\n`);
const [deployer] = await hre.ethers.getSigners();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {AdminSetup__factory} from '../../../typechain';
import {EHRE} from '../../../utils/types';
import {setTimeout} from 'timers/promises';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding admin setup deployment.\n`);
const [deployer] = await hre.ethers.getSigners();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {MultisigSetup__factory} from '../../../typechain';
import {EHRE} from '../../../utils/types';
import {setTimeout} from 'timers/promises';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding multisig setup deployment.\n`);
const [deployer] = await hre.ethers.getSigners();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import {DeployFunction} from 'hardhat-deploy/types';
import {uploadToIPFS} from '../../helpers';

import placeholderBuildMetadata from '../../../src/plugins/placeholder-version/build-metadata.json';
import {EHRE} from '../../../utils/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {deploy} = deployments;
const {deployer} = await getNamedAccounts();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {EHRE} from '../../../utils/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding PlaceholdeSetup deployment.\n`);

const {deployments} = hre;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {
PluginRepoFactory__factory,
PluginRepo__factory,
} from '../../../typechain';
import {EHRE} from '../../../utils/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding AddresslistVotingSetup deployment.\n`);
const [deployer] = await hre.ethers.getSigners();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {
PluginRepoFactory__factory,
PluginRepo__factory,
} from '../../../typechain';
import {EHRE} from '../../../utils/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding TokenVotingSetup deployment.\n`);
const [deployer] = await hre.ethers.getSigners();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {
PluginRepoFactory__factory,
PluginRepo__factory,
} from '../../../typechain';
import {EHRE} from '../../../utils/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding TokenVotingSetup deployment.\n`);
const [deployer] = await hre.ethers.getSigners();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {
PluginRepoFactory__factory,
PluginRepo__factory,
} from '../../../typechain';
import {EHRE} from '../../../utils/types';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Concluding AddresslistVotingSetup deployment.\n`);
const [deployer] = await hre.ethers.getSigners();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

import {EHRE, Operation} from '../../utils/types';
import {Operation} from '../../utils/types';
import {getContractAddress, managePermissions, Permission} from '../helpers';
import {PluginRepo__factory} from '../../typechain';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`\nFinalizing ManagingDao.`);

const {getNamedAccounts, ethers} = hre;
const {ethers} = hre;
const [deployer] = await ethers.getSigners();

// Get `DAORegistry` address.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import buildMetadataJson from '../../src/plugins/governance/multisig/build-metad
import {findEvent} from '../../utils/event';

import {checkPermission, getContractAddress} from '../helpers';
import {EHRE, Operation} from '../../utils/types';
import {Operation} from '../../utils/types';
import {hashHelpers} from '../../utils/psp';
import {MultisigSetup__factory, Multisig__factory} from '../../typechain';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {InstallationPreparedEvent} from '../../typechain/PluginSetupProcessor';

const func: DeployFunction = async function (hre: EHRE) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {ethers, network} = hre;
const [deployer] = await ethers.getSigners();

Expand Down Expand Up @@ -55,29 +57,37 @@ const func: DeployFunction = async function (hre: EHRE) {

// Install multisig build 2
const multisigRepoAddress = hre.aragonPluginRepos['multisig'];
const versionTag = [1, 2];
const pluginSetupRef = [versionTag, multisigRepoAddress];
const versionTag = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can adapt the
export type VersionTag = [number, number]; accordingly in packages/contracts/test/test-utils/psp/types.ts and use it here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would rather not. packages/contracts/test/test-utils/psp/types.ts is used by tests and is not shared with the deployment scripts

release: 1,
build: 2,
};
const pluginSetupRef = {
pluginSetupRepo: multisigRepoAddress,
versionTag,
};

// Prepare multisig plugin for managingDAO
const data = ethers.utils.defaultAbiCoder.encode(
buildMetadataJson.pluginSetupABI.prepareInstallation,
[approvers, [listedOnly, minApprovals]]
);
const prepareParams = [pluginSetupRef, data];
const prepareTx = await pspContract.prepareInstallation(
managingDAOAddress,
prepareParams
);
const prepareTx = await pspContract.prepareInstallation(managingDAOAddress, {
data,
pluginSetupRef,
});
await prepareTx.wait();

// extract info from prepare event
const event = await findEvent(prepareTx, 'InstallationPrepared');
const event = await findEvent<InstallationPreparedEvent>(
prepareTx,
'InstallationPrepared'
);
const installationPreparedEvent = event.args;

hre.managingDAOMultisigPluginAddress = installationPreparedEvent.plugin;

console.log(
`Prepared (Multisig: ${installationPreparedEvent.plugin} version ${versionTag}) to be applied on (ManagingDAO: ${managingDAOAddress}), see (tx: ${prepareTx.hash})`
`Prepared (Multisig: ${installationPreparedEvent.plugin} version (release: ${versionTag.release} / build: ${versionTag.build}) to be applied on (ManagingDAO: ${managingDAOAddress}), see (tx: ${prepareTx.hash})`
);

// Adding plugin to verify array
Expand Down Expand Up @@ -105,16 +115,14 @@ const func: DeployFunction = async function (hre: EHRE) {
});

// Apply multisig plugin to the managingDAO
const applyParams = [
const applyTx = await pspContract.applyInstallation(managingDAOAddress, {
helpersHash: hashHelpers(
installationPreparedEvent.preparedSetupData.helpers
),
permissions: installationPreparedEvent.preparedSetupData.permissions,
plugin: installationPreparedEvent.plugin,
pluginSetupRef,
installationPreparedEvent.plugin,
installationPreparedEvent.preparedSetupData.permissions,
hashHelpers(installationPreparedEvent.preparedSetupData.helpers),
];
const applyTx = await pspContract.applyInstallation(
managingDAOAddress,
applyParams
);
});
await applyTx.wait();

await checkPermission(managingDaoContract, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import {DeployFunction} from 'hardhat-deploy/types';

import {getContractAddress, managePermissions, Permission} from '../helpers';
import {EHRE, Operation} from '../../utils/types';
import {Operation} from '../../utils/types';
import {PluginRepo__factory} from '../../typechain';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: EHRE) {
const {getNamedAccounts, ethers} = hre;
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {ethers} = hre;
const [deployer] = await ethers.getSigners();

// Get info from .env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, aragonPluginRepos} = hre;

const deployedContracts = await deployments.all();
const deployedContractAddresses = {};
const deployedContractAddresses: {[index: string]: string} = {};

for (const deployment in deployedContracts) {
// skip proxies because they are included twice
Expand Down
Loading