diff --git a/proxy/migrations/generateManifest.ts b/proxy/migrations/generateManifest.ts index 095090b0a..08cd6f346 100644 --- a/proxy/migrations/generateManifest.ts +++ b/proxy/migrations/generateManifest.ts @@ -1,5 +1,6 @@ import { ethers } from "hardhat"; import { contracts, getContractKeyInAbiFile } from "./deploySchain"; +import { networkNames } from "@openzeppelin/upgrades-core"; import { promises as fs } from "fs"; import { getVersion, @@ -134,14 +135,15 @@ export async function importAddresses(manifest: ManifestData, abi: {[ key in str export async function manifestSetup(pathToManifest: string) { const chainId = (await ethers.provider.getNetwork()).chainId; - const correctManifestPath = `.openzeppelin/unknown-${chainId}.json`; + const manifestName = networkNames[chainId] ?? `unknown-${chainId}`; + const correctManifestPath = `.openzeppelin/${manifestName}.json`; if (pathToManifest === "" || pathToManifest === correctManifestPath) { - fs.access(correctManifestPath); + await fs.access(correctManifestPath); console.log("Current Manifest file detected - will use this one"); return; } try { - fs.access(correctManifestPath); + await fs.access(correctManifestPath); console.log("Current Manifest file detected - will remove it"); try { await fs.unlink(correctManifestPath); @@ -154,7 +156,7 @@ export async function manifestSetup(pathToManifest: string) { console.log("No current Manifest file detected"); } try { - fs.access( pathToManifest ); + await fs.access( pathToManifest ); console.log("New Manifest file detected"); try { await fs.copyFile( pathToManifest, correctManifestPath ); diff --git a/proxy/migrations/upgradeMainnet.ts b/proxy/migrations/upgradeMainnet.ts index 30819c9b1..7797df38d 100644 --- a/proxy/migrations/upgradeMainnet.ts +++ b/proxy/migrations/upgradeMainnet.ts @@ -4,7 +4,6 @@ import { promises as fs } from "fs"; import { AutoSubmitter, Upgrader } from "@skalenetwork/upgrade-tools"; import { SkaleABIFile } from "@skalenetwork/upgrade-tools/dist/src/types/SkaleABIFile"; import { contracts } from "./deployMainnet"; -import { manifestSetup } from "./generateManifest"; import { MessageProxyForMainnet } from "../typechain"; class ImaMainnetUpgrader extends Upgrader { @@ -65,8 +64,6 @@ async function getImaMainnetAbiAndAddress(): Promise { } async function main() { - const pathToManifest: string = process.env.MANIFEST || ""; - await manifestSetup(pathToManifest); const upgrader = new ImaMainnetUpgrader( "1.5.0", await getImaMainnetAbiAndAddress(),