Skip to content

Commit

Permalink
Fix hardhat import
Browse files Browse the repository at this point in the history
  • Loading branch information
vrde committed Dec 5, 2023
1 parent 62c5c49 commit ff4f1a7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
26 changes: 17 additions & 9 deletions lib/sequence/post.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
import { upgrades } from "hardhat";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { IProxyAdmin } from "../../typechain";
import { Sequence, SetupContext } from "../internal/types";
import { Sequence } from "../internal/types";
import { ROLES } from "../utils";
import { SetupContext } from "./setup";

async function transferOwnership(address: string) {
const proxy = (await upgrades.admin.getInstance()) as IProxyAdmin;
async function transferOwnership(
hre: HardhatRuntimeEnvironment,
address: string
) {
const proxy = (await hre.upgrades.admin.getInstance()) as IProxyAdmin;
return proxy.transferOwnership(address);
}

export function finalizeACL(multisig: string): Sequence<SetupContext> {
export function finalizeACL(
hre: HardhatRuntimeEnvironment
): Sequence<SetupContext> {
return [
(c) => c.daoRoles.grantRole(ROLES.DEFAULT_ADMIN_ROLE, multisig),
(c) => c.daoRoles.grantRole(ROLES.OPERATOR_ROLE, multisig),
(c) => c.daoRoles.grantRole(ROLES.RESOLUTION_ROLE, multisig),
(c) => transferOwnership(multisig),
(c) =>
c.daoRoles.grantRole(ROLES.DEFAULT_ADMIN_ROLE, c.config.multisigAddress),
(c) => c.daoRoles.grantRole(ROLES.OPERATOR_ROLE, c.config.multisigAddress),
(c) =>
c.daoRoles.grantRole(ROLES.RESOLUTION_ROLE, c.config.multisigAddress),
(c) => transferOwnership(hre, c.config.multisigAddress),
(c) => c.daoRoles.revokeRole(ROLES.RESOLUTION_ROLE, c.deployer.address),
(c) => c.daoRoles.revokeRole(ROLES.OPERATOR_ROLE, c.deployer.address),
(c) => c.daoRoles.revokeRole(ROLES.DEFAULT_ADMIN_ROLE, c.deployer.address),
Expand Down
23 changes: 9 additions & 14 deletions tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ import {
SETUP_SEQUENCE,
generateDeployContext,
} from "../lib";
import { DAOConfig, generateSetupContext } from "../lib/internal/types";
import { DAOConfig } from "../lib/internal/types";
import { SETUP_MOCK_SEQUENCE } from "../lib/sequence/deploy";
import { finalizeACL } from "../lib/sequence/post";
import { SETUP_SEQUENCE_TESTNET } from "../lib/sequence/setup";
import {
SETUP_SEQUENCE_TESTNET,
generateSetupContext,
} from "../lib/sequence/setup";
import { question } from "../lib/utils";

task("deploy:mocks", "Deploy DAO Mocks")
Expand Down Expand Up @@ -85,11 +88,7 @@ task("setup:dao", "Set up the DAO")
const neokingdom = await NeokingdomDAOHardhat.initialize(hre, {
verbose: true,
});
await neokingdom.run(
generateSetupContext(config.contributors, hre),
sequence,
"setup"
);
await neokingdom.run(generateSetupContext(config), sequence, "setup");
});

task("setup:test", "Set up the test data for the DAO")
Expand All @@ -100,11 +99,7 @@ task("setup:test", "Set up the test data for the DAO")
const neokingdom = await NeokingdomDAOHardhat.initialize(hre, {
verbose: true,
});
await neokingdom.run(
generateSetupContext(config.contributors, hre),
sequence,
"setup-test"
);
await neokingdom.run(generateSetupContext(config), sequence, "setup-test");
});

task("setup:acl", "Set up ACL")
Expand All @@ -126,11 +121,11 @@ task("setup:acl", "Set up ACL")
process.exit(0);
}

let sequence = finalizeACL(multisig);
let sequence = finalizeACL(hre);

const neokingdom = await NeokingdomDAOHardhat.initialize(hre, {
verbose: true,
});

await neokingdom.run(generateSetupContext([], hre), sequence, "setup-acl");
await neokingdom.run(generateSetupContext(config), sequence, "setup-acl");
});

0 comments on commit ff4f1a7

Please sign in to comment.