Skip to content

Commit aa4e07f

Browse files
authored
add configured governor sanity check before kicking off the mainnet deploy (#1211)
1 parent a73f157 commit aa4e07f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

contracts/utils/deploy.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,28 @@ const sendProposal = async (proposalArgs, description, opts = {}) => {
251251
log("Done");
252252
};
253253

254+
/**
255+
* Sanity checks to perform before running the deploy
256+
*/
257+
const sanityCheck = async () => {
258+
if (isMainnet) {
259+
const VaultProxy = await ethers.getContract("VaultProxy");
260+
const VaultAdmin = await ethers.getContractAt(
261+
"VaultAdmin",
262+
VaultProxy.address
263+
);
264+
265+
const vaultGovernor = await VaultAdmin.governor();
266+
const { governorAddr } = await getNamedAccounts();
267+
268+
if (vaultGovernor.toLowerCase() !== governorAddr.toLowerCase()) {
269+
throw new Error(
270+
`Hardhat environment has ${governorAddr} governor address configured which is different from Vault's governor: ${vaultGovernor}`
271+
);
272+
}
273+
}
274+
};
275+
254276
/**
255277
* Shortcut to create a deployment for hardhat to use
256278
* @param {Object} options for deployment
@@ -290,6 +312,7 @@ function deploymentWithProposal(opts, fn) {
290312
}
291313
}
292314

315+
await sanityCheck();
293316
const proposal = await fn(tools);
294317
const propDescription = proposal.name;
295318
const propArgs = await proposeArgs(proposal.actions);

0 commit comments

Comments
 (0)