Skip to content

Commit

Permalink
🔨 deploy: revoke timelock canceller role from deployer
Browse files Browse the repository at this point in the history
  • Loading branch information
cruzdanilo committed Sep 26, 2023
1 parent 058c948 commit 9956f32
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion deploy/.utils/grantRole.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { deployments } from "hardhat";
import type { IAccessControl } from "../../types";
import executeOrPropose from "./executeOrPropose";
import format from "./format";

const { log } = deployments;

export default async (contract: IAccessControl, role: string, account: string) => {
if (!(await contract.hasRole(role, account))) {
log("granting role", `${await format(contract.address)}.${await format(role)}`, "to", await format(account));
await (await contract.grantRole(role, account)).wait();
await executeOrPropose(contract, "grantRole", [role, account]);
}
};
3 changes: 2 additions & 1 deletion deploy/.utils/revokeRole.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { deployments } from "hardhat";
import type { IAccessControl } from "../../types";
import executeOrPropose from "./executeOrPropose";
import format from "./format";

const { log } = deployments;

export default async (contract: IAccessControl, role: string, account: string) => {
if (await contract.hasRole(role, account)) {
log("revoking role", `${await format(contract.address)}.${await format(role)}`, "from", await format(account));
await (await contract.revokeRole(role, account)).wait();
await executeOrPropose(contract, "revokeRole", [role, account]);
}
};
2 changes: 2 additions & 0 deletions deploy/Governance.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { DeployFunction } from "hardhat-deploy/types";
import type { ProxyAdmin, TimelockController } from "../types";
import timelockPropose from "./.utils/timelockPropose";
import revokeRole from "./.utils/revokeRole";
import tenderlify from "./.utils/tenderlify";

const func: DeployFunction = async ({
Expand Down Expand Up @@ -36,6 +37,7 @@ const func: DeployFunction = async ({
if (!(await timelock.getMinDelay()).eq(timelockDelay)) {
await timelockPropose(timelock, "updateDelay", [timelockDelay]);
}
await revokeRole(timelock, await timelock.CANCELLER_ROLE(), deployer);

const proxyAdmin = await getContract<ProxyAdmin>("ProxyAdmin", await getSigner(deployer));
if ((await proxyAdmin.owner()).toLowerCase() !== timelock.address.toLowerCase()) {
Expand Down

0 comments on commit 9956f32

Please sign in to comment.