Skip to content

Commit

Permalink
🔨 deploy: grant emergency admin role to pauser
Browse files Browse the repository at this point in the history
  • Loading branch information
cruzdanilo committed Jul 11, 2024
1 parent 2732d80 commit 6695431
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
9 changes: 6 additions & 3 deletions deploy/Markets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ const func: DeployFunction = async ({
live,
},
ethers: { ZeroAddress, parseUnits, getContractOrNull, getContract, getSigner },
deployments: { deploy, get },
deployments: { deploy, get, getOrNull },
getNamedAccounts,
}) => {
const [rewards, debtManager, auditor, { address: timelock }, { deployer, multisig, treasury = ZeroAddress }] =
const [rewards, debtManager, auditor, pauser, { address: timelock }, { deployer, multisig, treasury = ZeroAddress }] =
await Promise.all([
getContractOrNull<RewardsController>("RewardsController"),
getContractOrNull<DebtManager>("DebtManager"),
getContract<Auditor>("Auditor"),
getOrNull("Pauser"),
get("TimelockController"),
getNamedAccounts(),
]);
Expand Down Expand Up @@ -183,6 +184,8 @@ const func: DeployFunction = async ({
await (await debtManager.approve(market.target)).wait();
}

if (pauser) await grantRole(market, await market.EMERGENCY_ADMIN_ROLE(), pauser.address);

await grantRole(market, await market.PAUSER_ROLE(), multisig);

await transferOwnership(market, deployer, timelock);
Expand Down Expand Up @@ -253,6 +256,6 @@ const func: DeployFunction = async ({
};

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

export default func;
23 changes: 23 additions & 0 deletions deploy/Pauser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { env } from "process";
import type { DeployFunction } from "hardhat-deploy/types";
import tenderlify from "./.utils/tenderlify";

const func: DeployFunction = async ({ deployments: { deploy, get }, getNamedAccounts }) => {
const [{ address: auditor }, { deployer, hypernative }] = await Promise.all([get("Auditor"), getNamedAccounts()]);

await tenderlify(
"Pauser",
await deploy("Pauser", {
args: [auditor, hypernative],
skipIfAlreadyDeployed: !JSON.parse(env[`DEPLOY_PAUSER`] ?? "false"),
from: deployer,
log: true,
}),
);
};

func.tags = ["Pauser"];
func.dependencies = ["Auditor"];
func.skip = async ({ getNamedAccounts }) => !(await getNamedAccounts()).hypernative;

export default func;
3 changes: 3 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ const hardhatConfig: Config = {
default: 0,
"op-sepolia": "0xDb90CDB64CfF03f254e4015C4F705C3F3C834400",
},
hypernative: {
optimism: "0xEa2127b14D05229CB3d4b75b42052e556AB7391F",
},
},
finance: {
treasuryFeeRate: 0.2,
Expand Down

0 comments on commit 6695431

Please sign in to comment.