diff --git a/deploy/Markets.ts b/deploy/Markets.ts index 606480c1..2fc0e7bf 100644 --- a/deploy/Markets.ts +++ b/deploy/Markets.ts @@ -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"), getContractOrNull("DebtManager"), getContract("Auditor"), + getOrNull("Pauser"), get("TimelockController"), getNamedAccounts(), ]); @@ -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); @@ -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; diff --git a/deploy/Pauser.ts b/deploy/Pauser.ts new file mode 100644 index 00000000..3f7225b8 --- /dev/null +++ b/deploy/Pauser.ts @@ -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; diff --git a/hardhat.config.ts b/hardhat.config.ts index e3b7308e..9c4602fb 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -60,6 +60,9 @@ const hardhatConfig: Config = { default: 0, "op-sepolia": "0xDb90CDB64CfF03f254e4015C4F705C3F3C834400", }, + hypernative: { + optimism: "0xEa2127b14D05229CB3d4b75b42052e556AB7391F", + }, }, finance: { treasuryFeeRate: 0.2,