|
|
|
@ -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: { |
|
|
|
|