From b4abf418a69dd088825d03eb0e496ed5963755ef Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Mon, 13 Feb 2023 13:13:17 +0100 Subject: [PATCH] Remove compiler build if previous build exists --- apps/remix-ide/src/blockchain/blockchain.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide/src/blockchain/blockchain.js b/apps/remix-ide/src/blockchain/blockchain.js index 2c39c99b99..0ae235562e 100644 --- a/apps/remix-ide/src/blockchain/blockchain.js +++ b/apps/remix-ide/src/blockchain/blockchain.js @@ -194,7 +194,7 @@ export class Blockchain extends Plugin { id: 'confirmProxyDeployment', title: 'Confirm Update Proxy (ERC1967)', message: `Confirm you want to update your proxy contract with the new implementation contract's address: ${newImplAddress}.`, - modalType: 'modal', + modalType: 'modal', okLabel: 'OK', cancelLabel: 'Cancel', okFn: () => { @@ -242,10 +242,14 @@ export class Blockchain extends Plugin { if (hasPreviousDeploys) { const deployments = await this.call('fileManager', 'readFile', `.deploys/upgradeable-contracts/${networkName}/UUPS.json`) const parsedDeployments = JSON.parse(deployments) - const oldImplementationAddress = parsedDeployments.deployments[proxyAddress].implementationAddress - const hasPreviousBuild = await this.call('fileManager', 'exists', `.deploys/upgradeable-contracts/${networkName}/solc-${oldImplementationAddress}.json`) + const proxyDeployment = parsedDeployments.deployments[proxyAddress] + + if (proxyDeployment) { + const oldImplementationAddress = proxyDeployment.implementationAddress + const hasPreviousBuild = await this.call('fileManager', 'exists', `.deploys/upgradeable-contracts/${networkName}/solc-${oldImplementationAddress}.json`) - if (hasPreviousBuild) await this.call('fileManager', 'remove', `.deploys/upgradeable-contracts/${networkName}/solc-${oldImplementationAddress}.json`) + if (hasPreviousBuild) await this.call('fileManager', 'remove', `.deploys/upgradeable-contracts/${networkName}/solc-${oldImplementationAddress}.json`) + } parsedDeployments.deployments[proxyAddress] = { date: new Date().toISOString(), contractName: contractName,