Skip to content

Commit

Permalink
feat: provide contract artifact in deploy method
Browse files Browse the repository at this point in the history
  • Loading branch information
heueristik committed May 24, 2023
1 parent 43a5f39 commit 88931d6
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DAO__factory, ENSRegistry__factory} from '../../../typechain';
import {getContractAddress, getENSAddress} from '../../helpers';

import ensSubdomainRegistrarArtifact from '../../../artifacts/src/framework/utils/ens/ENSSubdomainRegistrar.sol/ENSSubdomainRegistrar.json';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, ethers, network} = hre;
const {deploy} = deployments;
Expand All @@ -27,7 +29,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
}

await deploy('DAO_ENSSubdomainRegistrar', {
contract: 'ENSSubdomainRegistrar',
contract: ensSubdomainRegistrarArtifact,
from: deployer.address,
args: [],
log: true,
Expand All @@ -51,7 +53,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
);

await deploy('Plugin_ENSSubdomainRegistrar', {
contract: 'ENSSubdomainRegistrar',
contract: ensSubdomainRegistrarArtifact,
from: deployer.address,
args: [],
log: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

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

import daoRegistryArtifact from '../../../artifacts/src/framework/dao/DAORegistry.sol/DAORegistry.json';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, ethers} = hre;
const {deploy} = deployments;
Expand All @@ -18,6 +19,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
);

await deploy('DAORegistry', {
contract: daoRegistryArtifact,
from: deployer.address,
args: [],
log: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {DeployFunction} from 'hardhat-deploy/types';

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

import pluginRepoRegistryArtifact from '../../../artifacts/src/framework/plugin/repo/PluginRepoRegistry.sol/PluginRepoRegistry.json';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, ethers} = hre;
const {deploy} = deployments;
Expand All @@ -18,6 +20,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
);

await deploy('PluginRepoRegistry', {
contract: pluginRepoRegistryArtifact,
from: deployer.address,
args: [],
log: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

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

import pluginRepoFactoryArtifact from '../../../artifacts/src/framework/plugin/repo/PluginRepoFactory.sol/PluginRepoFactory.json';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, ethers} = hre;
const {deploy} = deployments;
Expand All @@ -15,6 +16,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
);

await deploy('PluginRepoFactory', {
contract: pluginRepoFactoryArtifact,
from: deployer.address,
args: [pluginRepoRegistryAddress],
log: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

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

import pluginSetupProcessorFactoryArtifact from '../../../artifacts/src/framework/plugin/setup/PluginSetupProcessor.sol/PluginSetupProcessor.json';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, ethers} = hre;
const {deploy} = deployments;
Expand All @@ -15,6 +16,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
);

await deploy('PluginSetupProcessor', {
contract: pluginSetupProcessorFactoryArtifact,
from: deployer.address,
args: [pluginRepoRegistryAddress],
log: true,
Expand Down
4 changes: 3 additions & 1 deletion packages/contracts/deploy/new/10_framework/50_dao-factory.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

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

import daoFactoryArtifact from '../../../artifacts/src/framework/dao/DAOFactory.sol/DAOFactory.json';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, ethers} = hre;
const {deploy} = deployments;
Expand All @@ -18,6 +19,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
);

await deploy('DAOFactory', {
contract: daoFactoryArtifact,
from: deployer.address,
args: [daoRegistryAddress, pluginSetupProcessorAddress],
log: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

import addresslistVotingSetupArtifact from '../../../../artifacts/src/plugins/governance/majority-voting/addresslist/AddresslistVotingSetup.sol/AddresslistVotingSetup.json';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`\nDeploying plugins.`);

Expand All @@ -9,6 +11,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const [deployer] = await ethers.getSigners();

await deploy('AddresslistVotingSetup', {
contract: addresslistVotingSetupArtifact,
from: deployer.address,
args: [],
log: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

import tokenVotingSetupArtifact from '../../../../artifacts/src/plugins/governance/majority-voting/token/TokenVotingSetup.sol/TokenVotingSetup.json';

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

await deploy('TokenVotingSetup', {
contract: tokenVotingSetupArtifact,
from: deployer.address,
args: [],
log: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

import adminSetupArtifact from '../../../../artifacts/src/plugins/governance/admin/AdminSetup.sol/AdminSetup.json';

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

await deploy('AdminSetup', {
contract: adminSetupArtifact,
from: deployer.address,
args: [],
log: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

import multisigSetupArtifact from '../../../../artifacts/src/plugins/governance/multisig/MultisigSetup.sol/MultisigSetup.json';

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

await deploy('MultisigSetup', {
contract: multisigSetupArtifact,
from: deployer.address,
args: [],
log: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';
import {uploadToIPFS} from '../../../helpers';

import placeholderSetupArtifact from '../../../../artifacts/src/plugins/placeholder-version/PlaceholderSetup.sol/PlaceholderSetup.json';
import placeholderBuildMetadata from '../../../../src/plugins/placeholder-version/build-metadata.json';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
Expand All @@ -10,6 +11,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const [deployer] = await ethers.getSigners();

await deploy('PlaceholderSetup', {
contract: placeholderSetupArtifact,
from: deployer.address,
args: [],
log: true,
Expand Down
5 changes: 5 additions & 0 deletions packages/contracts/utils/ens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import {ethers} from 'hardhat';
import {ENSRegistry__factory} from '../typechain';
import {EHRE} from './types';

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';

export function ensLabelHash(label: string): string {
return ethers.utils.id(label);
}
Expand All @@ -17,6 +20,7 @@ export async function setupENS(domains: string[], hre: EHRE): Promise<any> {

// Deploy the ENSRegistry
await deploy('ENSRegistry', {
contract: ensRegistryArtifact,
from: deployer.address,
args: [],
log: true,
Expand All @@ -27,6 +31,7 @@ export async function setupENS(domains: string[], hre: EHRE): Promise<any> {

// Deploy the Resolver
await deploy('PublicResolver', {
contract: publicResolverArtifact,
from: deployer.address,
args: [ensDeployment.address, ethers.constants.AddressZero],
});
Expand Down

0 comments on commit 88931d6

Please sign in to comment.