From 9956f32a674dc00abb316ef55ba25567ba3c51a9 Mon Sep 17 00:00:00 2001 From: danilo neves cruz Date: Tue, 26 Sep 2023 17:37:20 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20deploy:=20revoke=20timelock=20ca?= =?UTF-8?q?nceller=20role=20from=20deployer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/.utils/grantRole.ts | 3 ++- deploy/.utils/revokeRole.ts | 3 ++- deploy/Governance.ts | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/deploy/.utils/grantRole.ts b/deploy/.utils/grantRole.ts index e0a0d6e80..b0fa418f7 100644 --- a/deploy/.utils/grantRole.ts +++ b/deploy/.utils/grantRole.ts @@ -1,5 +1,6 @@ import { deployments } from "hardhat"; import type { IAccessControl } from "../../types"; +import executeOrPropose from "./executeOrPropose"; import format from "./format"; const { log } = deployments; @@ -7,6 +8,6 @@ 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]); } }; diff --git a/deploy/.utils/revokeRole.ts b/deploy/.utils/revokeRole.ts index 958d7a45d..673cb56a7 100644 --- a/deploy/.utils/revokeRole.ts +++ b/deploy/.utils/revokeRole.ts @@ -1,5 +1,6 @@ import { deployments } from "hardhat"; import type { IAccessControl } from "../../types"; +import executeOrPropose from "./executeOrPropose"; import format from "./format"; const { log } = deployments; @@ -7,6 +8,6 @@ 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]); } }; diff --git a/deploy/Governance.ts b/deploy/Governance.ts index 508c92e3b..af6afeed0 100644 --- a/deploy/Governance.ts +++ b/deploy/Governance.ts @@ -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 ({ @@ -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", await getSigner(deployer)); if ((await proxyAdmin.owner()).toLowerCase() !== timelock.address.toLowerCase()) {