Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions contracts/utils/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,28 @@ const sendProposal = async (proposalArgs, description, opts = {}) => {
log("Done");
};

/**
* Sanity checks to perform before running the deploy
*/
const sanityCheck = async () => {
if (isMainnet) {
const VaultProxy = await ethers.getContract("VaultProxy");
const VaultAdmin = await ethers.getContractAt(
"VaultAdmin",
VaultProxy.address
);

const vaultGovernor = await VaultAdmin.governor();
const { governorAddr } = await getNamedAccounts();

if (vaultGovernor.toLowerCase() !== governorAddr.toLowerCase()) {
throw new Error(
`Hardhat environment has ${governorAddr} governor address configured which is different from Vault's governor: ${vaultGovernor}`
);
}
}
};

/**
* Shortcut to create a deployment for hardhat to use
* @param {Object} options for deployment
Expand Down Expand Up @@ -290,6 +312,7 @@ function deploymentWithProposal(opts, fn) {
}
}

await sanityCheck();
const proposal = await fn(tools);
const propDescription = proposal.name;
const propArgs = await proposeArgs(proposal.actions);
Expand Down