From 1f420a7e8a2762bee3937972b00dc54fe7832c60 Mon Sep 17 00:00:00 2001 From: Kyryl Riabov Date: Tue, 18 Jun 2024 19:19:28 +0300 Subject: [PATCH 1/5] Updated deps --- CHANGELOG.md | 4 ++++ package-lock.json | 8 ++++---- package.json | 8 ++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3be5af2..cbf1831 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Version 2.1.9 + +* Updated dependencies + ## Version 2.1.8 * Fixed a bug where remote chain metadata overwrote the local one. diff --git a/package-lock.json b/package-lock.json index 45fc79a..5ee4a03 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ ], "dependencies": { "@nomicfoundation/hardhat-ethers": "3.0.5", - "@nomicfoundation/hardhat-verify": "2.0.4", + "@nomicfoundation/hardhat-verify": "2.0.7", "@nomiclabs/hardhat-truffle5": "2.0.7", "axios": "1.6.7", "ethers": "6.11.1", @@ -2294,9 +2294,9 @@ } }, "node_modules/@nomicfoundation/hardhat-verify": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.4.tgz", - "integrity": "sha512-B8ZjhOrmbbRWqJi65jvQblzjsfYktjqj2vmOm+oc2Vu8drZbT2cjeSCRHZKbS7lOtfW78aJZSFvw+zRLCiABJA==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.7.tgz", + "integrity": "sha512-jiYHBX+K6bBN0YhwFHQ5SWWc3dQZliM3pdgpH33C7tnsVACsX1ubZn6gZ9hfwlzG0tyjFM72XQhpaXQ56cE6Ew==", "dependencies": { "@ethersproject/abi": "^5.1.2", "@ethersproject/address": "^5.0.2", diff --git a/package.json b/package.json index e9972a2..493c5db 100644 --- a/package.json +++ b/package.json @@ -51,11 +51,11 @@ ] }, "dependencies": { - "@nomicfoundation/hardhat-ethers": "3.0.5", - "@nomicfoundation/hardhat-verify": "2.0.4", + "@nomicfoundation/hardhat-ethers": "3.0.6", + "@nomicfoundation/hardhat-verify": "2.0.8", "@nomiclabs/hardhat-truffle5": "2.0.7", - "axios": "1.6.7", - "ethers": "6.11.1", + "axios": "1.7.2", + "ethers": "6.13.1", "ora": "5.4.1" }, "peerDependencies": { From bb3f54c8f61d208cbedec0e87fde61b93c1d810a Mon Sep 17 00:00:00 2001 From: Kyryl Riabov Date: Tue, 18 Jun 2024 19:19:46 +0300 Subject: [PATCH 2/5] Fixed a bug when the cache was not saved if the `cache` directory did not exist --- CHANGELOG.md | 1 + src/tools/storage/MigrateStorage.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbf1831..95dcc7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Version 2.1.9 * Updated dependencies +* Fixed a bug when the cache was not saved if the `cache` directory did not exist ## Version 2.1.8 diff --git a/src/tools/storage/MigrateStorage.ts b/src/tools/storage/MigrateStorage.ts index 3a1ef85..de9e454 100644 --- a/src/tools/storage/MigrateStorage.ts +++ b/src/tools/storage/MigrateStorage.ts @@ -1,4 +1,4 @@ -import { existsSync, readFileSync, writeFileSync, rmSync } from "fs"; +import { existsSync, readFileSync, writeFileSync, rmSync, mkdirSync } from "fs"; import { lazyObject } from "hardhat/plugins"; @@ -10,12 +10,17 @@ import { StorageNamespaces } from "../../types/tools"; @catchError class BaseStorage { + private readonly _directory = "cache"; private readonly _fileName = ".migrate.storage.json"; protected _state: Record; constructor(private _namespace: string = StorageNamespaces.Storage) { this._state = this.readFullStateFromFile()[this._namespace] || {}; + + if (!existsSync(this.filePath())) { + this._saveStateToFile(); + } } public deleteStateFile(): void { @@ -49,6 +54,10 @@ class BaseStorage { fileSate[this._namespace] = this._state; + if (!existsSync(this._directory)) { + mkdirSync(this._directory, { recursive: true }); + } + writeFileSync(this.filePath(), toJSON(fileSate), { flag: "w", encoding: "utf8", From 242900e71796f9637c105d0c7b5071dce34a3561 Mon Sep 17 00:00:00 2001 From: Kyryl Riabov Date: Tue, 18 Jun 2024 19:21:21 +0300 Subject: [PATCH 3/5] Exported `TransactionStorage`, `VerificationStorage`, and `ArtifactStorage` for convenience --- CHANGELOG.md | 1 + src/index.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95dcc7c..7c8c5bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Updated dependencies * Fixed a bug when the cache was not saved if the `cache` directory did not exist +* Exported `TransactionStorage`, `VerificationStorage`, and `ArtifactStorage` for convenience ## Version 2.1.8 diff --git a/src/index.ts b/src/index.ts index cc5eac6..dec8e5e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,8 +18,8 @@ import { Migrator } from "./migrator/Migrator"; import { Verifier } from "./verifier/Verifier"; export { Deployer } from "./deployer/Deployer"; -export { UserStorage } from "./tools/storage/MigrateStorage"; export { PublicReporter as Reporter } from "./tools/reporters/PublicReporter"; +export { UserStorage, TransactionStorage, VerificationStorage, ArtifactStorage } from "./tools/storage/MigrateStorage"; extendConfig(migrateConfigExtender); From 2887e51ee595970bbf30316e38310f2407301b64 Mon Sep 17 00:00:00 2001 From: Kyryl Riabov Date: Tue, 18 Jun 2024 19:23:09 +0300 Subject: [PATCH 4/5] Updated versions --- package-lock.json | 50 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5ee4a03..6f2906f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,11 +12,11 @@ "test/fixture-projects/*" ], "dependencies": { - "@nomicfoundation/hardhat-ethers": "3.0.5", - "@nomicfoundation/hardhat-verify": "2.0.7", + "@nomicfoundation/hardhat-ethers": "3.0.6", + "@nomicfoundation/hardhat-verify": "2.0.8", "@nomiclabs/hardhat-truffle5": "2.0.7", - "axios": "1.6.7", - "ethers": "6.11.1", + "axios": "1.7.2", + "ethers": "6.13.1", "ora": "5.4.1" }, "devDependencies": { @@ -2281,9 +2281,9 @@ } }, "node_modules/@nomicfoundation/hardhat-ethers": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.5.tgz", - "integrity": "sha512-RNFe8OtbZK6Ila9kIlHp0+S80/0Bu/3p41HUpaRIoHLm6X3WekTd83vob3rE54Duufu1edCiBDxspBzi2rxHHw==", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.6.tgz", + "integrity": "sha512-/xzkFQAaHQhmIAYOQmvHBPwL+NkwLzT9gRZBsgWUYeV+E6pzXsBQsHfRYbAZ3XEYare+T7S+5Tg/1KDJgepSkA==", "dependencies": { "debug": "^4.1.1", "lodash.isequal": "^4.5.0" @@ -2294,9 +2294,9 @@ } }, "node_modules/@nomicfoundation/hardhat-verify": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.7.tgz", - "integrity": "sha512-jiYHBX+K6bBN0YhwFHQ5SWWc3dQZliM3pdgpH33C7tnsVACsX1ubZn6gZ9hfwlzG0tyjFM72XQhpaXQ56cE6Ew==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.8.tgz", + "integrity": "sha512-x/OYya7A2Kcz+3W/J78dyDHxr0ezU23DKTrRKfy5wDPCnePqnr79vm8EXqX3gYps6IjPBYyGPZ9K6E5BnrWx5Q==", "dependencies": { "@ethersproject/abi": "^5.1.2", "@ethersproject/address": "^5.0.2", @@ -6752,11 +6752,11 @@ "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==" }, "node_modules/axios": { - "version": "1.6.7", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.7.tgz", - "integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==", + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", + "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", "dependencies": { - "follow-redirects": "^1.15.4", + "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -9498,9 +9498,9 @@ } }, "node_modules/ethers": { - "version": "6.11.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.11.1.tgz", - "integrity": "sha512-mxTAE6wqJQAbp5QAe/+o+rXOID7Nw91OZXvgpjDa1r4fAbq2Nu314oEZSbjoRLacuCzs7kUC3clEvkCQowffGg==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.1.tgz", + "integrity": "sha512-hdJ2HOxg/xx97Lm9HdCWk949BfYqYWpyw4//78SiwOLgASyfrNszfMUNB2joKjvGUdwhHfaiMMFFwacVVoLR9A==", "funding": [ { "type": "individual", @@ -9518,7 +9518,7 @@ "@types/node": "18.15.13", "aes-js": "4.0.0-beta.5", "tslib": "2.4.0", - "ws": "8.5.0" + "ws": "8.17.1" }, "engines": { "node": ">=14.0.0" @@ -9891,9 +9891,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.5", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", - "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "funding": [ { "type": "individual", @@ -22056,15 +22056,15 @@ "peer": true }, "node_modules/ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "utf-8-validate": ">=5.0.2" }, "peerDependenciesMeta": { "bufferutil": { diff --git a/package.json b/package.json index 493c5db..830f4a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@solarity/hardhat-migrate", - "version": "2.1.8", + "version": "2.1.9", "description": "Automatic deployment and verification of smart contracts", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", From f9e4adcffd1d5aedcd26625a3328eda8e61aa1e3 Mon Sep 17 00:00:00 2001 From: Kyryl Riabov Date: Tue, 18 Jun 2024 19:23:21 +0300 Subject: [PATCH 5/5] Fixed tests --- test/integration/deployer/base-contract-interaction.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/deployer/base-contract-interaction.ts b/test/integration/deployer/base-contract-interaction.ts index 27f5963..ca313a9 100644 --- a/test/integration/deployer/base-contract-interaction.ts +++ b/test/integration/deployer/base-contract-interaction.ts @@ -53,7 +53,7 @@ describe("deployer", () => { const signer = (await deployer.getSigner()) as any; await expect(deployer.deploy(ConstructorWithArguments__factory, [signer], {})).to.be.rejectedWith( - `Deployer.deploy(): MinimalContract.deploy(): MinimalContract._createDeployTransaction(): invalid BigNumberish value (argument="value", value="", code=INVALID_ARGUMENT, version=6.11.1)`, + `Deployer.deploy(): MinimalContract.deploy(): MinimalContract._createDeployTransaction(): invalid BigNumberish value (argument="value", value="", code=INVALID_ARGUMENT, version=6.13.1)`, ); });