Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(evm): print error message if contract already exists at predicted proxy address #354

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions evm/deploy-amplifier-gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const {
getDeployedAddress,
getDeployOptions,
getDomainSeparator,
isContract,
} = require('./utils');
const { addEvmOptions } = require('./cli-utils');
const { storeSignedTx, signTransaction, getWallet } = require('./sign-utils.js');
Expand Down Expand Up @@ -128,6 +129,10 @@ async function deploy(config, chain, options) {
printWarn('This is NOT required if the deployments are done by different integrators');
}

if (await isContract(proxyAddress, wallet.provider)) {
printError(`Contract already deployed at predicted address "${proxyAddress}"!`);
}

if (predictOnly || prompt(`Does derived address match existing gateway deployments? Proceed with deployment on ${chain.name}?`, yes)) {
return;
}
Expand Down
4 changes: 4 additions & 0 deletions evm/deploy-gateway-v6.2.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ async function deploy(config, chain, options) {

printInfo('Is verification enabled?', verify ? 'y' : 'n');

if (await isContract(proxyAddress, wallet.provider)) {
printError(`Contract already deployed at predicted address "${proxyAddress}"!`);
}

if (predictOnly || prompt(`Does derived address match existing gateway deployments? Proceed with deployment on ${chain.name}?`, yes)) {
return;
}
Expand Down
Loading