Skip to content

Commit

Permalink
🔨 deploy: merge governance scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
cruzdanilo committed Jul 26, 2023
1 parent f940754 commit 1189ce5
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 36 deletions.
2 changes: 1 addition & 1 deletion deploy/Auditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ const func: DeployFunction = async ({
};

func.tags = ["Auditor"];
func.dependencies = ["ProxyAdmin", "TimelockController"];
func.dependencies = ["Governance"];

export default func;
2 changes: 1 addition & 1 deletion deploy/DebtManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ const func: DeployFunction = async ({ deployments: { deploy, get }, getNamedAcco
};

func.tags = ["DebtManager"];
func.dependencies = ["TimelockController", "Auditor", "Markets", "UniswapV3", "Balancer", "Permit2"];
func.dependencies = ["Governance", "Auditor", "Markets", "UniswapV3", "Balancer", "Permit2"];

export default func;
2 changes: 1 addition & 1 deletion deploy/EXA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const func: DeployFunction = async ({
};

func.tags = ["EXA"];
func.dependencies = ["Sablier"];
func.dependencies = ["Governance", "Sablier"];
func.skip = async ({ network }) => !["optimism", "goerli"].includes(network.name) && network.live;

export default func;
15 changes: 13 additions & 2 deletions deploy/TimelockController.ts → deploy/Governance.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { DeployFunction } from "hardhat-deploy/types";
import { TimelockController } from "../types";
import type { ProxyAdmin, TimelockController } from "../types";
import timelockPropose from "./.utils/timelockPropose";
import tenderlify from "./.utils/tenderlify";

Expand All @@ -16,6 +16,7 @@ const func: DeployFunction = async ({
getNamedAccounts,
}) => {
const { deployer, multisig } = await getNamedAccounts();

await tenderlify(
"TimelockController",
await deploy("TimelockController", {
Expand All @@ -26,12 +27,22 @@ const func: DeployFunction = async ({
}),
);

await tenderlify(
"ProxyAdmin",
await deploy("ProxyAdmin", { skipIfAlreadyDeployed: true, from: deployer, log: true }),
);

const timelock = await getContract<TimelockController>("TimelockController", await getSigner(deployer));
if (!(await timelock.getMinDelay()).eq(timelockDelay)) {
await timelockPropose(timelock, "updateDelay", [timelockDelay]);
}

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

func.tags = ["TimelockController"];
func.tags = ["Governance"];

export default func;
2 changes: 1 addition & 1 deletion deploy/Markets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,6 @@ const func: DeployFunction = async ({
};

func.tags = ["Markets"];
func.dependencies = ["Auditor", "ProxyAdmin", "TimelockController", "Assets", "PriceFeeds", "RewardsController"];
func.dependencies = ["Auditor", "Governance", "Assets", "PriceFeeds", "Rewards"];

export default func;
28 changes: 0 additions & 28 deletions deploy/ProxyAdmin.ts

This file was deleted.

4 changes: 2 additions & 2 deletions deploy/RewardsController.ts → deploy/Rewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const func: DeployFunction = async ({ deployments: { deploy, get }, getNamedAcco
);
};

func.tags = ["RewardsController"];
func.dependencies = ["ProxyAdmin", "TimelockController"];
func.tags = ["Rewards"];
func.dependencies = ["Governance"];
func.skip = async ({ network }) =>
!Object.values(network.config.finance.markets).some(({ rewards }) => Boolean(rewards));

Expand Down

0 comments on commit 1189ce5

Please sign in to comment.