Modify append id to custom name

pull/5370/head
ioedeveloper 2 years ago committed by Aniket
parent 530d418f6e
commit 0f663d2006
  1. 9
      apps/remix-ide/src/blockchain/blockchain.js

@ -237,10 +237,11 @@ export class Blockchain extends Plugin {
async saveDeployedContractStorageLayout (contractObject, proxyAddress, networkInfo) { async saveDeployedContractStorageLayout (contractObject, proxyAddress, networkInfo) {
const { contractName, implementationAddress, contract } = contractObject 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. // TODO: make deploys folder read only.
if (hasPreviousDeploys) { 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) const parsedDeployments = JSON.parse(deployments)
parsedDeployments.deployments[proxyAddress] = { parsedDeployments.deployments[proxyAddress] = {
@ -250,9 +251,9 @@ export class Blockchain extends Plugin {
implementationAddress: implementationAddress, implementationAddress: implementationAddress,
layout: contract.object.storageLayout 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 { } 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, id: networkInfo.id,
network: networkInfo.name, network: networkInfo.name,
deployments: { deployments: {

Loading…
Cancel
Save