Made all requested changes

pull/5370/head
Praise Disu 2 years ago
parent a06018d677
commit 9794a66c48
  1. 25
      apps/remix-ide/src/blockchain/blockchain.js

@ -185,28 +185,26 @@ export class Blockchain extends Plugin {
const deployments = await this.call('fileManager', 'readFile', `.deploys/upgradeable-contracts/${networkInfo.name}/UUPS.json`) const deployments = await this.call('fileManager', 'readFile', `.deploys/upgradeable-contracts/${networkInfo.name}/UUPS.json`)
const parsedDeployments = JSON.parse(deployments) const parsedDeployments = JSON.parse(deployments)
parsedDeployments.deployments[address] = { parsedDeployments.deployments[address] = [{
date: new Date().toISOString(), date: new Date().toISOString(),
contractName: contractName, contractName: contractName,
fork: networkInfo.currentFork, fork: networkInfo.currentFork,
proxyAddress: address,
implementationAddress: implementationAddress, implementationAddress: implementationAddress,
layout: implementationContractObject.contract.object.storageLayout layout: implementationContractObject.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/${networkInfo.name}/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/${networkInfo.name}/UUPS.json`, JSON.stringify({
id: networkInfo.id, id: networkInfo.id,
network: networkInfo.name, network: networkInfo.name,
deployments: { deployments: {
[address]: { [address]: [{
date: new Date().toISOString(), date: new Date().toISOString(),
contractName: contractName, contractName: contractName,
fork: networkInfo.currentFork, fork: networkInfo.currentFork,
proxyAddress: address,
implementationAddress: implementationAddress, implementationAddress: implementationAddress,
layout: implementationContractObject.contract.object.storageLayout layout: implementationContractObject.contract.object.storageLayout
} }]
} }
}, null, 2)) }, null, 2))
} }
@ -262,26 +260,27 @@ export class Blockchain extends Plugin {
const deployments = await this.call('fileManager', 'readFile', `.deploys/upgradeable-contracts/${networkInfo.name}/UUPS.json`) const deployments = await this.call('fileManager', 'readFile', `.deploys/upgradeable-contracts/${networkInfo.name}/UUPS.json`)
const parsedDeployments = JSON.parse(deployments) const parsedDeployments = JSON.parse(deployments)
parsedDeployments.deployments[proxyAddress] = { if (!parsedDeployments.deployments[proxyAddress]) parsedDeployments.deployments[proxyAddress] = []
lastUpdated: new Date().toISOString(), parsedDeployments.deployments[proxyAddress].push({
...parsedDeployments.deployments[proxyAddress], date: new Date().toISOString(),
contractName: contractName,
fork: networkInfo.currentFork,
implementationAddress: implementationAddress, implementationAddress: implementationAddress,
layout: newImplementationContractObject.contract.object.storageLayout layout: newImplementationContractObject.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/${networkInfo.name}/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/${networkInfo.name}/UUPS.json`, JSON.stringify({
id: networkInfo.id, id: networkInfo.id,
network: networkInfo.name, network: networkInfo.name,
deployments: { deployments: {
[proxyAddress]: { [address]: [{
date: new Date().toISOString(), date: new Date().toISOString(),
contractName: contractName, contractName: contractName,
fork: networkInfo.currentFork, fork: networkInfo.currentFork,
proxyAddress,
implementationAddress: implementationAddress, implementationAddress: implementationAddress,
layout: newImplementationContractObject.contract.object.storageLayout layout: newImplementationContractObject.contract.object.storageLayout
} }]
} }
}, null, 2)) }, null, 2))
} }

Loading…
Cancel
Save