From 0f663d20068260009e498dba8a96e10a6833f74d Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Wed, 18 Jan 2023 11:41:23 +0100 Subject: [PATCH] Modify append id to custom name --- apps/remix-ide/src/blockchain/blockchain.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide/src/blockchain/blockchain.js b/apps/remix-ide/src/blockchain/blockchain.js index 785d5f05d1..6399cff181 100644 --- a/apps/remix-ide/src/blockchain/blockchain.js +++ b/apps/remix-ide/src/blockchain/blockchain.js @@ -237,10 +237,11 @@ export class Blockchain extends Plugin { async saveDeployedContractStorageLayout (contractObject, proxyAddress, networkInfo) { const { contractName, implementationAddress, contract } = contractObject - const hasPreviousDeploys = await this.call('fileManager', 'exists', `.deploys/upgradeable-contracts/${networkInfo.name}/UUPS.json`) + const networkName = networkInfo.name === 'custom' ? networkInfo.name + '-' + networkInfo.id : networkInfo.name + const hasPreviousDeploys = await this.call('fileManager', 'exists', `.deploys/upgradeable-contracts/${networkName}/UUPS.json`) // TODO: make deploys folder read only. if (hasPreviousDeploys) { - const deployments = await this.call('fileManager', 'readFile', `.deploys/upgradeable-contracts/${networkInfo.name}/UUPS.json`) + const deployments = await this.call('fileManager', 'readFile', `.deploys/upgradeable-contracts/${networkName}/UUPS.json`) const parsedDeployments = JSON.parse(deployments) parsedDeployments.deployments[proxyAddress] = { @@ -250,9 +251,9 @@ export class Blockchain extends Plugin { implementationAddress: implementationAddress, layout: contract.object.storageLayout } - await this.call('fileManager', 'writeFile', `.deploys/upgradeable-contracts/${networkInfo.name}/UUPS.json`, JSON.stringify(parsedDeployments, null, 2)) + await this.call('fileManager', 'writeFile', `.deploys/upgradeable-contracts/${networkName}/UUPS.json`, JSON.stringify(parsedDeployments, null, 2)) } else { - await this.call('fileManager', 'writeFile', `.deploys/upgradeable-contracts/${networkInfo.name}/UUPS.json`, JSON.stringify({ + await this.call('fileManager', 'writeFile', `.deploys/upgradeable-contracts/${networkName}/UUPS.json`, JSON.stringify({ id: networkInfo.id, network: networkInfo.name, deployments: {