Skip to content

Commit

Permalink
chore(evm): print error message if contract already exists at predict…
Browse files Browse the repository at this point in the history
…ed proxy address (#354)
  • Loading branch information
jcs47 authored Aug 29, 2024
1 parent 7c5a6f4 commit 572ff80
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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

0 comments on commit 572ff80

Please sign in to comment.