From b8deedff2c59904177064ac40ceb1df305d473bd Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Mon, 23 Oct 2023 18:05:02 +0200 Subject: [PATCH 01/36] refactoring --- package-lock.json | 3835 ++++++++++++++++++++++-- src/deployer/Deployer.ts | 14 +- src/tools/reporters/Reporter.ts | 2 +- src/tools/reporters/TruffleReporter.ts | 8 +- src/tools/storage/ArtifactProcessor.ts | 6 +- 5 files changed, 3561 insertions(+), 304 deletions(-) diff --git a/package-lock.json b/package-lock.json index f237c36..19715ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9553,6 +9553,215 @@ "utf-8-validate": "5.0.7" } }, + "node_modules/ganache/node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "extraneous": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/ganache/node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "extraneous": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/ganache/node_modules/@discoveryjs/json-ext": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", + "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", + "extraneous": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ganache/node_modules/@jridgewell/gen-mapping": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", + "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", + "extraneous": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/ganache/node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "extraneous": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/ganache/node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "extraneous": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/ganache/node_modules/@jridgewell/source-map": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz", + "integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==", + "extraneous": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "node_modules/ganache/node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", + "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", + "extraneous": true, + "dependencies": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "node_modules/ganache/node_modules/@microsoft/api-extractor": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.20.1.tgz", + "integrity": "sha512-T7cqcK+JpvHGOj7cD2ZCCWS7Xgru1uOqZwrV/FSUdyKVs5fopZcbBSuetwD/akst3O7Ypryg3UOLP54S/vnVmA==", + "extraneous": true, + "dependencies": { + "@microsoft/api-extractor-model": "7.16.0", + "@microsoft/tsdoc": "0.13.2", + "@microsoft/tsdoc-config": "~0.15.2", + "@rushstack/node-core-library": "3.45.1", + "@rushstack/rig-package": "0.3.8", + "@rushstack/ts-command-line": "4.10.7", + "colors": "~1.2.1", + "lodash": "~4.17.15", + "resolve": "~1.17.0", + "semver": "~7.3.0", + "source-map": "~0.6.1", + "typescript": "~4.5.2" + }, + "bin": { + "api-extractor": "bin/api-extractor" + } + }, + "node_modules/ganache/node_modules/@microsoft/api-extractor-model": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.16.0.tgz", + "integrity": "sha512-0FOrbNIny8mzBrzQnSIkEjAXk0JMSnPmWYxt3ZDTPVg9S8xIPzB6lfgTg9+Mimu0RKCpGKBpd+v2WcR5vGzyUQ==", + "extraneous": true, + "dependencies": { + "@microsoft/tsdoc": "0.13.2", + "@microsoft/tsdoc-config": "~0.15.2", + "@rushstack/node-core-library": "3.45.1" + } + }, + "node_modules/ganache/node_modules/@microsoft/api-extractor/node_modules/typescript": { + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", + "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "extraneous": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/ganache/node_modules/@microsoft/tsdoc": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.13.2.tgz", + "integrity": "sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@microsoft/tsdoc-config": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.15.2.tgz", + "integrity": "sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA==", + "extraneous": true, + "dependencies": { + "@microsoft/tsdoc": "0.13.2", + "ajv": "~6.12.6", + "jju": "~1.4.0", + "resolve": "~1.19.0" + } + }, + "node_modules/ganache/node_modules/@microsoft/tsdoc-config/node_modules/resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "extraneous": true, + "dependencies": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + } + }, + "node_modules/ganache/node_modules/@rushstack/node-core-library": { + "version": "3.45.1", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.45.1.tgz", + "integrity": "sha512-BwdssTNe007DNjDBxJgInHg8ePytIPyT0La7ZZSQZF9+rSkT42AygXPGvbGsyFfEntjr4X37zZSJI7yGzL16cQ==", + "extraneous": true, + "dependencies": { + "@types/node": "12.20.24", + "colors": "~1.2.1", + "fs-extra": "~7.0.1", + "import-lazy": "~4.0.0", + "jju": "~1.4.0", + "resolve": "~1.17.0", + "semver": "~7.3.0", + "timsort": "~0.3.0", + "z-schema": "~5.0.2" + } + }, + "node_modules/ganache/node_modules/@rushstack/node-core-library/node_modules/@types/node": { + "version": "12.20.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.24.tgz", + "integrity": "sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@rushstack/rig-package": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.8.tgz", + "integrity": "sha512-MDWg1xovea99PWloSiYMjFcCLsrdjFtYt6aOyHNs5ojn5mxrzR6U9F83hvbQjTWnKPMvZtr0vcek+4n+OQOp3Q==", + "extraneous": true, + "dependencies": { + "resolve": "~1.17.0", + "strip-json-comments": "~3.1.1" + } + }, + "node_modules/ganache/node_modules/@rushstack/ts-command-line": { + "version": "4.10.7", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.10.7.tgz", + "integrity": "sha512-CjS+DfNXUSO5Ab2wD1GBGtUTnB02OglRWGqfaTcac9Jn45V5MeUOsq/wA8wEeS5Y/3TZ2P1k+IWdVDiuOFP9Og==", + "extraneous": true, + "dependencies": { + "@types/argparse": "1.0.38", + "argparse": "~1.0.9", + "colors": "~1.2.1", + "string-argv": "~0.3.1" + } + }, "node_modules/ganache/node_modules/@trufflesuite/bigint-buffer": { "version": "1.1.10", "resolved": "https://registry.npmjs.org/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.10.tgz", @@ -9649,6 +9858,42 @@ } } }, + "node_modules/ganache/node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@tsconfig/node16": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@types/abstract-leveldown": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", + "integrity": "sha512-q5veSX6zjUy/DlDhR4Y4cU0k2Ar+DT2LUraP00T19WLmTO6Se1djepCCaqU6nQrwcJ5Hyo/CWqxTzrrFg8eqbQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@types/argparse": { + "version": "1.0.38", + "resolved": "https://registry.npmjs.org/@types/argparse/-/argparse-1.0.38.tgz", + "integrity": "sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==", + "extraneous": true + }, "node_modules/ganache/node_modules/@types/bn.js": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", @@ -9659,6 +9904,38 @@ "@types/node": "*" } }, + "node_modules/ganache/node_modules/@types/eslint": { + "version": "8.4.10", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.10.tgz", + "integrity": "sha512-Sl/HOqN8NKPmhWo2VBEPm0nvHnu2LL3v9vKo8MEq0EtbJ4eVzGPl41VNPvn5E1i5poMk4/XD8UriLHpJvEP/Nw==", + "extraneous": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/ganache/node_modules/@types/eslint-scope": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", + "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==", + "extraneous": true, + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "node_modules/ganache/node_modules/@types/estree": { + "version": "0.0.50", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz", + "integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "extraneous": true + }, "node_modules/ganache/node_modules/@types/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.1.tgz", @@ -9666,6 +9943,12 @@ "dev": true, "peer": true }, + "node_modules/ganache/node_modules/@types/mocha": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.0.0.tgz", + "integrity": "sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==", + "extraneous": true + }, "node_modules/ganache/node_modules/@types/node": { "version": "17.0.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.0.tgz", @@ -9680,6 +9963,191 @@ "dev": true, "peer": true }, + "node_modules/ganache/node_modules/@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webassemblyjs/ast": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", + "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/helper-numbers": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz", + "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webassemblyjs/helper-api-error": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz", + "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webassemblyjs/helper-buffer": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz", + "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webassemblyjs/helper-numbers": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", + "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz", + "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz", + "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/ieee754": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz", + "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==", + "extraneous": true, + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/leb128": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz", + "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==", + "extraneous": true, + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/utf8": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz", + "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webassemblyjs/wasm-edit": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz", + "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/helper-wasm-section": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-opt": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "@webassemblyjs/wast-printer": "1.11.1" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/wasm-gen": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz", + "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/wasm-opt": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz", + "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/wasm-parser": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz", + "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/wast-printer": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz", + "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/ganache/node_modules/@webpack-cli/configtest": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", + "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webpack-cli/info": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", + "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", + "extraneous": true, + "dependencies": { + "envinfo": "^7.7.3" + } + }, + "node_modules/ganache/node_modules/@webpack-cli/serve": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", + "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "extraneous": true + }, "node_modules/ganache/node_modules/abstract-level": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.3.tgz", @@ -9729,6 +10197,139 @@ "node": ">=10" } }, + "node_modules/ganache/node_modules/acorn": { + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "extraneous": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ganache/node_modules/acorn-import-assertions": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", + "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "extraneous": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ganache/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "extraneous": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "node_modules/ganache/node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "extraneous": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "extraneous": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ganache/node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "extraneous": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/ganache/node_modules/asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "extraneous": true, + "dependencies": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/ganache/node_modules/asn1.js/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/assert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", + "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "extraneous": true, + "dependencies": { + "es6-object-assign": "^1.1.0", + "is-nan": "^1.2.1", + "object-is": "^1.0.1", + "util": "^0.12.0" + } + }, "node_modules/ganache/node_modules/async": { "version": "2.6.4", "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", @@ -9749,6 +10350,21 @@ "async": "^2.4.0" } }, + "node_modules/ganache/node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "extraneous": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "extraneous": true + }, "node_modules/ganache/node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -9772,6 +10388,52 @@ "license": "MIT", "peer": true }, + "node_modules/ganache/node_modules/big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "extraneous": true, + "engines": { + "node": "*" + } + }, + "node_modules/ganache/node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "extraneous": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/ganache/node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "extraneous": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/ganache/node_modules/brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", @@ -9781,160 +10443,98 @@ "license": "MIT", "peer": true }, - "node_modules/ganache/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "inBundle": true, - "license": "MIT", - "peer": true, - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } + "node_modules/ganache/node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "extraneous": true }, - "node_modules/ganache/node_modules/bufferutil": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", - "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "peer": true, + "node_modules/ganache/node_modules/browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "extraneous": true, "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" } }, - "node_modules/ganache/node_modules/catering": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz", - "integrity": "sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true, - "engines": { - "node": ">=6" + "node_modules/ganache/node_modules/browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "extraneous": true, + "dependencies": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" } }, - "node_modules/ganache/node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "extraneous": true, "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" } }, - "node_modules/ganache/node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true - }, - "node_modules/ganache/node_modules/emittery": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.0.tgz", - "integrity": "sha512-AGvFfs+d0JKCJQ4o01ASQLGPmSCxgfU9RFXvzPvZdjKK8oscynksuJhWrSTSw7j7Ep/sZct5b5ZhYCi8S/t0HQ==", - "dev": true, - "peer": true, - "engines": { - "node": ">=12" + "node_modules/ganache/node_modules/browserify-rsa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", + "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", + "extraneous": true, + "dependencies": { + "bn.js": "^5.0.0", + "randombytes": "^2.0.1" } }, - "node_modules/ganache/node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/browserify-sign": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", + "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "extraneous": true, "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" + "bn.js": "^5.1.1", + "browserify-rsa": "^4.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.3", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.5", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" } }, - "node_modules/ganache/node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/browserslist": { + "version": "4.21.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz", + "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==", + "extraneous": true, "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" + "caniuse-lite": "^1.0.30001400", + "electron-to-chromium": "^1.4.251", + "node-releases": "^2.0.6", + "update-browserslist-db": "^1.0.9" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, - "node_modules/ganache/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "inBundle": true, - "license": "BSD-3-Clause", - "peer": true - }, - "node_modules/ganache/node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true, - "inBundle": true, - "license": "ISC", - "peer": true - }, - "node_modules/ganache/node_modules/is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "node_modules/ganache/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "dev": true, "funding": [ { @@ -9953,157 +10553,1972 @@ "inBundle": true, "license": "MIT", "peer": true, - "engines": { - "node": ">=4" + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" } }, - "node_modules/ganache/node_modules/keccak": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", - "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", + "node_modules/ganache/node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/bufferutil": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", + "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", "dev": true, "hasInstallScript": true, - "inBundle": true, - "license": "MIT", + "optional": true, "peer": true, "dependencies": { - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0", - "readable-stream": "^3.6.0" + "node-gyp-build": "^4.3.0" }, "engines": { - "node": ">=10.0.0" + "node": ">=6.14.2" } }, - "node_modules/ganache/node_modules/level-concat-iterator": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", - "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "extraneous": true, "dependencies": { - "catering": "^2.1.0" - }, + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "node_modules/ganache/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "extraneous": true, "engines": { "node": ">=10" } }, - "node_modules/ganache/node_modules/level-supports": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", - "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", + "node_modules/ganache/node_modules/caniuse-lite": { + "version": "1.0.30001435", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001435.tgz", + "integrity": "sha512-kdCkUTjR+v4YAJelyiDTqiu82BDr4W4CP5sgTA0ZBmqn30XfS2ZghPLMowik9TPhS+psWJiUNxsqLyurDbmutA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/catering": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz", + "integrity": "sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==", "dev": true, "inBundle": true, "license": "MIT", "peer": true, "engines": { - "node": ">=10" + "node": ">=6" } }, - "node_modules/ganache/node_modules/level-transcoder": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-transcoder/-/level-transcoder-1.0.1.tgz", - "integrity": "sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w==", - "dev": true, - "peer": true, + "node_modules/ganache/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "extraneous": true, "dependencies": { - "buffer": "^6.0.3", - "module-error": "^1.0.1" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" }, "engines": { - "node": ">=12" + "node": ">=10" } }, - "node_modules/ganache/node_modules/leveldown": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-6.1.0.tgz", - "integrity": "sha512-8C7oJDT44JXxh04aSSsfcMI8YiaGRhOFI9/pMEL7nWJLVsWajDPTRxsSHTM2WcTVY5nXM+SuRHzPPi0GbnDX+w==", - "dev": true, - "hasInstallScript": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "extraneous": true, "dependencies": { - "abstract-leveldown": "^7.2.0", - "napi-macros": "~2.0.0", - "node-gyp-build": "^4.3.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=10.12.0" + "node": ">=8" } }, - "node_modules/ganache/node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true, - "peer": true - }, - "node_modules/ganache/node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true, - "inBundle": true, - "license": "ISC", - "peer": true + "node_modules/ganache/node_modules/chokidar": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", + "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "extraneous": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } }, - "node_modules/ganache/node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true + "node_modules/ganache/node_modules/chrome-trace-event": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", + "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", + "extraneous": true, + "engines": { + "node": ">=6.0" + } }, - "node_modules/ganache/node_modules/module-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz", - "integrity": "sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==", - "dev": true, - "peer": true, + "node_modules/ganache/node_modules/cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "extraneous": true, + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/ganache/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "extraneous": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/ganache/node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "extraneous": true, + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "extraneous": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/ganache/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/colorette": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz", + "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/colors": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.2.5.tgz", + "integrity": "sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg==", + "extraneous": true, + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/ganache/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/create-ecdh": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", + "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", + "extraneous": true, + "dependencies": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + } + }, + "node_modules/ganache/node_modules/create-ecdh/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "extraneous": true, + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/ganache/node_modules/create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "extraneous": true, + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/ganache/node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "extraneous": true, + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, + "node_modules/ganache/node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "extraneous": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ganache/node_modules/crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "extraneous": true, + "dependencies": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ganache/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "extraneous": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/ganache/node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "extraneous": true + }, + "node_modules/ganache/node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "extraneous": true, "engines": { "node": ">=10" } }, - "node_modules/ganache/node_modules/napi-macros": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", - "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", + "node_modules/ganache/node_modules/define-properties": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "extraneous": true, + "dependencies": { + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/des.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", + "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", + "extraneous": true, + "dependencies": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/ganache/node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "extraneous": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/ganache/node_modules/diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "extraneous": true, + "dependencies": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "node_modules/ganache/node_modules/diffie-hellman/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/electron-to-chromium": { + "version": "1.4.284", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz", + "integrity": "sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "dev": true, "inBundle": true, "license": "MIT", - "peer": true + "peer": true, + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } }, - "node_modules/ganache/node_modules/node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", + "node_modules/ganache/node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "dev": true, "inBundle": true, "license": "MIT", "peer": true }, - "node_modules/ganache/node_modules/node-gyp-build": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", - "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", + "node_modules/ganache/node_modules/emittery": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.0.tgz", + "integrity": "sha512-AGvFfs+d0JKCJQ4o01ASQLGPmSCxgfU9RFXvzPvZdjKK8oscynksuJhWrSTSw7j7Ep/sZct5b5ZhYCi8S/t0HQ==", "dev": true, - "inBundle": true, - "license": "MIT", "peer": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/ganache/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "extraneous": true + }, + "node_modules/ganache/node_modules/emojis-list": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", + "extraneous": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/ganache/node_modules/enhanced-resolve": { + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz", + "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==", + "extraneous": true, + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/ganache/node_modules/envinfo": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", + "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", + "extraneous": true, "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" } }, - "node_modules/ganache/node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "node_modules/ganache/node_modules/es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/es6-object-assign": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", + "integrity": "sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "extraneous": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "extraneous": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/ganache/node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "extraneous": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/ganache/node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "extraneous": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/ganache/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "extraneous": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/ganache/node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "extraneous": true, + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/ganache/node_modules/evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "extraneous": true, + "dependencies": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/ganache/node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "extraneous": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "extraneous": true + }, + "node_modules/ganache/node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "extraneous": true, + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/ganache/node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "extraneous": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "extraneous": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "extraneous": true, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/ganache/node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "extraneous": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/ganache/node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "extraneous": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/ganache/node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "extraneous": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/ganache/node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "extraneous": true + }, + "node_modules/ganache/node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "extraneous": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/ganache/node_modules/get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "extraneous": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + } + }, + "node_modules/ganache/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "extraneous": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "extraneous": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ganache/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "extraneous": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/ganache/node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "extraneous": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + } + }, + "node_modules/ganache/node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "extraneous": true, + "engines": { + "node": ">=4.x" + } + }, + "node_modules/ganache/node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "extraneous": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/ganache/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "extraneous": true, + "dependencies": { + "get-intrinsic": "^1.1.1" + } + }, + "node_modules/ganache/node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "extraneous": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "extraneous": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "extraneous": true, + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ganache/node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/ganache/node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "extraneous": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/ganache/node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/ganache/node_modules/https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "extraneous": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/ganache/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "inBundle": true, + "license": "BSD-3-Clause", + "peer": true + }, + "node_modules/ganache/node_modules/import-lazy": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", + "integrity": "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "extraneous": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "extraneous": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/ganache/node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "inBundle": true, + "license": "ISC", + "peer": true + }, + "node_modules/ganache/node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "extraneous": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/ganache/node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "extraneous": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "extraneous": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "inBundle": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/ganache/node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "extraneous": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "extraneous": true, + "dependencies": { + "has": "^1.0.3" + } + }, + "node_modules/ganache/node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "extraneous": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "extraneous": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/is-nan": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", + "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", + "extraneous": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "extraneous": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/ganache/node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "extraneous": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "extraneous": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "extraneous": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "extraneous": true, + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/ganache/node_modules/jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "extraneous": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/ganache/node_modules/js-yaml/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "extraneous": true + }, + "node_modules/ganache/node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/json5": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", + "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "extraneous": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "extraneous": true, + "dependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/ganache/node_modules/keccak": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", + "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", + "dev": true, + "hasInstallScript": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ganache/node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/level-concat-iterator": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", + "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "catering": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/level-js": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/level-js/-/level-js-6.1.0.tgz", + "integrity": "sha512-i7mPtkZm68aewfv0FnIUWvFUFfoyzIvVKnUmuQGrelEkP72vSPTaA1SGneWWoCV5KZJG4wlzbJLp1WxVNGuc6A==", + "extraneous": true, + "dependencies": { + "abstract-leveldown": "^7.2.0", + "buffer": "^6.0.3", + "inherits": "^2.0.3", + "ltgt": "^2.1.2", + "run-parallel-limit": "^1.1.0" + } + }, + "node_modules/ganache/node_modules/level-supports": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", + "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/level-transcoder": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/level-transcoder/-/level-transcoder-1.0.1.tgz", + "integrity": "sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w==", + "dev": true, + "peer": true, + "dependencies": { + "buffer": "^6.0.3", + "module-error": "^1.0.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/ganache/node_modules/leveldown": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-6.1.0.tgz", + "integrity": "sha512-8C7oJDT44JXxh04aSSsfcMI8YiaGRhOFI9/pMEL7nWJLVsWajDPTRxsSHTM2WcTVY5nXM+SuRHzPPi0GbnDX+w==", + "dev": true, + "hasInstallScript": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "abstract-leveldown": "^7.2.0", + "napi-macros": "~2.0.0", + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/ganache/node_modules/loader-runner": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "extraneous": true, + "engines": { + "node": ">=6.11.5" + } + }, + "node_modules/ganache/node_modules/loader-utils": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", + "extraneous": true, + "dependencies": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + }, + "engines": { + "node": ">=8.9.0" + } + }, + "node_modules/ganache/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "extraneous": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true, + "peer": true + }, + "node_modules/ganache/node_modules/lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "extraneous": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "extraneous": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/ltgt": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ltgt/-/ltgt-2.2.1.tgz", + "integrity": "sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/mcl-wasm": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/mcl-wasm/-/mcl-wasm-0.9.0.tgz", + "integrity": "sha512-rvU7L/68ZrDk4dpPZteiEqvK9nB/1XbbHmuLK6qIvc4xuuJb/iv1p5X3KEyq6AYatLnc+zbdSlLXTlKgTnCRZQ==", + "extraneous": true, + "engines": { + "node": ">=8.9.0" + } + }, + "node_modules/ganache/node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "extraneous": true, + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/ganache/node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "extraneous": true + }, + "node_modules/ganache/node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "extraneous": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/ganache/node_modules/miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "extraneous": true, + "dependencies": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "bin": { + "miller-rabin": "bin/miller-rabin" + } + }, + "node_modules/ganache/node_modules/miller-rabin/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "extraneous": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ganache/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "extraneous": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ganache/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true, + "inBundle": true, + "license": "ISC", + "peer": true + }, + "node_modules/ganache/node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true + }, + "node_modules/ganache/node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "extraneous": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ganache/node_modules/minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "extraneous": true + }, + "node_modules/ganache/node_modules/mocha": { + "version": "9.1.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.3.tgz", + "integrity": "sha512-Xcpl9FqXOAYqI3j79pEtHBBnQgVXIhpULjGQa7DVb0Po+VzmSIK9kanAiWLHoRR/dbZ2qpdPshuXr8l1VaHCzw==", + "extraneous": true, + "dependencies": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.2", + "debug": "4.3.2", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.7", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.25", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "workerpool": "6.1.5", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/ganache/node_modules/module-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz", + "integrity": "sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/nanoid": { + "version": "3.1.25", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", + "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==", + "extraneous": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/ganache/node_modules/napi-macros": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", + "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true + }, + "node_modules/ganache/node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true + }, + "node_modules/ganache/node_modules/node-gyp-build": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", + "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/ganache/node_modules/node-loader": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/node-loader/-/node-loader-1.0.2.tgz", + "integrity": "sha512-myxAxpyMR7knjA4Uzwf3gjxaMtxSWj2vpm9o6AYWWxQ1S3XMBNeG2vzYcp/5eW03cBGfgSxyP+wntP8qhBJNhQ==", + "extraneous": true, + "dependencies": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/ganache/node_modules/node-releases": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", + "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "extraneous": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/object-is": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", + "extraneous": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "extraneous": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "extraneous": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/ganache/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "extraneous": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A==", + "extraneous": true + }, + "node_modules/ganache/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "extraneous": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "extraneous": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/parse-asn1": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", + "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", + "extraneous": true, + "dependencies": { + "asn1.js": "^5.2.0", + "browserify-aes": "^1.0.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/ganache/node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "extraneous": true + }, + "node_modules/ganache/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "extraneous": true, + "dependencies": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/ganache/node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "extraneous": true, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/ganache/node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "extraneous": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "extraneous": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "extraneous": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "extraneous": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "extraneous": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "extraneous": true, + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/ganache/node_modules/public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "extraneous": true, + "dependencies": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/ganache/node_modules/public-encrypt/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true, "funding": [ @@ -10124,74 +12539,592 @@ "license": "MIT", "peer": true }, - "node_modules/ganache/node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "node_modules/ganache/node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "extraneous": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/ganache/node_modules/randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "extraneous": true, + "dependencies": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "node_modules/ganache/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/ganache/node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "extraneous": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/ganache/node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "extraneous": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/ganache/node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "extraneous": true, + "dependencies": { + "path-parse": "^1.0.6" + } + }, + "node_modules/ganache/node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "extraneous": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "extraneous": true, + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/ganache/node_modules/run-parallel-limit": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz", + "integrity": "sha512-jJA7irRNM91jaKc3Hcl1npHsFLOXOoTkPCUL1JEa1R82O2miplXXRaGdjW/KM/98YQWDhJLiSs793CnXfblJUw==", + "extraneous": true, + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/ganache/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "inBundle": true, + "license": "MIT", + "peer": true + }, + "node_modules/ganache/node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "extraneous": true, + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/ganache/node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", "dev": true, + "hasInstallScript": true, "inBundle": true, "license": "MIT", "peer": true, "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "elliptic": "^6.5.4", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ganache/node_modules/semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "extraneous": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "extraneous": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/ganache/node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "extraneous": true, + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/ganache/node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "extraneous": true, + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "extraneous": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/shebang-loader": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/shebang-loader/-/shebang-loader-0.0.1.tgz", + "integrity": "sha512-nQvhUHvKyzGK5aqPxHfHB5nlAN2EZ2U61S2G0YrxAuCRU5iGhFcxxRiaAdb18UoRS1zVMhRz4gdQ1xFEg3AOyA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "extraneous": true, + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ganache/node_modules/shx": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.3.tgz", + "integrity": "sha512-nZJ3HFWVoTSyyB+evEKjJ1STiixGztlqwKLTUNV5KqMWtGey9fTd4KU1gdZ1X9BV6215pswQ/Jew9NsuS/fNDA==", + "extraneous": true, + "dependencies": { + "minimist": "^1.2.3", + "shelljs": "^0.8.4" + }, + "bin": { + "shx": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "extraneous": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/ganache/node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "extraneous": true + }, + "node_modules/ganache/node_modules/stream-browserify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", + "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", + "extraneous": true, + "dependencies": { + "inherits": "~2.0.4", + "readable-stream": "^3.5.0" + } + }, + "node_modules/ganache/node_modules/stream-http": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.2.0.tgz", + "integrity": "sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A==", + "extraneous": true, + "dependencies": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "xtend": "^4.0.2" + } + }, + "node_modules/ganache/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/ganache/node_modules/string-argv": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", + "integrity": "sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==", + "extraneous": true, + "engines": { + "node": ">=0.6.19" + } + }, + "node_modules/ganache/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "extraneous": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "extraneous": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "extraneous": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/terser": { + "version": "5.16.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.1.tgz", + "integrity": "sha512-xvQfyfA1ayT0qdK47zskQgRZeWLoOQ8JQ6mIgRGVNwZKdQMU+5FkCBjmv4QjcrTzyZquRw2FVtlJSRUmMKQslw==", + "extraneous": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.2", + "acorn": "^8.5.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/terser-webpack-plugin": { + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.2.5.tgz", + "integrity": "sha512-3luOVHku5l0QBeYS8r4CdHYWEGMmIj3H1U64jgkdZzECcSOJAyJ9TjuqcQZvw1Y+4AOBN9SeYJPJmFn2cM4/2g==", + "extraneous": true, + "dependencies": { + "jest-worker": "^27.0.6", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.0", + "source-map": "^0.6.1", + "terser": "^5.7.2" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/ganache/node_modules/timsort": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", + "integrity": "sha512-qsdtZH+vMoCARQtyod4imc2nIJwg9Cc7lPRrw9CzF8ZKR0khdr8+2nX80PBhET3tcyTtJDxAffGh2rXH4tyU8A==", + "extraneous": true + }, + "node_modules/ganache/node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "extraneous": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/ganache/node_modules/ts-loader": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.3.1.tgz", + "integrity": "sha512-OkyShkcZTsTwyS3Kt7a4rsT/t2qvEVQuKCTg4LJmpj9fhFR7ukGdZwV6Qq3tRUkqcXtfGpPR7+hFKHCG/0d3Lw==", + "extraneous": true, + "dependencies": { + "chalk": "^4.1.0", + "enhanced-resolve": "^5.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/ganache/node_modules/ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "extraneous": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + } + }, + "node_modules/ganache/node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "extraneous": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/ganache/node_modules/typescript": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "extraneous": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" }, "engines": { - "node": ">= 6" + "node": ">=14.17" } }, - "node_modules/ganache/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "inBundle": true, - "license": "MIT", - "peer": true + "node_modules/ganache/node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "extraneous": true, + "engines": { + "node": ">= 4.0.0" + } }, - "node_modules/ganache/node_modules/secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", - "dev": true, - "hasInstallScript": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/update-browserslist-db": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", + "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", + "extraneous": true, "dependencies": { - "elliptic": "^6.5.4", - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0" + "escalade": "^3.1.1", + "picocolors": "^1.0.0" }, - "engines": { - "node": ">=10.0.0" + "bin": { + "browserslist-lint": "cli.js" } }, - "node_modules/ganache/node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "extraneous": true, "dependencies": { - "safe-buffer": "~5.2.0" + "punycode": "^2.1.0" } }, "node_modules/ganache/node_modules/utf-8-validate": { @@ -10209,6 +13142,20 @@ "node": ">=6.14.2" } }, + "node_modules/ganache/node_modules/util": { + "version": "0.12.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz", + "integrity": "sha512-bxZ9qtSlGUWSOy9Qa9Xgk11kSslpuZwaxCg4sNIDj6FLucDab2JxnHwyNTCpHMtK1MjoQiWQ6DiUMZYbSrO+Sw==", + "extraneous": true, + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "safe-buffer": "^5.1.2", + "which-typed-array": "^1.1.2" + } + }, "node_modules/ganache/node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -10218,6 +13165,316 @@ "license": "MIT", "peer": true }, + "node_modules/ganache/node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/validator": { + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.7.0.tgz", + "integrity": "sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==", + "extraneous": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/ganache/node_modules/watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "extraneous": true, + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/ganache/node_modules/webpack": { + "version": "5.65.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.65.0.tgz", + "integrity": "sha512-Q5or2o6EKs7+oKmJo7LaqZaMOlDWQse9Tm5l1WAfU/ujLGN5Pb0SqGeVkN/4bpPmEqEP5RnVhiqsOtWtUVwGRw==", + "extraneous": true, + "dependencies": { + "@types/eslint-scope": "^3.7.0", + "@types/estree": "^0.0.50", + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/wasm-edit": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "acorn": "^8.4.1", + "acorn-import-assertions": "^1.7.6", + "browserslist": "^4.14.5", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.8.3", + "es-module-lexer": "^0.9.0", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.4", + "json-parse-better-errors": "^1.0.2", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.1.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.1.3", + "watchpack": "^2.3.1", + "webpack-sources": "^3.2.2" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/ganache/node_modules/webpack-cli": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.9.1.tgz", + "integrity": "sha512-JYRFVuyFpzDxMDB+v/nanUdQYcZtqFPGzmlW4s+UkPMFhSpfRNmf1z4AwYcHJVdvEFAM7FFCQdNTpsBYhDLusQ==", + "extraneous": true, + "dependencies": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^1.1.0", + "@webpack-cli/info": "^1.4.0", + "@webpack-cli/serve": "^1.6.0", + "colorette": "^2.0.14", + "commander": "^7.0.0", + "execa": "^5.0.0", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^2.2.0", + "rechoir": "^0.7.0", + "webpack-merge": "^5.7.3" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/ganache/node_modules/webpack-cli/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "extraneous": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/ganache/node_modules/webpack-cli/node_modules/interpret": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", + "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "extraneous": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/ganache/node_modules/webpack-cli/node_modules/rechoir": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", + "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "extraneous": true, + "dependencies": { + "resolve": "^1.9.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/ganache/node_modules/webpack-merge": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", + "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", + "extraneous": true, + "dependencies": { + "clone-deep": "^4.0.1", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ganache/node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "extraneous": true, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/ganache/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "extraneous": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ganache/node_modules/which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "extraneous": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/wildcard": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", + "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/workerpool": { + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.5.tgz", + "integrity": "sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "extraneous": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "extraneous": true, + "engines": { + "node": ">=0.4" + } + }, + "node_modules/ganache/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "extraneous": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "extraneous": true + }, + "node_modules/ganache/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "extraneous": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "extraneous": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "extraneous": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "extraneous": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/z-schema": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-5.0.4.tgz", + "integrity": "sha512-gm/lx3hDzJNcLwseIeQVm1UcwhWIKpSB4NqH89pTBtFns4k/HDHudsICtvG05Bvw/Mv3jMyk700y5dadueLHdA==", + "extraneous": true, + "dependencies": { + "commander": "^2.20.3", + "lodash.get": "^4.4.2", + "lodash.isequal": "^4.5.0", + "validator": "^13.7.0" + }, + "bin": { + "z-schema": "bin/z-schema" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts index d8bb3b5..472859c 100644 --- a/src/deployer/Deployer.ts +++ b/src/deployer/Deployer.ts @@ -27,7 +27,7 @@ export class Deployer { args: TypedArgs = [] as TypedArgs, parameters: OverridesAndLibs = {}, ): Promise { - const adapter = this._resolveAdapter(this._hre, contract); + const adapter = this._resolveAdapter(contract); const minimalContract = await adapter.fromInstance(contract); @@ -37,7 +37,7 @@ export class Deployer { } public async deployed(contract: Instance): Promise { - const adapter = this._resolveAdapter(this._hre, contract); + const adapter = this._resolveAdapter(contract); const contractName = adapter.getContractName(contract); const contractAddress = await TransactionProcessor.tryRestoreContractAddressByName(contractName, this._hre); @@ -53,21 +53,21 @@ export class Deployer { return getChainId(this._hre); } - private _resolveAdapter(hre: HardhatRuntimeEnvironment, contract: Instance): Adapter { + private _resolveAdapter(contract: Instance): Adapter { if (isEthersFactory(contract)) { - return new EthersAdapter(hre); + return new EthersAdapter(this._hre); } if (isTruffleFactory(contract)) { - return new TruffleAdapter(hre); + return new TruffleAdapter(this._hre); } if (isPureFactory(contract)) { - return new PureAdapter(hre); + return new PureAdapter(this._hre); } if (isContractFactory(contract)) { - return new PureEthersAdapter(hre); + return new PureEthersAdapter(this._hre); } throw new MigrateError("Unknown Contract Factory Type"); diff --git a/src/tools/reporters/Reporter.ts b/src/tools/reporters/Reporter.ts index c1c16bd..d1824d4 100644 --- a/src/tools/reporters/Reporter.ts +++ b/src/tools/reporters/Reporter.ts @@ -15,7 +15,7 @@ import { ChainRecord, predefinedChains } from "../../types/verifier"; @catchError export class Reporter { - private static _hre: HardhatRuntimeEnvironment = {} as HardhatRuntimeEnvironment; + private static _hre: HardhatRuntimeEnvironment; private static totalCost: bigint = 0n; private static totalTransactions: number = 0; diff --git a/src/tools/reporters/TruffleReporter.ts b/src/tools/reporters/TruffleReporter.ts index 46253f3..83784cc 100644 --- a/src/tools/reporters/TruffleReporter.ts +++ b/src/tools/reporters/TruffleReporter.ts @@ -4,12 +4,8 @@ import { TruffleTransactionResponse } from "../../types/deployer"; export class TruffleReporter { public static async reportTransaction(tx: TruffleTransactionResponse | string, instanceName: string) { - if (typeof tx === "string") { - await Reporter.reportTransactionByHash(tx, instanceName); + const hash = typeof tx === "string" ? tx : tx.receipt.transactionHash; - return; - } - - await Reporter.reportTransactionByHash(tx.receipt.transactionHash, instanceName); + await Reporter.reportTransactionByHash(hash, instanceName); } } diff --git a/src/tools/storage/ArtifactProcessor.ts b/src/tools/storage/ArtifactProcessor.ts index 9023b86..eae84f2 100644 --- a/src/tools/storage/ArtifactProcessor.ts +++ b/src/tools/storage/ArtifactProcessor.ts @@ -20,7 +20,7 @@ export class ArtifactProcessor { const contract: ArtifactExtended = { ...artifact, neededLibraries: this._parseLibrariesOfArtifact(artifact) }; - if (contract.bytecode === "0x") { + if (this._isNotDeployableArtifact(artifact)) { continue; } @@ -73,4 +73,8 @@ export class ArtifactProcessor { return neededLibraries; } + + private static _isNotDeployableArtifact(artifact: Artifact): boolean { + return artifact.deployedBytecode === "0x"; + } } From 60295d4edf80c2b39df42f3c451e0290d6534c90 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Wed, 25 Oct 2023 11:39:52 +0200 Subject: [PATCH 02/36] use wait instead of confirmations in the config --- src/config.ts | 7 +++-- src/deployer/MinimalContract.ts | 2 +- src/types/migrations.ts | 7 +---- .../hardhat.config.js | 3 +- .../hardhat.config.js | 1 + test/integration/config.ts | 28 +++++++++++-------- 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/config.ts b/src/config.ts index bd7e564..d99507f 100644 --- a/src/config.ts +++ b/src/config.ts @@ -12,8 +12,7 @@ const defaultConfig: MigrateConfig = { to: -1, only: -1, skip: -1, - txConfirmations: 1, - verifyConfirmations: 0, + wait: 1, verify: VerifyStrategy.AtTheEnd, attempts: 0, pathToMigrations: "./deploy", @@ -34,6 +33,10 @@ export const mergeConfigs = ( return defaultConfig; } + if (config.wait && config.wait < 1) { + throw new HardhatPluginError(pluginName, "config.migrate.wait must be greater than 0"); + } + if (config.pathToMigrations && !isRelativePath(config.pathToMigrations)) { throw new HardhatPluginError(pluginName, "config.migrate.pathToMigrations must be a relative path"); } diff --git a/src/deployer/MinimalContract.ts b/src/deployer/MinimalContract.ts index 30a9524..49432ab 100644 --- a/src/deployer/MinimalContract.ts +++ b/src/deployer/MinimalContract.ts @@ -130,7 +130,7 @@ export class MinimalContract { } private async _waitForDeployment(tx: TransactionResponse): Promise { - const receipt = await tx.wait(this._config.txConfirmations); + const receipt = await tx.wait(this._config.wait); if (receipt) { return receipt.contractAddress!; diff --git a/src/types/migrations.ts b/src/types/migrations.ts index 3c9b3ee..c5e3f67 100644 --- a/src/types/migrations.ts +++ b/src/types/migrations.ts @@ -25,12 +25,7 @@ export interface MigrateConfig { /* * The number defining how many confirmations each transaction should have. */ - txConfirmations: number; - - /* - * The number defining after how many blocks the verification should start. - */ - verifyConfirmations: number; + wait: number; /* * The strategy of the verification. diff --git a/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js b/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js index dff1e8d..8e133cd 100644 --- a/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js +++ b/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js @@ -8,8 +8,7 @@ module.exports = { skip: 1, verify: true, attempts: 2, - txConfirmations: 2, - verifyConfirmations: 5, + wait: 2, pathToMigrations: "./deploy/", skipVerificationErrors: ["already verified"], }, diff --git a/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js b/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js index 963947e..9f8152e 100644 --- a/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js +++ b/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js @@ -2,6 +2,7 @@ require("../../../src"); module.exports = { migrate: { + wait: 0, pathToMigrations: "/deploy", }, }; diff --git a/test/integration/config.ts b/test/integration/config.ts index 31d2518..0feecfb 100644 --- a/test/integration/config.ts +++ b/test/integration/config.ts @@ -42,12 +42,8 @@ describe("config", () => { assert.equal(loadedOptions.attempts, 2); }); - it("should apply tx confirmations", async function () { - assert.equal(loadedOptions.txConfirmations, 2); - }); - - it("should apply verify confirmations", async function () { - assert.equal(loadedOptions.verifyConfirmations, 5); + it("should apply wait", async function () { + assert.equal(loadedOptions.wait, 2); }); it("should apply pathToMigrations", async function () { @@ -77,6 +73,18 @@ describe("config", () => { resetHardhatContext(); }); + + it("should throw if wait is less than 1", async function () { + expect(() => { + const prefix = "hardhat-project-"; + process.chdir(join(__dirname, "../", "fixture-projects", prefix + fixtureProjectName)); + process.env.HARDHAT_NETWORK = "hardhat"; + + require("hardhat"); + }).to.throw(HardhatPluginError, "config.migrate.wait must be greater than 0"); + + resetHardhatContext(); + }); }); describe("extension", () => { @@ -116,12 +124,8 @@ describe("config", () => { assert.equal(loadedOptions.attempts, 0); }); - it("should set to default tx confirmations", async function () { - assert.equal(loadedOptions.txConfirmations, 1); - }); - - it("should set to default verify confirmations", async function () { - assert.equal(loadedOptions.verifyConfirmations, 0); + it("should set to default wait", async function () { + assert.equal(loadedOptions.wait, 1); }); it("should set to default pathToMigrations", async function () { From 84423230e3873434c827c14e170f51bae5430469 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Wed, 25 Oct 2023 11:45:58 +0200 Subject: [PATCH 03/36] change 'verify' parameter to the boolean flag --- src/config.ts | 4 ++-- src/deployer/MinimalContract.ts | 3 ++- src/index.ts | 2 +- src/migrator/Migrator.ts | 6 +++--- src/types/migrations.ts | 10 ++-------- src/verifier/Verifier.ts | 23 +---------------------- test/integration/config.ts | 4 ++-- 7 files changed, 13 insertions(+), 39 deletions(-) diff --git a/src/config.ts b/src/config.ts index d99507f..e53e9be 100644 --- a/src/config.ts +++ b/src/config.ts @@ -5,7 +5,7 @@ import { ConfigExtender } from "hardhat/types"; import { pluginName } from "./constants"; -import { MigrateConfig, VerifyStrategy } from "./types/migrations"; +import { MigrateConfig } from "./types/migrations"; const defaultConfig: MigrateConfig = { from: -1, @@ -13,7 +13,7 @@ const defaultConfig: MigrateConfig = { only: -1, skip: -1, wait: 1, - verify: VerifyStrategy.AtTheEnd, + verify: false, attempts: 0, pathToMigrations: "./deploy", skipVerificationErrors: ["already verified"], diff --git a/src/deployer/MinimalContract.ts b/src/deployer/MinimalContract.ts index 49432ab..1908409 100644 --- a/src/deployer/MinimalContract.ts +++ b/src/deployer/MinimalContract.ts @@ -16,6 +16,7 @@ import { Verifier } from "../verifier/Verifier"; import { Reporter } from "../tools/reporters/Reporter"; import { ArtifactProcessor } from "../tools/storage/ArtifactProcessor"; import { TransactionProcessor } from "../tools/storage/TransactionProcessor"; +import { VerificationProcessor } from "../tools/storage/VerificationProcessor"; @catchError export class MinimalContract { @@ -120,7 +121,7 @@ export class MinimalContract { TransactionProcessor.saveDeploymentTransaction(tx, tx.contractName, contractAddress); - await this._verifier.processVerification({ + VerificationProcessor.saveVerificationFunction({ contractAddress, contractName: tx.contractName, constructorArguments: args, diff --git a/src/index.ts b/src/index.ts index 75de117..f0000a8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -60,7 +60,7 @@ task(TASK_MIGRATE, "Deploy contracts via migration files") types.int, ) .addOptionalParam("skip", "The number of migration to skip. Overrides only parameter.", undefined, types.int) - .addOptionalParam("verify", "The enum defining the verification strategy.", undefined, types.string) + .addFlag("verify", "The flag indicating whether the contracts should be verified.") .addFlag("force", "The flag indicating whether the compilation is forced.") .addOptionalParam( "confirmations", diff --git a/src/migrator/Migrator.ts b/src/migrator/Migrator.ts index 0f4b254..e0dfbb5 100644 --- a/src/migrator/Migrator.ts +++ b/src/migrator/Migrator.ts @@ -1,5 +1,5 @@ -import { basename } from "path"; import { readdirSync, statSync } from "fs"; +import { basename } from "path"; import { HardhatPluginError } from "hardhat/plugins"; import { HardhatRuntimeEnvironment } from "hardhat/types"; @@ -10,7 +10,7 @@ import { resolvePathToFile } from "../utils"; import { MigrateError } from "../errors"; -import { MigrateConfig, VerifyStrategy } from "../types/migrations"; +import { MigrateConfig } from "../types/migrations"; import { Deployer } from "../deployer/Deployer"; import { Verifier } from "../verifier/Verifier"; @@ -53,7 +53,7 @@ export class Migrator { } } - if (this._config.verify === VerifyStrategy.AtTheEnd) { + if (this._config.verify) { await this._verifier.verifyBatch(VerificationProcessor.restoreSavedVerificationFunctions()); } diff --git a/src/types/migrations.ts b/src/types/migrations.ts index c5e3f67..ac5547b 100644 --- a/src/types/migrations.ts +++ b/src/types/migrations.ts @@ -28,9 +28,9 @@ export interface MigrateConfig { wait: number; /* - * The strategy of the verification. + * The flag indicating whether the contract should be verified. */ - verify: VerifyStrategy; + verify: boolean; /* * The number of attempts to verify the contract. @@ -58,9 +58,3 @@ export interface MigrateConfig { */ continue: boolean; } - -export enum VerifyStrategy { - Immediately = "immediately", - AtTheEnd = "at-the-end", - None = "none", -} diff --git a/src/verifier/Verifier.ts b/src/verifier/Verifier.ts index 158345b..67fd7a7 100644 --- a/src/verifier/Verifier.ts +++ b/src/verifier/Verifier.ts @@ -6,11 +6,10 @@ import { EtherscanConfig } from "@nomicfoundation/hardhat-verify/types"; import { catchError, suppressLogs } from "../utils"; import { Args } from "../types/deployer"; +import { MigrateConfig } from "../types/migrations"; import { VerifierArgs } from "../types/verifier"; -import { MigrateConfig, VerifyStrategy } from "../types/migrations"; import { Reporter } from "../tools/reporters/Reporter"; -import { VerificationProcessor } from "../tools/storage/VerificationProcessor"; export class Verifier { private readonly _config: MigrateConfig; @@ -21,26 +20,6 @@ export class Verifier { this._etherscanConfig = (_hre.config as any).etherscan; } - public async processVerification(verifierArgs: VerifierArgs): Promise { - if (!this._config) { - return; - } - - switch (this._config.verify) { - case VerifyStrategy.AtTheEnd: { - VerificationProcessor.saveVerificationFunction(verifierArgs); - break; - } - case VerifyStrategy.Immediately: { - await this.verify(verifierArgs); - break; - } - case VerifyStrategy.None: { - break; - } - } - } - @catchError public async verify(verifierArgs: VerifierArgs): Promise { const { contractAddress, contractName, constructorArguments } = verifierArgs; diff --git a/test/integration/config.ts b/test/integration/config.ts index 0feecfb..a6175d0 100644 --- a/test/integration/config.ts +++ b/test/integration/config.ts @@ -5,7 +5,7 @@ import { assert, expect } from "chai"; import { HardhatPluginError } from "hardhat/plugins"; import { resetHardhatContext } from "hardhat/plugins-testing"; -import { MigrateConfig, VerifyStrategy } from "../../src/types/migrations"; +import { MigrateConfig } from "../../src/types/migrations"; import { useEnvironment } from "../helpers"; describe("config", () => { @@ -117,7 +117,7 @@ describe("config", () => { }); it("should set to default verify", async function () { - assert.equal(loadedOptions.verify, VerifyStrategy.AtTheEnd); + assert.equal(loadedOptions.verify, false); }); it("should set to default attempts", async function () { From b77e7573881f64ad650ccfc728f799ccc93a8ba5 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Wed, 25 Oct 2023 11:48:00 +0200 Subject: [PATCH 04/36] removed 'skipVerificationErrors' from config --- src/config.ts | 1 - src/types/migrations.ts | 6 ------ .../hardhat-project-defined-config/hardhat.config.js | 1 - test/integration/config.ts | 8 -------- 4 files changed, 16 deletions(-) diff --git a/src/config.ts b/src/config.ts index e53e9be..b00b2e3 100644 --- a/src/config.ts +++ b/src/config.ts @@ -16,7 +16,6 @@ const defaultConfig: MigrateConfig = { verify: false, attempts: 0, pathToMigrations: "./deploy", - skipVerificationErrors: ["already verified"], force: false, continue: false, }; diff --git a/src/types/migrations.ts b/src/types/migrations.ts index ac5547b..216d4e8 100644 --- a/src/types/migrations.ts +++ b/src/types/migrations.ts @@ -42,12 +42,6 @@ export interface MigrateConfig { */ pathToMigrations: string; - /* - * The user can specify custom verification errors that will be omitted - * and just be printed to the log instead of stopping the program completely. - */ - skipVerificationErrors: string[]; - /* * The flag indicating whether the compilation is forced. */ diff --git a/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js b/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js index 8e133cd..650e929 100644 --- a/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js +++ b/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js @@ -10,6 +10,5 @@ module.exports = { attempts: 2, wait: 2, pathToMigrations: "./deploy/", - skipVerificationErrors: ["already verified"], }, }; diff --git a/test/integration/config.ts b/test/integration/config.ts index a6175d0..5d204a2 100644 --- a/test/integration/config.ts +++ b/test/integration/config.ts @@ -50,10 +50,6 @@ describe("config", () => { assert.equal(loadedOptions.pathToMigrations, "./deploy/"); }); - it("should apply skipVerificationErrors", async function () { - assert.deepEqual(loadedOptions.skipVerificationErrors, ["already verified"]); - }); - it("should apply continuePreviousDeployment", async function () { assert.isFalse(loadedOptions.continue); }); @@ -132,10 +128,6 @@ describe("config", () => { assert.equal(loadedOptions.pathToMigrations, "./deploy"); }); - it("should set to default skipVerificationErrors", async function () { - assert.deepEqual(loadedOptions.skipVerificationErrors, ["already verified"]); - }); - it("should set to default continuePreviousDeployment", async function () { assert.isFalse(loadedOptions.continue); }); From 6743cf3704a7ca321fd014cd0b6093d3c267be0f Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Wed, 25 Oct 2023 11:52:51 +0200 Subject: [PATCH 05/36] updated readme and help task --- README.md | 23 +++++++---------------- src/index.ts | 9 ++------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 5bb1885..bcb7436 100644 --- a/README.md +++ b/README.md @@ -78,14 +78,12 @@ module.exports = { to: -1, only: -1, skip: -1, - txConfirmations: 1, - verifyConfirmations: 0, - verify: "at-the-end", + wait: 1, + verify: false, attempts: 0, pathToMigrations: "./deploy", - skipVerificationErrors: ["already verified"], force: false, - continuePreviousDeployment: false, + continue: false, }, }; ``` @@ -96,19 +94,12 @@ module.exports = { - `to` : The migration number up to which the migration will be applied. - `only` : The number of the migration that will be applied. **Overrides from and to parameters.** - `skip`: The number of migration to skip. **Overrides only parameter.** -- `txConfirmations` : The number of confirmations to wait for after the transaction is mined. -- `verifyConfirmations` : The number of confirmations to wait for before sending a request to etherscan. -- `verify` : The strategy of verification. The user can choose between `immediately`, `at-the-end` and `none`. - - `immediately`: the verification will start immediately after the contract is deployed. However, the execution will wait `verifyConfirmations` number of blocks before sending a request to etherscan. - - `at-the-end`: the verification will start after all migrations are applied. - - `none`: the verification will not be performed. +- `wait` : The number of confirmations to wait for after the transaction is mined. +- `verify` : The flag indicating whether the contracts should be verified. - `attempts`: The number of attempts to verify the contract. - `pathToMigrations` : The path to the folder with the specified migrations. -- `skipVerificationErrors` : The user can specify custom verification errors that will be omitted and just be printed - to the log instead of stopping the program completely. - By default, if this parameter is not specified, the `already verified` error is omitted. - `force` : The flag indicating whether the contracts compilation is forced. -- `continuePreviousDeployment` : The flag indicating whether the deployment should restore the state from the previous deployment. +- `continue` : The flag indicating whether the deployment should restore the state from the previous deployment. ### Deploying @@ -117,7 +108,7 @@ You can set your own migrations and deploy the contracts to the network you want #### With only parameter ```console -npx hardhat migrate --network goerli --verify immediately --only 2 +npx hardhat migrate --network goerli --verify --only 2 ``` In this case, only the migration that begins with digit 2 will be applied. The plugin will also try to automatically verify the deployed contracts. diff --git a/src/index.ts b/src/index.ts index f0000a8..2427ec3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -60,14 +60,8 @@ task(TASK_MIGRATE, "Deploy contracts via migration files") types.int, ) .addOptionalParam("skip", "The number of migration to skip. Overrides only parameter.", undefined, types.int) + .addOptionalParam("wait", "The number of blocks to wait for the transaction to be mined.", undefined, types.int) .addFlag("verify", "The flag indicating whether the contracts should be verified.") - .addFlag("force", "The flag indicating whether the compilation is forced.") - .addOptionalParam( - "confirmations", - "The number defining after how many blocks the verification should start.", - undefined, - types.int, - ) .addOptionalParam("attempts", "The number of attempts to verify the contract.", undefined, types.int) .addOptionalParam( "pathToMigrations", @@ -75,5 +69,6 @@ task(TASK_MIGRATE, "Deploy contracts via migration files") undefined, types.string, ) + .addFlag("force", "The flag indicating whether the compilation is forced.") .addFlag("continue", "The flag indicating whether the previous deployment should be continued.") .setAction(migrate); From ddd7fbacb3494c773e802885320d60950b998e95 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Wed, 25 Oct 2023 11:56:59 +0200 Subject: [PATCH 06/36] fixed attempts ussage during verification --- src/verifier/Verifier.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/verifier/Verifier.ts b/src/verifier/Verifier.ts index 67fd7a7..8306bf7 100644 --- a/src/verifier/Verifier.ts +++ b/src/verifier/Verifier.ts @@ -35,6 +35,7 @@ export class Verifier { for (let attempts = 0; attempts < this._config.attempts; attempts++) { try { await this._tryVerify(instance, contractAddress, contractName, constructorArguments); + break; } catch (e: any) { this._handleVerificationError(contractAddress, contractName, e); } From db6bd22273130dcc88542796f2f58d2a041778f8 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Wed, 25 Oct 2023 19:23:26 +0200 Subject: [PATCH 07/36] drafts of verify task --- src/config.ts | 25 ++++++++++++++- src/constants.ts | 1 + src/index.ts | 32 ++++++++++++++++--- src/types/migrations.ts | 22 ++++++++++--- src/verifier/Verifier.ts | 17 ++++++---- .../hardhat.config.js | 4 +++ .../hardhat.config.js | 4 +++ test/integration/config.ts | 24 ++++++-------- 8 files changed, 99 insertions(+), 30 deletions(-) diff --git a/src/config.ts b/src/config.ts index b00b2e3..d253567 100644 --- a/src/config.ts +++ b/src/config.ts @@ -14,10 +14,13 @@ const defaultConfig: MigrateConfig = { skip: -1, wait: 1, verify: false, - attempts: 0, pathToMigrations: "./deploy", force: false, continue: false, + verifyConfig: { + parallel: 4, + attempts: 3, + }, }; export const migrateConfigExtender: ConfigExtender = (resolvedConfig, config) => { @@ -32,10 +35,30 @@ export const mergeConfigs = ( return defaultConfig; } + if ((config as any).parallel) { + (config.verifyConfig as any) ??= {}; + config.verifyConfig!.parallel ??= (config as any).parallel; + } + + if ((config as any).attempts) { + (config.verifyConfig as any) ??= {}; + config.verifyConfig!.attempts ??= (config as any).attempts; + } + if (config.wait && config.wait < 1) { throw new HardhatPluginError(pluginName, "config.migrate.wait must be greater than 0"); } + if (config.verifyConfig) { + if (config.verifyConfig.parallel && config.verifyConfig.parallel < 1) { + throw new HardhatPluginError(pluginName, "config.migrate.verifyConfig.parallel must be greater than 0"); + } + + if (config.verifyConfig.attempts && config.verifyConfig.attempts < 1) { + throw new HardhatPluginError(pluginName, "config.migrate.verifyConfig.attempts must be greater than 0"); + } + } + if (config.pathToMigrations && !isRelativePath(config.pathToMigrations)) { throw new HardhatPluginError(pluginName, "config.migrate.pathToMigrations must be a relative path"); } diff --git a/src/constants.ts b/src/constants.ts index 2c766d3..d50b9c7 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,2 +1,3 @@ export const pluginName = "@solarity/hardhat-migrate"; export const TASK_MIGRATE = "migrate"; +export const TASK_MIGRATE_VERIFY = "migrate:verify"; diff --git a/src/index.ts b/src/index.ts index 2427ec3..882cbc4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,14 +2,14 @@ import "@nomicfoundation/hardhat-ethers"; import "@nomicfoundation/hardhat-verify"; import { TASK_COMPILE } from "hardhat/builtin-tasks/task-names"; -import { extendConfig, extendEnvironment, task, types } from "hardhat/config"; +import { extendConfig, extendEnvironment, scope, types } from "hardhat/config"; import { lazyObject } from "hardhat/plugins"; import { ActionType } from "hardhat/types"; import "./type-extensions"; import { mergeConfigs, migrateConfigExtender } from "./config"; -import { TASK_MIGRATE } from "./constants"; +import { TASK_MIGRATE, TASK_MIGRATE_VERIFY } from "./constants"; import { Migrator } from "./migrator/Migrator"; import { Reporter } from "./tools/reporters/Reporter"; @@ -17,11 +17,15 @@ import { Reporter } from "./tools/reporters/Reporter"; import { ArtifactProcessor } from "./tools/storage/ArtifactProcessor"; import { DefaultStorage } from "./tools/storage/MigrateStorage"; -import { MigrateConfig } from "./types/migrations"; +import { VerificationProcessor } from "./tools/storage/VerificationProcessor"; +import { MigrateConfig, MigrateVerifyConfig } from "./types/migrations"; +import { Verifier } from "./verifier/Verifier"; export { Deployer } from "./deployer/Deployer"; export { Verifier } from "./verifier/Verifier"; +const migrateScope = scope("migrate", "Automatic deployment and verification of smart contracts"); + extendConfig(migrateConfigExtender); const migrate: ActionType = async (taskArgs, env) => { @@ -38,6 +42,18 @@ const migrate: ActionType = async (taskArgs, env) => { Reporter.init(env); await new Migrator(env).migrate(); + + if (env.config.migrate.verify) { + await env.run(TASK_MIGRATE_VERIFY); + } +}; + +const migrateVerify: ActionType = async (taskArgs, env) => { + env.config.migrate = mergeConfigs({ verify: true, verifyConfig: taskArgs }, env.config.migrate); + + Reporter.init(env); + + await new Verifier(env).verifyBatch(VerificationProcessor.restoreSavedVerificationFunctions()); }; extendEnvironment((hre) => { @@ -50,7 +66,8 @@ extendEnvironment((hre) => { // TODO: override the `clean` task -task(TASK_MIGRATE, "Deploy contracts via migration files") +migrateScope + .task(TASK_MIGRATE, "Deploy contracts via migration files") .addOptionalParam("from", "The migration number from which the migration will be applied.", undefined, types.int) .addOptionalParam("to", "The migration number up to which the migration will be applied.", undefined, types.int) .addOptionalParam( @@ -62,6 +79,7 @@ task(TASK_MIGRATE, "Deploy contracts via migration files") .addOptionalParam("skip", "The number of migration to skip. Overrides only parameter.", undefined, types.int) .addOptionalParam("wait", "The number of blocks to wait for the transaction to be mined.", undefined, types.int) .addFlag("verify", "The flag indicating whether the contracts should be verified.") + .addOptionalParam("parallel", "The size of the batch for verification.", undefined, types.int) .addOptionalParam("attempts", "The number of attempts to verify the contract.", undefined, types.int) .addOptionalParam( "pathToMigrations", @@ -72,3 +90,9 @@ task(TASK_MIGRATE, "Deploy contracts via migration files") .addFlag("force", "The flag indicating whether the compilation is forced.") .addFlag("continue", "The flag indicating whether the previous deployment should be continued.") .setAction(migrate); + +migrateScope + .task(TASK_MIGRATE_VERIFY, "Verify contracts via .storage") + .addOptionalParam("parallel", "The size of the batch for verification.", undefined, types.int) + .addOptionalParam("attempts", "The number of attempts to verify the contract.", undefined, types.int) + .setAction(migrateVerify); diff --git a/src/types/migrations.ts b/src/types/migrations.ts index 216d4e8..678299c 100644 --- a/src/types/migrations.ts +++ b/src/types/migrations.ts @@ -32,11 +32,6 @@ export interface MigrateConfig { */ verify: boolean; - /* - * The number of attempts to verify the contract. - */ - attempts: number; - /* * The path to the folder with the specified migrations. */ @@ -51,4 +46,21 @@ export interface MigrateConfig { * The flag indicating whether the previous deployment should be continued. */ continue: boolean; + + /* + * The parameters for the verification. + */ + verifyConfig: MigrateVerifyConfig; +} + +export interface MigrateVerifyConfig { + /* + * The size of the batch for verification. + */ + parallel: number; + + /* + * The number of attempts to verify the contract. + */ + attempts: number; } diff --git a/src/verifier/Verifier.ts b/src/verifier/Verifier.ts index 8306bf7..96df45e 100644 --- a/src/verifier/Verifier.ts +++ b/src/verifier/Verifier.ts @@ -32,7 +32,7 @@ export class Verifier { return; } - for (let attempts = 0; attempts < this._config.attempts; attempts++) { + for (let attempts = 0; attempts < this._config.verifyConfig.attempts; attempts++) { try { await this._tryVerify(instance, contractAddress, contractName, constructorArguments); break; @@ -50,11 +50,16 @@ export class Verifier { Reporter.reportVerificationBatchBegin(); - await Promise.all( - verifierButchArgs.map(async (args) => { - await this.verify(args); - }), - ); + const parallel = this._config.verifyConfig.parallel; + + for (let i = 0; i < verifierButchArgs.length; i += parallel) { + const batch = verifierButchArgs.slice(i, i + parallel); + await Promise.all( + batch.map((args) => { + this.verify(args); + }), + ); + } } @catchError diff --git a/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js b/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js index 650e929..01ffd3f 100644 --- a/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js +++ b/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js @@ -10,5 +10,9 @@ module.exports = { attempts: 2, wait: 2, pathToMigrations: "./deploy/", + verifyConfig: { + parallel: 4, + attempts: 5, + }, }, }; diff --git a/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js b/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js index 9f8152e..5b73bf9 100644 --- a/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js +++ b/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js @@ -4,5 +4,9 @@ module.exports = { migrate: { wait: 0, pathToMigrations: "/deploy", + verifyConfig: { + parallel: 0, + attempts: 0, + }, }, }; diff --git a/test/integration/config.ts b/test/integration/config.ts index 5d204a2..b564c70 100644 --- a/test/integration/config.ts +++ b/test/integration/config.ts @@ -39,7 +39,11 @@ describe("config", () => { }); it("should apply attempts", async function () { - assert.equal(loadedOptions.attempts, 2); + assert.equal(loadedOptions.verifyConfig.attempts, 5); + }); + + it("should apply parallel", async function () { + assert.equal(loadedOptions.verifyConfig.parallel, 4); }); it("should apply wait", async function () { @@ -69,18 +73,6 @@ describe("config", () => { resetHardhatContext(); }); - - it("should throw if wait is less than 1", async function () { - expect(() => { - const prefix = "hardhat-project-"; - process.chdir(join(__dirname, "../", "fixture-projects", prefix + fixtureProjectName)); - process.env.HARDHAT_NETWORK = "hardhat"; - - require("hardhat"); - }).to.throw(HardhatPluginError, "config.migrate.wait must be greater than 0"); - - resetHardhatContext(); - }); }); describe("extension", () => { @@ -117,7 +109,11 @@ describe("config", () => { }); it("should set to default attempts", async function () { - assert.equal(loadedOptions.attempts, 0); + assert.equal(loadedOptions.verifyConfig.attempts, 3); + }); + + it("should set to default parallel", async function () { + assert.equal(loadedOptions.verifyConfig.parallel, 4); }); it("should set to default wait", async function () { From 20739dd69a149e7d4fa2165a36afc83aafaf76b5 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Wed, 25 Oct 2023 22:12:49 +0200 Subject: [PATCH 08/36] added 'chainId' to verifier --- src/deployer/MinimalContract.ts | 1 + src/types/verifier.ts | 7 ++++++- src/verifier/Verifier.ts | 9 +++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/deployer/MinimalContract.ts b/src/deployer/MinimalContract.ts index 1908409..c8ccd0c 100644 --- a/src/deployer/MinimalContract.ts +++ b/src/deployer/MinimalContract.ts @@ -125,6 +125,7 @@ export class MinimalContract { contractAddress, contractName: tx.contractName, constructorArguments: args, + chainId: await getChainId(this._hre), }); return contractAddress; diff --git a/src/types/verifier.ts b/src/types/verifier.ts index eb237ad..77d0359 100644 --- a/src/types/verifier.ts +++ b/src/types/verifier.ts @@ -1,6 +1,11 @@ import { Args } from "./deployer"; -export type VerifierArgs = { contractAddress: string; contractName: string; constructorArguments: Args }; +export type VerifierArgs = { + contractAddress: string; + contractName: string; + constructorArguments: Args; + chainId: bigint; +}; export interface ChainRecord { name: string; diff --git a/src/verifier/Verifier.ts b/src/verifier/Verifier.ts index 96df45e..ffc6509 100644 --- a/src/verifier/Verifier.ts +++ b/src/verifier/Verifier.ts @@ -3,7 +3,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { Etherscan } from "@nomicfoundation/hardhat-verify/etherscan"; import { EtherscanConfig } from "@nomicfoundation/hardhat-verify/types"; -import { catchError, suppressLogs } from "../utils"; +import { catchError, getChainId, suppressLogs } from "../utils"; import { Args } from "../types/deployer"; import { MigrateConfig } from "../types/migrations"; @@ -22,7 +22,12 @@ export class Verifier { @catchError public async verify(verifierArgs: VerifierArgs): Promise { - const { contractAddress, contractName, constructorArguments } = verifierArgs; + const { contractAddress, contractName, constructorArguments, chainId } = verifierArgs; + + if ((await getChainId(this._hre)) !== chainId) { + // TODO: Add actions for this case. + return; + } const instance = await this._getEtherscanInstance(this._hre); From 928c704ef2bc289051f3bfe365bdfb329fb6cbb5 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Wed, 25 Oct 2023 22:17:08 +0200 Subject: [PATCH 09/36] deleting .storage if continiue == false --- src/index.ts | 6 +++++- src/tools/storage/MigrateStorage.ts | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 882cbc4..04596fc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,7 +15,7 @@ import { Migrator } from "./migrator/Migrator"; import { Reporter } from "./tools/reporters/Reporter"; import { ArtifactProcessor } from "./tools/storage/ArtifactProcessor"; -import { DefaultStorage } from "./tools/storage/MigrateStorage"; +import { DefaultStorage, MigrateStorage } from "./tools/storage/MigrateStorage"; import { VerificationProcessor } from "./tools/storage/VerificationProcessor"; import { MigrateConfig, MigrateVerifyConfig } from "./types/migrations"; @@ -37,6 +37,10 @@ const migrate: ActionType = async (taskArgs, env) => { force: env.config.migrate.force, }); + if (!env.config.migrate.continue) { + MigrateStorage.clearAll(); + } + await ArtifactProcessor.parseArtifacts(env); Reporter.init(env); diff --git a/src/tools/storage/MigrateStorage.ts b/src/tools/storage/MigrateStorage.ts index 853e4d0..88867ca 100644 --- a/src/tools/storage/MigrateStorage.ts +++ b/src/tools/storage/MigrateStorage.ts @@ -20,6 +20,12 @@ export class MigrateStorage { } } + public static clearAll(): void { + MigrateStorage._state = {}; + + MigrateStorage._saveStateToFile(); + } + public get(key: string): any { return MigrateStorage._state[this._namespace][key]; } From 90f76b09dbeeecbe4beb56b6764ada0a8ca7c806 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Wed, 25 Oct 2023 22:22:26 +0200 Subject: [PATCH 10/36] added 'contractAddress' as optimial parameter to deployed() --- src/deployer/Deployer.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts index 472859c..fb9e116 100644 --- a/src/deployer/Deployer.ts +++ b/src/deployer/Deployer.ts @@ -2,18 +2,18 @@ import { Signer } from "ethers"; import { HardhatRuntimeEnvironment } from "hardhat/types"; -import { catchError, getSignerHelper, getChainId } from "../utils"; +import { catchError, getChainId, getSignerHelper, isDeployedContractAddress } from "../utils"; import { MigrateError } from "../errors"; import { Adapter } from "./adapters/Adapter"; -import { PureAdapter } from "./adapters/PureAdapter"; import { EthersAdapter } from "./adapters/EthersAdapter"; -import { TruffleAdapter } from "./adapters/TruffleAdapter"; +import { PureAdapter } from "./adapters/PureAdapter"; import { PureEthersAdapter } from "./adapters/PureEthersAdapter"; +import { TruffleAdapter } from "./adapters/TruffleAdapter"; -import { OverridesAndLibs } from "../types/deployer"; import { Instance, TypedArgs } from "../types/adapter"; +import { OverridesAndLibs } from "../types/deployer"; import { isContractFactory, isEthersFactory, isPureFactory, isTruffleFactory } from "../types/type-checks"; import { TransactionProcessor } from "../tools/storage/TransactionProcessor"; @@ -36,11 +36,17 @@ export class Deployer { return adapter.toInstance(contract, contractAddress, parameters); } - public async deployed(contract: Instance): Promise { + public async deployed(contract: Instance, contractAddress?: string): Promise { const adapter = this._resolveAdapter(contract); - const contractName = adapter.getContractName(contract); - const contractAddress = await TransactionProcessor.tryRestoreContractAddressByName(contractName, this._hre); + if (contractAddress) { + if (!(await isDeployedContractAddress(this._hre, contractAddress))) { + throw new MigrateError(`Contract with address '${contractAddress}' is not deployed`); + } + } else { + const contractName = adapter.getContractName(contract); + contractAddress = await TransactionProcessor.tryRestoreContractAddressByName(contractName, this._hre); + } return adapter.toInstance(contract, contractAddress, {}); } From 00c7c63de23c9515fc039dba762395ed159f7fcd Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Thu, 26 Oct 2023 10:34:31 +0300 Subject: [PATCH 11/36] Review --- src/config.ts | 12 ++++++++---- src/index.ts | 5 +++-- src/verifier/Verifier.ts | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/config.ts b/src/config.ts index d253567..84cc8a2 100644 --- a/src/config.ts +++ b/src/config.ts @@ -17,10 +17,14 @@ const defaultConfig: MigrateConfig = { pathToMigrations: "./deploy", force: false, continue: false, - verifyConfig: { - parallel: 4, - attempts: 3, - }, + verifyParallel: 1, + verifyAttempts: 3, +}; + +const defaultVerifyConfig: MigrateConfig["verifyConfig"] = { + inputFile: ".storage.json", + parallel: 1, + attempts: 3, }; export const migrateConfigExtender: ConfigExtender = (resolvedConfig, config) => { diff --git a/src/index.ts b/src/index.ts index 04596fc..bfa0b10 100644 --- a/src/index.ts +++ b/src/index.ts @@ -83,8 +83,8 @@ migrateScope .addOptionalParam("skip", "The number of migration to skip. Overrides only parameter.", undefined, types.int) .addOptionalParam("wait", "The number of blocks to wait for the transaction to be mined.", undefined, types.int) .addFlag("verify", "The flag indicating whether the contracts should be verified.") - .addOptionalParam("parallel", "The size of the batch for verification.", undefined, types.int) - .addOptionalParam("attempts", "The number of attempts to verify the contract.", undefined, types.int) + .addOptionalParam("verifyParallel", "The size of the batch for verification.", undefined, types.int) + .addOptionalParam("verifyAttempts", "The number of attempts to verify the contract.", undefined, types.int) .addOptionalParam( "pathToMigrations", "The path to the folder with the specified migrations.", @@ -97,6 +97,7 @@ migrateScope migrateScope .task(TASK_MIGRATE_VERIFY, "Verify contracts via .storage") + .addOptionalParam("inputJSON", "The path to the .storage file.", undefined, types.string) .addOptionalParam("parallel", "The size of the batch for verification.", undefined, types.int) .addOptionalParam("attempts", "The number of attempts to verify the contract.", undefined, types.int) .setAction(migrateVerify); diff --git a/src/verifier/Verifier.ts b/src/verifier/Verifier.ts index ffc6509..8c94a03 100644 --- a/src/verifier/Verifier.ts +++ b/src/verifier/Verifier.ts @@ -55,7 +55,7 @@ export class Verifier { Reporter.reportVerificationBatchBegin(); - const parallel = this._config.verifyConfig.parallel; + const parallel = this._config.migrateVerify; for (let i = 0; i < verifierButchArgs.length; i += parallel) { const batch = verifierButchArgs.slice(i, i + parallel); From 5d3e0f6c42664f66f041625adfcc24deb55d9298 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Thu, 26 Oct 2023 13:26:24 +0200 Subject: [PATCH 12/36] fixed verify task --- src/config.ts | 49 ++++++++++++---------- src/deployer/MinimalContract.ts | 5 ++- src/index.ts | 12 +++--- src/migrator/Migrator.ts | 5 ++- src/tools/storage/VerificationProcessor.ts | 12 +++++- src/types/migrations.ts | 24 ++++++++--- src/types/verifier.ts | 2 +- src/verifier/Verifier.ts | 19 ++++----- test/integration/config.ts | 8 ++-- 9 files changed, 82 insertions(+), 54 deletions(-) diff --git a/src/config.ts b/src/config.ts index 84cc8a2..dfa55cf 100644 --- a/src/config.ts +++ b/src/config.ts @@ -5,7 +5,7 @@ import { ConfigExtender } from "hardhat/types"; import { pluginName } from "./constants"; -import { MigrateConfig } from "./types/migrations"; +import { MigrateConfig, MigrateVerifyConfig } from "./types/migrations"; const defaultConfig: MigrateConfig = { from: -1, @@ -14,14 +14,14 @@ const defaultConfig: MigrateConfig = { skip: -1, wait: 1, verify: false, + verifyParallel: 1, + verifyAttempts: 3, pathToMigrations: "./deploy", force: false, continue: false, - verifyParallel: 1, - verifyAttempts: 3, }; -const defaultVerifyConfig: MigrateConfig["verifyConfig"] = { +const defaultVerifyConfig: MigrateVerifyConfig = { inputFile: ".storage.json", parallel: 1, attempts: 3, @@ -39,28 +39,16 @@ export const mergeConfigs = ( return defaultConfig; } - if ((config as any).parallel) { - (config.verifyConfig as any) ??= {}; - config.verifyConfig!.parallel ??= (config as any).parallel; - } - - if ((config as any).attempts) { - (config.verifyConfig as any) ??= {}; - config.verifyConfig!.attempts ??= (config as any).attempts; - } - if (config.wait && config.wait < 1) { throw new HardhatPluginError(pluginName, "config.migrate.wait must be greater than 0"); } - if (config.verifyConfig) { - if (config.verifyConfig.parallel && config.verifyConfig.parallel < 1) { - throw new HardhatPluginError(pluginName, "config.migrate.verifyConfig.parallel must be greater than 0"); - } + if (config.verifyParallel && config.verifyParallel < 1) { + throw new HardhatPluginError(pluginName, "config.migrate.verifyParallel must be greater than 0"); + } - if (config.verifyConfig.attempts && config.verifyConfig.attempts < 1) { - throw new HardhatPluginError(pluginName, "config.migrate.verifyConfig.attempts must be greater than 0"); - } + if (config.verifyAttempts && config.verifyAttempts < 1) { + throw new HardhatPluginError(pluginName, "config.migrate.verifyAttempts must be greater than 0"); } if (config.pathToMigrations && !isRelativePath(config.pathToMigrations)) { @@ -70,7 +58,22 @@ export const mergeConfigs = ( return { ...defaultConfig, ...definedProps(config) }; }; -const definedProps = (obj: Partial): Partial => - Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined)) as Partial; +export const extendVerifyConfigs = (config: Partial | undefined): MigrateVerifyConfig => { + if (config === undefined) { + return defaultVerifyConfig; + } + + if (config.parallel && config.parallel < 1) { + throw new HardhatPluginError(pluginName, "parallel must be greater than 0"); + } + + if (config.attempts && config.attempts < 1) { + throw new HardhatPluginError(pluginName, "attempts must be greater than 0"); + } + + return { ...defaultVerifyConfig, ...definedProps(config) }; +}; + +const definedProps = (obj: any): any => Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined)); const isRelativePath = (path?: string): boolean => path === undefined || !isAbsolute(path); diff --git a/src/deployer/MinimalContract.ts b/src/deployer/MinimalContract.ts index c8ccd0c..32c57a1 100644 --- a/src/deployer/MinimalContract.ts +++ b/src/deployer/MinimalContract.ts @@ -30,7 +30,10 @@ export class MinimalContract { private readonly _contractName: string = "", ) { this._config = _hre.config.migrate; - this._verifier = new Verifier(_hre); + this._verifier = new Verifier(_hre, { + parallel: this._config.verifyParallel, + attempts: this._config.verifyAttempts, + }); if (_contractName === "") { try { diff --git a/src/index.ts b/src/index.ts index bfa0b10..ffc2d70 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,7 +8,7 @@ import { ActionType } from "hardhat/types"; import "./type-extensions"; -import { mergeConfigs, migrateConfigExtender } from "./config"; +import { extendVerifyConfigs, mergeConfigs, migrateConfigExtender } from "./config"; import { TASK_MIGRATE, TASK_MIGRATE_VERIFY } from "./constants"; import { Migrator } from "./migrator/Migrator"; @@ -26,9 +26,9 @@ export { Verifier } from "./verifier/Verifier"; const migrateScope = scope("migrate", "Automatic deployment and verification of smart contracts"); -extendConfig(migrateConfigExtender); - const migrate: ActionType = async (taskArgs, env) => { + extendConfig(migrateConfigExtender); + env.config.migrate = mergeConfigs(taskArgs, env.config.migrate); // Make sure that contract artifacts are up-to-date. @@ -53,11 +53,11 @@ const migrate: ActionType = async (taskArgs, env) => { }; const migrateVerify: ActionType = async (taskArgs, env) => { - env.config.migrate = mergeConfigs({ verify: true, verifyConfig: taskArgs }, env.config.migrate); + taskArgs = extendVerifyConfigs(taskArgs); Reporter.init(env); - await new Verifier(env).verifyBatch(VerificationProcessor.restoreSavedVerificationFunctions()); + await new Verifier(env, taskArgs).verifyBatch(VerificationProcessor.restoreSavedVerificationFunctions()); }; extendEnvironment((hre) => { @@ -97,7 +97,7 @@ migrateScope migrateScope .task(TASK_MIGRATE_VERIFY, "Verify contracts via .storage") - .addOptionalParam("inputJSON", "The path to the .storage file.", undefined, types.string) + .addOptionalParam("inputJSON", "The path to the .storage file.", undefined, types.inputFile) .addOptionalParam("parallel", "The size of the batch for verification.", undefined, types.int) .addOptionalParam("attempts", "The number of attempts to verify the contract.", undefined, types.int) .setAction(migrateVerify); diff --git a/src/migrator/Migrator.ts b/src/migrator/Migrator.ts index e0dfbb5..d194bf4 100644 --- a/src/migrator/Migrator.ts +++ b/src/migrator/Migrator.ts @@ -29,7 +29,10 @@ export class Migrator { private _config: MigrateConfig = _hre.config.migrate, ) { this._deployer = new Deployer(_hre); - this._verifier = new Verifier(_hre); + this._verifier = new Verifier(_hre, { + parallel: this._config.verifyParallel, + attempts: this._config.verifyAttempts, + }); this._migrationFiles = this._getMigrationFiles(); } diff --git a/src/tools/storage/VerificationProcessor.ts b/src/tools/storage/VerificationProcessor.ts index e972b93..e746f27 100644 --- a/src/tools/storage/VerificationProcessor.ts +++ b/src/tools/storage/VerificationProcessor.ts @@ -1,3 +1,5 @@ +import { readFileSync } from "fs"; + import { VerificationStorage } from "./MigrateStorage"; import { catchError } from "../../utils"; @@ -12,7 +14,15 @@ export class VerificationProcessor { VerificationStorage.set(key, verifierArgs, true); } - public static restoreSavedVerificationFunctions(): VerifierArgs[] { + public static restoreSavedVerificationFunctions(filePath?: string): VerifierArgs[] { + if (filePath) { + const fileContent = readFileSync(filePath, { + encoding: "utf8", + }); + + return JSON.parse(fileContent); + } + const data = VerificationStorage.getAll() as Record; return Object.values(data); diff --git a/src/types/migrations.ts b/src/types/migrations.ts index 678299c..f783220 100644 --- a/src/types/migrations.ts +++ b/src/types/migrations.ts @@ -32,6 +32,16 @@ export interface MigrateConfig { */ verify: boolean; + /* + * The size of the batch for verification. + */ + verifyParallel: number; + + /* + * The number of attempts to verify the contract. + */ + verifyAttempts: number; + /* * The path to the folder with the specified migrations. */ @@ -46,14 +56,9 @@ export interface MigrateConfig { * The flag indicating whether the previous deployment should be continued. */ continue: boolean; - - /* - * The parameters for the verification. - */ - verifyConfig: MigrateVerifyConfig; } -export interface MigrateVerifyConfig { +export interface VerifyConfig { /* * The size of the batch for verification. */ @@ -64,3 +69,10 @@ export interface MigrateVerifyConfig { */ attempts: number; } + +export interface MigrateVerifyConfig extends VerifyConfig { + /* + * The path to the file with the verification input. + */ + inputFile: string; +} diff --git a/src/types/verifier.ts b/src/types/verifier.ts index 77d0359..cac1d4e 100644 --- a/src/types/verifier.ts +++ b/src/types/verifier.ts @@ -4,7 +4,7 @@ export type VerifierArgs = { contractAddress: string; contractName: string; constructorArguments: Args; - chainId: bigint; + chainId?: bigint; }; export interface ChainRecord { diff --git a/src/verifier/Verifier.ts b/src/verifier/Verifier.ts index 8c94a03..b324ed5 100644 --- a/src/verifier/Verifier.ts +++ b/src/verifier/Verifier.ts @@ -6,17 +6,18 @@ import { EtherscanConfig } from "@nomicfoundation/hardhat-verify/types"; import { catchError, getChainId, suppressLogs } from "../utils"; import { Args } from "../types/deployer"; -import { MigrateConfig } from "../types/migrations"; +import { VerifyConfig } from "../types/migrations"; import { VerifierArgs } from "../types/verifier"; import { Reporter } from "../tools/reporters/Reporter"; export class Verifier { - private readonly _config: MigrateConfig; private readonly _etherscanConfig: EtherscanConfig; - constructor(private _hre: HardhatRuntimeEnvironment) { - this._config = _hre.config.migrate; + constructor( + private _hre: HardhatRuntimeEnvironment, + private _config: VerifyConfig, + ) { this._etherscanConfig = (_hre.config as any).etherscan; } @@ -24,7 +25,7 @@ export class Verifier { public async verify(verifierArgs: VerifierArgs): Promise { const { contractAddress, contractName, constructorArguments, chainId } = verifierArgs; - if ((await getChainId(this._hre)) !== chainId) { + if (chainId && (await getChainId(this._hre)) !== chainId) { // TODO: Add actions for this case. return; } @@ -37,7 +38,7 @@ export class Verifier { return; } - for (let attempts = 0; attempts < this._config.verifyConfig.attempts; attempts++) { + for (let attempts = 0; attempts < this._config.attempts; attempts++) { try { await this._tryVerify(instance, contractAddress, contractName, constructorArguments); break; @@ -49,13 +50,9 @@ export class Verifier { @catchError public async verifyBatch(verifierButchArgs: VerifierArgs[]) { - if (!this._config.verify) { - return; - } - Reporter.reportVerificationBatchBegin(); - const parallel = this._config.migrateVerify; + const parallel = this._config.parallel; for (let i = 0; i < verifierButchArgs.length; i += parallel) { const batch = verifierButchArgs.slice(i, i + parallel); diff --git a/test/integration/config.ts b/test/integration/config.ts index b564c70..f8033fc 100644 --- a/test/integration/config.ts +++ b/test/integration/config.ts @@ -39,11 +39,11 @@ describe("config", () => { }); it("should apply attempts", async function () { - assert.equal(loadedOptions.verifyConfig.attempts, 5); + assert.equal(loadedOptions.verifyAttempts, 5); }); it("should apply parallel", async function () { - assert.equal(loadedOptions.verifyConfig.parallel, 4); + assert.equal(loadedOptions.verifyParallel, 4); }); it("should apply wait", async function () { @@ -109,11 +109,11 @@ describe("config", () => { }); it("should set to default attempts", async function () { - assert.equal(loadedOptions.verifyConfig.attempts, 3); + assert.equal(loadedOptions.verifyAttempts, 3); }); it("should set to default parallel", async function () { - assert.equal(loadedOptions.verifyConfig.parallel, 4); + assert.equal(loadedOptions.verifyParallel, 4); }); it("should set to default wait", async function () { From cd58040ad51fc27bc70055dd578ad3d2a55006cd Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Thu, 26 Oct 2023 14:16:15 +0200 Subject: [PATCH 13/36] applied wait for reporter --- src/tools/reporters/Reporter.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/tools/reporters/Reporter.ts b/src/tools/reporters/Reporter.ts index d1824d4..925d673 100644 --- a/src/tools/reporters/Reporter.ts +++ b/src/tools/reporters/Reporter.ts @@ -1,7 +1,7 @@ /* eslint-disable no-console */ -import ora from "ora"; import axios from "axios"; import BigNumber from "bignumber.js"; +import ora from "ora"; import { Network, TransactionReceipt, TransactionResponse } from "ethers"; @@ -68,19 +68,16 @@ export class Reporter { 1000, ); - const wait = tx.wait(); - - wait.finally(() => { - clearInterval(spinnerInterval); - - spinner.stop(); - }); - - let receipt; + let receipt: TransactionReceipt; try { - receipt = (await wait)!; + // We will wait for both contract deployment and common transactions + receipt = (await tx.wait(this._hre.config.migrate.wait))!; } catch (e: any) { throw new MigrateError(`Transaction failed: ${e.message}`); + } finally { + clearInterval(spinnerInterval); + + spinner.stop(); } await this._printTransaction(receipt); From 5e947cdbf7aac65097bc161dab4ab3839634dbe3 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Thu, 26 Oct 2023 15:09:09 +0200 Subject: [PATCH 14/36] fixed scope --- src/index.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/index.ts b/src/index.ts index ffc2d70..93087be 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,7 @@ import "@nomicfoundation/hardhat-ethers"; import "@nomicfoundation/hardhat-verify"; import { TASK_COMPILE } from "hardhat/builtin-tasks/task-names"; -import { extendConfig, extendEnvironment, scope, types } from "hardhat/config"; +import { extendConfig, extendEnvironment, task, types } from "hardhat/config"; import { lazyObject } from "hardhat/plugins"; import { ActionType } from "hardhat/types"; @@ -24,8 +24,6 @@ import { Verifier } from "./verifier/Verifier"; export { Deployer } from "./deployer/Deployer"; export { Verifier } from "./verifier/Verifier"; -const migrateScope = scope("migrate", "Automatic deployment and verification of smart contracts"); - const migrate: ActionType = async (taskArgs, env) => { extendConfig(migrateConfigExtender); @@ -69,9 +67,7 @@ extendEnvironment((hre) => { }); // TODO: override the `clean` task - -migrateScope - .task(TASK_MIGRATE, "Deploy contracts via migration files") +task(TASK_MIGRATE, "Deploy contracts via migration files") .addOptionalParam("from", "The migration number from which the migration will be applied.", undefined, types.int) .addOptionalParam("to", "The migration number up to which the migration will be applied.", undefined, types.int) .addOptionalParam( @@ -95,8 +91,7 @@ migrateScope .addFlag("continue", "The flag indicating whether the previous deployment should be continued.") .setAction(migrate); -migrateScope - .task(TASK_MIGRATE_VERIFY, "Verify contracts via .storage") +task(TASK_MIGRATE_VERIFY, "Verify contracts via .storage") .addOptionalParam("inputJSON", "The path to the .storage file.", undefined, types.inputFile) .addOptionalParam("parallel", "The size of the batch for verification.", undefined, types.int) .addOptionalParam("attempts", "The number of attempts to verify the contract.", undefined, types.int) From 9882f20a17097038989f3873f0a588f02ce300c9 Mon Sep 17 00:00:00 2001 From: RuslanProgrammer <55411970+RuslanProgrammer@users.noreply.github.com> Date: Fri, 27 Oct 2023 10:35:14 +0200 Subject: [PATCH 15/36] added Handler inception to contracts factory (#41) * added Handler inception to contracts factory * fixed naming * implemented class AbstractEthersAdapter * added features * changed own function to libs * fixed intergration of Reporter to Truffle objects --- package-lock.json | 31 +++++++++- package.json | 3 +- src/deployer/Deployer.ts | 23 ++++++-- src/deployer/Linker.ts | 2 + ...jectHelper.ts => AbstractEthersAdapter.ts} | 51 +++++++++++++--- src/deployer/adapters/EthersAdapter.ts | 59 +++++-------------- src/deployer/adapters/PureAdapter.ts | 48 +++------------ src/deployer/adapters/PureEthersAdapter.ts | 54 +++++------------ src/deployer/adapters/TruffleAdapter.ts | 32 +++++++--- src/index.ts | 22 ++++++- src/tools/reporters/Reporter.ts | 11 +--- src/tools/storage/TransactionProcessor.ts | 4 ++ src/utils.ts | 18 +++--- 13 files changed, 192 insertions(+), 166 deletions(-) rename src/deployer/adapters/{EthersInjectHelper.ts => AbstractEthersAdapter.ts} (69%) diff --git a/package-lock.json b/package-lock.json index 23cab14..b8c0780 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,6 @@ "@nomicfoundation/hardhat-verify": "1.1.1", "@nomiclabs/hardhat-truffle5": "2.0.7", "axios": "1.5.0", - "bignumber.js": "9.1.2", "ora": "5.4.1" }, "devDependencies": { @@ -35,7 +34,7 @@ "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-promise": "^6.1.1", - "ethers": "^6.7.1", + "ethers": "^6.8.0", "hardhat": "^2.17.0", "mocha": "^10.0.0", "pinst": "^3.0.0", @@ -5491,6 +5490,7 @@ "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", "integrity": "sha512-DnhQwcFEaYsvYDnACLZhMmCWd3rkOeEvglpa4q5i/5Jlm3UIsWaxVzuXvDLFCSCWRO3yy2/+V/G7FusFgejnfQ==", "dev": true, + "optional": true, "peer": true, "dependencies": { "buffer": "^6.0.3", @@ -5523,6 +5523,7 @@ "url": "https://feross.org/support" } ], + "optional": true, "peer": true, "dependencies": { "base64-js": "^1.3.1", @@ -5534,6 +5535,7 @@ "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", "dev": true, + "optional": true, "peer": true, "engines": { "node": ">=10" @@ -6387,6 +6389,7 @@ "version": "9.1.2", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "dev": true, "engines": { "node": "*" } @@ -7995,6 +7998,7 @@ "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.4.1.tgz", "integrity": "sha512-r4eRSeStEGf6M5SKdrQhhLK5bOwOBxQhIE3YSTnZE3GpKiLfnnhE+tPtrJE79+eDJgm39BM6LSoI8SCx4HbwlQ==", "dev": true, + "optional": true, "peer": true, "engines": { "node": ">=6" @@ -14322,6 +14326,7 @@ "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz", "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==", "dev": true, + "optional": true, "peer": true }, "node_modules/immutable": { @@ -15129,6 +15134,7 @@ "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", "dev": true, + "optional": true, "peer": true, "dependencies": { "catering": "^2.1.0" @@ -15299,6 +15305,7 @@ "integrity": "sha512-iB8O/7Db9lPaITU1aA2txU/cBEXAt4vWwKQRrrWuS6XDgbP4QZGj9BL2aNbwb002atoQ/lIotJkfyzz+ygQnUQ==", "dev": true, "hasInstallScript": true, + "optional": true, "peer": true, "dependencies": { "abstract-leveldown": "~6.2.1", @@ -15314,6 +15321,7 @@ "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", "dev": true, + "optional": true, "peer": true, "dependencies": { "buffer": "^5.5.0", @@ -15331,6 +15339,7 @@ "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", "dev": true, + "optional": true, "peer": true, "engines": { "node": ">=6" @@ -15341,6 +15350,7 @@ "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", "dev": true, + "optional": true, "peer": true, "dependencies": { "xtend": "^4.0.2" @@ -15354,6 +15364,7 @@ "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", "dev": true, + "optional": true, "peer": true }, "node_modules/leveldown/node_modules/node-gyp-build": { @@ -15361,6 +15372,7 @@ "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.1.1.tgz", "integrity": "sha512-dSq1xmcPDKPZ2EED2S6zw/b9NKsqzXRE6dVr8TVQnI3FJOTteUMuqF3Qqs6LZg+mLGYJWqQzMbIjMtJqTv87nQ==", "dev": true, + "optional": true, "peer": true, "bin": { "node-gyp-build": "bin.js", @@ -25475,6 +25487,7 @@ "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", "integrity": "sha512-DnhQwcFEaYsvYDnACLZhMmCWd3rkOeEvglpa4q5i/5Jlm3UIsWaxVzuXvDLFCSCWRO3yy2/+V/G7FusFgejnfQ==", "dev": true, + "optional": true, "peer": true, "requires": { "buffer": "^6.0.3", @@ -25490,6 +25503,7 @@ "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "dev": true, + "optional": true, "peer": true, "requires": { "base64-js": "^1.3.1", @@ -25501,6 +25515,7 @@ "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", "dev": true, + "optional": true, "peer": true } } @@ -26148,7 +26163,8 @@ "bignumber.js": { "version": "9.1.2", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", - "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==" + "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "dev": true }, "binary-extensions": { "version": "2.2.0", @@ -27413,6 +27429,7 @@ "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.4.1.tgz", "integrity": "sha512-r4eRSeStEGf6M5SKdrQhhLK5bOwOBxQhIE3YSTnZE3GpKiLfnnhE+tPtrJE79+eDJgm39BM6LSoI8SCx4HbwlQ==", "dev": true, + "optional": true, "peer": true }, "emoji-regex": { @@ -32434,6 +32451,7 @@ "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz", "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==", "dev": true, + "optional": true, "peer": true }, "immutable": { @@ -33013,6 +33031,7 @@ "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", "dev": true, + "optional": true, "peer": true, "requires": { "catering": "^2.1.0" @@ -33145,6 +33164,7 @@ "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-5.6.0.tgz", "integrity": "sha512-iB8O/7Db9lPaITU1aA2txU/cBEXAt4vWwKQRrrWuS6XDgbP4QZGj9BL2aNbwb002atoQ/lIotJkfyzz+ygQnUQ==", "dev": true, + "optional": true, "peer": true, "requires": { "abstract-leveldown": "~6.2.1", @@ -33157,6 +33177,7 @@ "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", "dev": true, + "optional": true, "peer": true, "requires": { "buffer": "^5.5.0", @@ -33171,6 +33192,7 @@ "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", "dev": true, + "optional": true, "peer": true }, "level-supports": { @@ -33178,6 +33200,7 @@ "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", "dev": true, + "optional": true, "peer": true, "requires": { "xtend": "^4.0.2" @@ -33188,6 +33211,7 @@ "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", "dev": true, + "optional": true, "peer": true }, "node-gyp-build": { @@ -33195,6 +33219,7 @@ "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.1.1.tgz", "integrity": "sha512-dSq1xmcPDKPZ2EED2S6zw/b9NKsqzXRE6dVr8TVQnI3FJOTteUMuqF3Qqs6LZg+mLGYJWqQzMbIjMtJqTv87nQ==", "dev": true, + "optional": true, "peer": true } } diff --git a/package.json b/package.json index 889dfe6..6741b96 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "@nomicfoundation/hardhat-verify": "1.1.1", "@nomiclabs/hardhat-truffle5": "2.0.7", "axios": "1.5.0", - "bignumber.js": "9.1.2", "ora": "5.4.1" }, "peerDependencies": { @@ -69,7 +68,7 @@ "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-promise": "^6.1.1", - "ethers": "^6.7.1", + "ethers": "^6.8.0", "hardhat": "^2.17.0", "mocha": "^10.0.0", "pinst": "^3.0.0", diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts index 472859c..e5e194a 100644 --- a/src/deployer/Deployer.ts +++ b/src/deployer/Deployer.ts @@ -2,18 +2,18 @@ import { Signer } from "ethers"; import { HardhatRuntimeEnvironment } from "hardhat/types"; -import { catchError, getSignerHelper, getChainId } from "../utils"; +import { catchError, getChainId, getSignerHelper } from "../utils"; import { MigrateError } from "../errors"; import { Adapter } from "./adapters/Adapter"; -import { PureAdapter } from "./adapters/PureAdapter"; import { EthersAdapter } from "./adapters/EthersAdapter"; -import { TruffleAdapter } from "./adapters/TruffleAdapter"; +import { PureAdapter } from "./adapters/PureAdapter"; import { PureEthersAdapter } from "./adapters/PureEthersAdapter"; +import { TruffleAdapter } from "./adapters/TruffleAdapter"; -import { OverridesAndLibs } from "../types/deployer"; import { Instance, TypedArgs } from "../types/adapter"; +import { OverridesAndLibs } from "../types/deployer"; import { isContractFactory, isEthersFactory, isPureFactory, isTruffleFactory } from "../types/type-checks"; import { TransactionProcessor } from "../tools/storage/TransactionProcessor"; @@ -36,7 +36,20 @@ export class Deployer { return adapter.toInstance(contract, contractAddress, parameters); } - public async deployed(contract: Instance): Promise { + public setAsDeployed( + contract: Instance | (T extends Truffle.Contract ? T : never), + address: string, + ): void { + const adapter = this._resolveAdapter(contract); + + const contractName = adapter.getContractName(contract); + + TransactionProcessor.saveDeploymentTransactionWithContractName(contractName, address); + } + + public async deployed( + contract: Instance | (T extends Truffle.Contract ? T : never), + ): Promise { const adapter = this._resolveAdapter(contract); const contractName = adapter.getContractName(contract); diff --git a/src/deployer/Linker.ts b/src/deployer/Linker.ts index 664a830..7209ffe 100644 --- a/src/deployer/Linker.ts +++ b/src/deployer/Linker.ts @@ -166,6 +166,8 @@ export class Linker { } catch { const artifact = this._mustGetLibraryArtifact(libraryName); + // https://github.com/ethers-io/ethers.js/issues/2431 + // https://github.com/ethers-io/ethers.js/issues/1126 const core = new MinimalContract(hre, artifact.bytecode, Interface.from(artifact.abi), libraryName); Reporter.notifyDeploymentOfMissingLibrary(libraryName); diff --git a/src/deployer/adapters/EthersInjectHelper.ts b/src/deployer/adapters/AbstractEthersAdapter.ts similarity index 69% rename from src/deployer/adapters/EthersInjectHelper.ts rename to src/deployer/adapters/AbstractEthersAdapter.ts index fffc516..240c810 100644 --- a/src/deployer/adapters/EthersInjectHelper.ts +++ b/src/deployer/adapters/AbstractEthersAdapter.ts @@ -1,6 +1,7 @@ import { BaseContract, BaseContractMethod, + ContractFactory, ContractTransaction, ContractTransactionResponse, defineProperties, @@ -10,19 +11,53 @@ import { import { HardhatRuntimeEnvironment } from "hardhat/types"; -import { fillParameters, getMethodString } from "../../utils"; +import { Adapter } from "./Adapter"; -import { MigrateConfig } from "../../types/migrations"; +import { bytecodeToString, fillParameters, getMethodString, getSignerHelper } from "../../utils"; + +import { EthersFactory, PureFactory } from "../../types/adapter"; import { OverridesAndLibs } from "../../types/deployer"; import { Reporter } from "../../tools/reporters/Reporter"; import { TransactionProcessor } from "../../tools/storage/TransactionProcessor"; +import { MinimalContract } from "../MinimalContract"; + +type Factory = EthersFactory | PureFactory | ContractFactory; -export class EthersInjectHelper { - protected _config: MigrateConfig; +export abstract class AbstractEthersAdapter extends Adapter { + private static _processedClasses = new Set(); - constructor(private _hre: HardhatRuntimeEnvironment) { - this._config = _hre.config.migrate; + constructor(_hre: HardhatRuntimeEnvironment) { + super(_hre); + } + + public getRawBytecode(instance: Factory): string { + return bytecodeToString(instance.bytecode); + } + + public async fromInstance(instance: Factory): Promise { + return new MinimalContract( + this._hre, + this.getRawBytecode(instance), + this.getInterface(instance), + this.getContractName(instance), + ); + } + + public async toInstance(instance: Factory, address: string, parameters: OverridesAndLibs): Promise { + const signer = await getSignerHelper(this._hre, parameters.from); + + const contract = new BaseContract(address, this.getInterface(instance), signer); + + const contractName = this.getContractName(instance); + + if (!AbstractEthersAdapter._processedClasses.has(contractName)) { + AbstractEthersAdapter._processedClasses.add(contractName); + + this.overrideConnectMethod(instance, contractName); + } + + return this.insertHandlers(contract, contractName, parameters) as unknown as I; } public insertHandlers(contract: BaseContract, contractName: string, parameters: OverridesAndLibs): BaseContract { @@ -65,6 +100,8 @@ export class EthersInjectHelper { return contract; } + public abstract overrideConnectMethod(instance: Factory, contractName: string): Promise; + private _getContractFunctionFragments(contractInterface: Interface): FunctionFragment[] { const result: FunctionFragment[] = []; @@ -76,8 +113,8 @@ export class EthersInjectHelper { } private _wrapOldMethod( - methodName: string, contractName: string, + methodName: string, methodFragments: FunctionFragment, oldMethod: BaseContractMethod, parameters: OverridesAndLibs, diff --git a/src/deployer/adapters/EthersAdapter.ts b/src/deployer/adapters/EthersAdapter.ts index 6dde7c7..58a69cb 100644 --- a/src/deployer/adapters/EthersAdapter.ts +++ b/src/deployer/adapters/EthersAdapter.ts @@ -1,57 +1,18 @@ -import { Interface, BaseContract } from "ethers"; +import { BaseContract, ContractRunner, Interface } from "ethers"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; - -import { Adapter } from "./Adapter"; -import { EthersInjectHelper } from "./EthersInjectHelper"; - -import { MinimalContract } from "../MinimalContract"; - -import { bytecodeToString, catchError, getSignerHelper } from "../../utils"; +import { catchError, getSignerHelper } from "../../utils"; import { EthersFactory } from "../../types/adapter"; -import { OverridesAndLibs } from "../../types/deployer"; import { ArtifactProcessor } from "../../tools/storage/ArtifactProcessor"; +import { AbstractEthersAdapter } from "./AbstractEthersAdapter"; @catchError -export class EthersAdapter extends Adapter { - private _injectHelper: EthersInjectHelper; - - constructor(_hre: HardhatRuntimeEnvironment) { - super(_hre); - this._injectHelper = new EthersInjectHelper(_hre); - } - - public async fromInstance(instance: EthersFactory): Promise { - return new MinimalContract( - this._hre, - this.getRawBytecode(instance), - this.getInterface(instance), - this.getContractName(instance), - ); - } - - public async toInstance( - instance: EthersFactory, - address: string, - parameters: OverridesAndLibs, - ): Promise { - const signer = await getSignerHelper(this._hre, parameters.from); - - const contract = new BaseContract(address, this.getInterface(instance), signer); - - return this._injectHelper.insertHandlers(contract, this.getContractName(instance), parameters) as unknown as I; - } - +export class EthersAdapter extends AbstractEthersAdapter { public getInterface(instance: EthersFactory): Interface { return Interface.from(instance.abi); } - public getRawBytecode(instance: EthersFactory): string { - return bytecodeToString(instance.bytecode); - } - public getContractName(instance: EthersFactory): string { try { return ArtifactProcessor.tryGetContractName(this.getRawBytecode(instance)); @@ -59,4 +20,16 @@ export class EthersAdapter extends Adapter { return "Unknown Contract"; } } + + public async overrideConnectMethod(instance: EthersFactory, contractName: string) { + const connectMethod = instance.connect; + + const defaultRunner = await getSignerHelper(this._hre); + + instance.connect = (address: string, runner?: ContractRunner): I => { + const contract = connectMethod(address, runner ?? defaultRunner) as BaseContract; + + return this.insertHandlers(contract, contractName, {}) as unknown as I; + }; + } } diff --git a/src/deployer/adapters/PureAdapter.ts b/src/deployer/adapters/PureAdapter.ts index ebba893..1f40ff3 100644 --- a/src/deployer/adapters/PureAdapter.ts +++ b/src/deployer/adapters/PureAdapter.ts @@ -1,52 +1,22 @@ -import { BaseContract, Interface } from "ethers"; +import { Interface } from "ethers"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; - -import { Adapter } from "./Adapter"; -import { EthersInjectHelper } from "./EthersInjectHelper"; - -import { MinimalContract } from "../MinimalContract"; - -import { bytecodeToString, catchError, getSignerHelper } from "../../utils"; +import { catchError } from "../../utils"; import { PureFactory } from "../../types/adapter"; -import { OverridesAndLibs } from "../../types/deployer"; +import { AbstractEthersAdapter } from "./AbstractEthersAdapter"; @catchError -export class PureAdapter extends Adapter { - private _injectHelper: EthersInjectHelper; - - constructor(protected _hre: HardhatRuntimeEnvironment) { - super(_hre); - this._injectHelper = new EthersInjectHelper(_hre); - } - - public async fromInstance(instance: PureFactory): Promise { - return new MinimalContract( - this._hre, - this.getRawBytecode(instance), - this.getInterface(instance), - this.getContractName(instance), - ); - } - - public async toInstance(instance: PureFactory, address: string, parameters: OverridesAndLibs): Promise { - const signer = await getSignerHelper(this._hre, parameters.from); - - const contract = new BaseContract(address, this.getInterface(instance), signer); - - return this._injectHelper.insertHandlers(contract, this.getContractName(instance), parameters) as unknown as I; - } - +export class PureAdapter extends AbstractEthersAdapter { public getInterface(instance: PureFactory): Interface { return Interface.from(instance.abi); } - public getRawBytecode(instance: PureFactory): string { - return bytecodeToString(instance.bytecode); - } - public getContractName(instance: PureFactory): string { return instance.contractName; } + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public async overrideConnectMethod(_instance: PureFactory, _contractName: string) { + return; + } } diff --git a/src/deployer/adapters/PureEthersAdapter.ts b/src/deployer/adapters/PureEthersAdapter.ts index 764b37a..d437b5a 100644 --- a/src/deployer/adapters/PureEthersAdapter.ts +++ b/src/deployer/adapters/PureEthersAdapter.ts @@ -1,52 +1,16 @@ -import { BaseContract, ContractFactory, Interface } from "ethers"; +import { Addressable, ContractFactory, Interface } from "ethers"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; - -import { Adapter } from "./Adapter"; -import { EthersInjectHelper } from "./EthersInjectHelper"; - -import { MinimalContract } from "../MinimalContract"; - -import { catchError, getSignerHelper } from "../../utils"; - -import { OverridesAndLibs } from "../../types/deployer"; +import { catchError } from "../../utils"; import { ArtifactProcessor } from "../../tools/storage/ArtifactProcessor"; +import { AbstractEthersAdapter } from "./AbstractEthersAdapter"; @catchError -export class PureEthersAdapter extends Adapter { - private _injectHelper: EthersInjectHelper; - - constructor(protected _hre: HardhatRuntimeEnvironment) { - super(_hre); - this._injectHelper = new EthersInjectHelper(_hre); - } - - public async fromInstance(instance: ContractFactory): Promise { - return new MinimalContract( - this._hre, - this.getRawBytecode(instance), - this.getInterface(instance), - this.getContractName(instance), - ); - } - - public async toInstance(instance: ContractFactory, address: string, parameters: OverridesAndLibs): Promise { - const signer = await getSignerHelper(this._hre, parameters.from); - - const contract = new BaseContract(address, this.getInterface(instance), signer); - - return this._injectHelper.insertHandlers(contract, this.getContractName(instance), parameters) as unknown as I; - } - +export class PureEthersAdapter extends AbstractEthersAdapter { public getInterface(instance: ContractFactory): Interface { return instance.interface; } - public getRawBytecode(instance: ContractFactory): string { - return instance.bytecode; - } - public getContractName(instance: ContractFactory): string { try { return ArtifactProcessor.tryGetContractName(this.getRawBytecode(instance)); @@ -54,4 +18,14 @@ export class PureEthersAdapter extends Adapter { return "Unknown Contract"; } } + + public async overrideConnectMethod(instance: ContractFactory, contractName: string) { + const attachMethod = instance.attach; + + instance.attach = (target: string | Addressable): any => { + const contract = attachMethod(target); + + return this.insertHandlers(contract, contractName, {}); + }; + } } diff --git a/src/deployer/adapters/TruffleAdapter.ts b/src/deployer/adapters/TruffleAdapter.ts index fc1fe98..a9bd62c 100644 --- a/src/deployer/adapters/TruffleAdapter.ts +++ b/src/deployer/adapters/TruffleAdapter.ts @@ -8,7 +8,7 @@ import { Adapter } from "./Adapter"; import { MinimalContract } from "../MinimalContract"; -import { bytecodeToString, catchError, fillParameters, getMethodString } from "../../utils"; +import { bytecodeToString, catchError, fillParameters, getMethodString, toJSON } from "../../utils"; import { KeyTransactionFields } from "../../types/tools"; import { EthersFactory, Instance, TruffleFactory } from "../../types/adapter"; @@ -35,12 +35,11 @@ export class TruffleAdapter extends Adapter { ); } - public async toInstance(instance: TruffleFactory, address: string, parameters: OverridesAndLibs): Promise { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public async toInstance(instance: TruffleFactory, address: string, _parameters: OverridesAndLibs): Promise { const contract = this._hre.artifacts.require(instance.contractName!); - const contractInstance = await contract.at(address); - - return this._insertHandlers(instance, contractInstance, address, parameters); + return contract.at(address); } public getInterface(instance: TruffleContract): Interface { @@ -55,10 +54,21 @@ export class TruffleAdapter extends Adapter { try { return ArtifactProcessor.tryGetContractName(this.getRawBytecode(instance)); } catch { - return "Unknown Contract"; + // It is possible was called abstract contract + return (instance as any).contractName || "Unknown Contract"; } } + public async overrideConnectMethod(instance: TruffleFactory) { + const atMethod = instance.at; + + instance.at = async (address: string): Promise => { + const contract = await atMethod(address); + + return this._insertHandlers(instance, contract, address, {}); + }; + } + protected _insertHandlers(instance: TruffleFactory, contract: I, to: string, parameters: OverridesAndLibs): I { const contractInterface = this.getInterface(instance); const contractName = this.getContractName(instance); @@ -66,7 +76,13 @@ export class TruffleAdapter extends Adapter { for (const methodName of Object.keys((contract as any).contract.methods)) { const oldMethod: BaseTruffleMethod = (contract as any)[methodName]; - const functionStateMutability = contractInterface.getFunction(methodName)?.stateMutability; + let functionStateMutability: string | undefined; + try { + functionStateMutability = contractInterface.getFunction(methodName)?.stateMutability; + } catch { + // Ambiguous function description in ABI + continue; + } if (functionStateMutability === "view" || functionStateMutability === "pure") { continue; } @@ -154,7 +170,7 @@ export class TruffleAdapter extends Adapter { const tx: KeyTransactionFields = { to: to, from: parameters.from! as string, - data: JSON.stringify(args), + data: toJSON(args), chainId: toBigInt(String(parameters.chainId)), value: toBigInt(String(parameters.value)), }; diff --git a/src/index.ts b/src/index.ts index 75de117..d4df606 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,8 +3,8 @@ import "@nomicfoundation/hardhat-verify"; import { TASK_COMPILE } from "hardhat/builtin-tasks/task-names"; import { extendConfig, extendEnvironment, task, types } from "hardhat/config"; -import { lazyObject } from "hardhat/plugins"; -import { ActionType } from "hardhat/types"; +import { lazyFunction, lazyObject } from "hardhat/plugins"; +import { ActionType, HardhatRuntimeEnvironment } from "hardhat/types"; import "./type-extensions"; @@ -17,9 +17,11 @@ import { Reporter } from "./tools/reporters/Reporter"; import { ArtifactProcessor } from "./tools/storage/ArtifactProcessor"; import { DefaultStorage } from "./tools/storage/MigrateStorage"; +import { TruffleAdapter } from "./deployer/adapters/TruffleAdapter"; import { MigrateConfig } from "./types/migrations"; export { Deployer } from "./deployer/Deployer"; +export { DefaultStorage } from "./tools/storage/MigrateStorage"; export { Verifier } from "./verifier/Verifier"; extendConfig(migrateConfigExtender); @@ -37,6 +39,8 @@ const migrate: ActionType = async (taskArgs, env) => { Reporter.init(env); + overrideTruffleRequire(env); + await new Migrator(env).migrate(); }; @@ -77,3 +81,17 @@ task(TASK_MIGRATE, "Deploy contracts via migration files") ) .addFlag("continue", "The flag indicating whether the previous deployment should be continued.") .setAction(migrate); + +const overrideTruffleRequire = (env: HardhatRuntimeEnvironment) => { + const old = env.artifacts.require; + + env.artifacts.require = lazyFunction(() => { + return (contractPath: string): any => { + const res = old(contractPath); + + new TruffleAdapter(env).overrideConnectMethod(res); + + return res; + }; + }); +}; diff --git a/src/tools/reporters/Reporter.ts b/src/tools/reporters/Reporter.ts index d1824d4..2de3982 100644 --- a/src/tools/reporters/Reporter.ts +++ b/src/tools/reporters/Reporter.ts @@ -1,9 +1,8 @@ /* eslint-disable no-console */ import ora from "ora"; import axios from "axios"; -import BigNumber from "bignumber.js"; -import { Network, TransactionReceipt, TransactionResponse } from "ethers"; +import { Network, TransactionReceipt, TransactionResponse, formatEther, formatUnits } from "ethers"; import { HardhatRuntimeEnvironment } from "hardhat/types"; @@ -192,15 +191,11 @@ export class Reporter { return this._toGWei(value) + " GWei"; } - return this._toEther(value) + ` ${nativeSymbol}`; - } - - private static _toEther(value: bigint): string { - return new BigNumber(value.toString()).div(10 ** 18).toFixed(); + return formatEther(value) + ` ${nativeSymbol}`; } private static _toGWei(value: bigint): string { - return new BigNumber(value.toString()).div(10 ** 9).toFixed(); + return formatUnits(value, "gwei"); } private static _reportMigrationFiles(files: string[]) { diff --git a/src/tools/storage/TransactionProcessor.ts b/src/tools/storage/TransactionProcessor.ts index 6dab2e1..f7fce6a 100644 --- a/src/tools/storage/TransactionProcessor.ts +++ b/src/tools/storage/TransactionProcessor.ts @@ -25,6 +25,10 @@ export class TransactionProcessor { this._saveContractByName(contractName, address); } + public static saveDeploymentTransactionWithContractName(contractName: string, address: string) { + this._saveContractByName(contractName, address); + } + /** * @param tx - Transaction to save. Acts as a key and value at the same time. */ diff --git a/src/utils.ts b/src/utils.ts index f076aff..3c52f1f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -22,7 +22,7 @@ export async function getSignerHelper( const address = await hre.ethers.resolveAddress(from, hre.ethers.provider); - return hre.ethers.getSigner(address as string); + return hre.ethers.getSigner(address); } export async function fillParameters(hre: HardhatRuntimeEnvironment, parameters: Overrides): Promise { @@ -126,21 +126,21 @@ export function getMethodString( args: any[] = [], ): string { if (methodFragment.inputs === undefined) { - return `${contractName}.${methodName}`; - } - - let argsString = ""; - for (let i = 0; i < args.length; i++) { - argsString += `${methodFragment.inputs[i].name}:${args[i]}${i === args.length - 1 ? "" : ", "}`; + return `${contractName}.${methodName}()`; } + const argsString = args.map((arg, i) => `${methodFragment.inputs[i].name}:${arg}`).join(", "); const methodSting = `${contractName}.${methodName}(${argsString})`; if (methodSting.length > 60) { - return `${contractName}.${methodName}(${args.length} arguments)`; + const shortenMethodString = `${contractName}.${methodName}(${args.length} arguments)`; + + if (shortenMethodString.length > 60) { + return `${contractName.split(":").pop()}.${methodName}(${args.length} arguments)`; + } } - return `${contractName}.${methodName}(${argsString})`; + return methodSting; } export async function waitForBlock(hre: HardhatRuntimeEnvironment, desiredBlock: number) { From 64c79c3f6df150e6478b1178da091f2fa44a6272 Mon Sep 17 00:00:00 2001 From: RuslanProgrammer <55411970+RuslanProgrammer@users.noreply.github.com> Date: Fri, 27 Oct 2023 11:13:47 +0200 Subject: [PATCH 16/36] added sendNative() (#43) * added sendNative() * added comment * Small clean up. --------- Co-authored-by: Kyryl R --- src/deployer/Deployer.ts | 41 +++++++++++++++++++++++ src/deployer/MinimalContract.ts | 1 + src/deployer/adapters/TruffleAdapter.ts | 10 +++--- src/index.ts | 4 +-- src/tools/reporters/Reporter.ts | 7 ++-- src/tools/storage/TransactionProcessor.ts | 27 ++++++++------- 6 files changed, 68 insertions(+), 22 deletions(-) diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts index e5e194a..f26a876 100644 --- a/src/deployer/Deployer.ts +++ b/src/deployer/Deployer.ts @@ -14,8 +14,10 @@ import { TruffleAdapter } from "./adapters/TruffleAdapter"; import { Instance, TypedArgs } from "../types/adapter"; import { OverridesAndLibs } from "../types/deployer"; +import { KeyTransactionFields } from "../types/tools"; import { isContractFactory, isEthersFactory, isPureFactory, isTruffleFactory } from "../types/type-checks"; +import { Reporter } from "../tools/reporters/Reporter"; import { TransactionProcessor } from "../tools/storage/TransactionProcessor"; @catchError @@ -58,6 +60,35 @@ export class Deployer { return adapter.toInstance(contract, contractAddress, {}); } + public async sendNative(to: string, value: bigint): Promise { + const signer = await getSignerHelper(this._hre); + + const tx = await this._buildSendTransaction(to, value); + + const methodString = "sendNative"; + + if (this._hre.config.migrate.continue) { + try { + TransactionProcessor.tryRestoreSavedTransaction(tx); + + Reporter.notifyTransactionRecovery(methodString); + + return; + } catch { + Reporter.notifyTransactionSendingInsteadOfRecovery(methodString); + } + } + + const txResponse = await signer.sendTransaction(tx); + + await Promise.all([ + txResponse.wait(this._hre.config.migrate.txConfirmations), + Reporter.reportTransaction(txResponse, methodString), + ]); + + TransactionProcessor.saveTransaction(tx); + } + public async getSigner(from?: string): Promise { return getSignerHelper(this._hre, from); } @@ -85,4 +116,14 @@ export class Deployer { throw new MigrateError("Unknown Contract Factory Type"); } + + private async _buildSendTransaction(to: string, value: bigint): Promise { + return { + to, + value, + chainId: await getChainId(this._hre), + data: "0x", + from: (await getSignerHelper(this._hre)).address, + }; + } } diff --git a/src/deployer/MinimalContract.ts b/src/deployer/MinimalContract.ts index 30a9524..544884f 100644 --- a/src/deployer/MinimalContract.ts +++ b/src/deployer/MinimalContract.ts @@ -79,6 +79,7 @@ export class MinimalContract { ): Promise { const factory = new this._hre.ethers.ContractFactory(this._interface, this._bytecode); + // check opportunity to use the populateTransaction method return { contractName: this._contractName, chainId: await getChainId(this._hre), diff --git a/src/deployer/adapters/TruffleAdapter.ts b/src/deployer/adapters/TruffleAdapter.ts index a9bd62c..2852700 100644 --- a/src/deployer/adapters/TruffleAdapter.ts +++ b/src/deployer/adapters/TruffleAdapter.ts @@ -1,4 +1,4 @@ -import { ContractTransaction, Interface, toBigInt } from "ethers"; +import { Interface, toBigInt } from "ethers"; import { HardhatRuntimeEnvironment } from "hardhat/types"; @@ -125,7 +125,7 @@ export class TruffleAdapter extends Adapter { protected async _recoverTransaction( methodString: string, - tx: ContractTransaction, + tx: KeyTransactionFields, oldMethod: BaseTruffleMethod, args: any[], ) { @@ -144,7 +144,7 @@ export class TruffleAdapter extends Adapter { protected async _sendTransaction( methodString: string, - tx: ContractTransaction, + tx: KeyTransactionFields, oldMethod: BaseTruffleMethod, args: any[], ) { @@ -164,7 +164,7 @@ export class TruffleAdapter extends Adapter { args: any[], to: string, parameters: OverridesAndLibs, - ): Promise { + ): Promise { await fillParameters(this._hre, parameters); const tx: KeyTransactionFields = { @@ -175,6 +175,6 @@ export class TruffleAdapter extends Adapter { value: toBigInt(String(parameters.value)), }; - return tx as ContractTransaction; + return tx; } } diff --git a/src/index.ts b/src/index.ts index d4df606..3cae1db 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,10 +12,10 @@ import { mergeConfigs, migrateConfigExtender } from "./config"; import { TASK_MIGRATE } from "./constants"; import { Migrator } from "./migrator/Migrator"; -import { Reporter } from "./tools/reporters/Reporter"; -import { ArtifactProcessor } from "./tools/storage/ArtifactProcessor"; +import { Reporter } from "./tools/reporters/Reporter"; import { DefaultStorage } from "./tools/storage/MigrateStorage"; +import { ArtifactProcessor } from "./tools/storage/ArtifactProcessor"; import { TruffleAdapter } from "./deployer/adapters/TruffleAdapter"; import { MigrateConfig } from "./types/migrations"; diff --git a/src/tools/reporters/Reporter.ts b/src/tools/reporters/Reporter.ts index 2de3982..e14d902 100644 --- a/src/tools/reporters/Reporter.ts +++ b/src/tools/reporters/Reporter.ts @@ -1,6 +1,6 @@ /* eslint-disable no-console */ -import ora from "ora"; import axios from "axios"; +import ora from "ora"; import { Network, TransactionReceipt, TransactionResponse, formatEther, formatUnits } from "ethers"; @@ -84,6 +84,7 @@ export class Reporter { await this._printTransaction(receipt); + // TODO: do wee need add value to totalCost? this.totalCost += receipt.fee; this.totalTransactions++; } @@ -175,6 +176,8 @@ export class Reporter { output += `> account: ${tx.from}\n`; + output += `> value: ${this.castAmount((await tx.getTransaction()).value, nativeSymbol)}\n`; + output += `> balance: ${this.castAmount(await tx.provider.getBalance(tx.from), nativeSymbol)}\n`; output += `> gasUsed: ${tx.gasUsed}\n`; @@ -187,7 +190,7 @@ export class Reporter { } public static castAmount(value: bigint, nativeSymbol: string): string { - if (value < 10n ** 12n) { + if (value > 0n && value < 10n ** 12n) { return this._toGWei(value) + " GWei"; } diff --git a/src/tools/storage/TransactionProcessor.ts b/src/tools/storage/TransactionProcessor.ts index f7fce6a..d57b936 100644 --- a/src/tools/storage/TransactionProcessor.ts +++ b/src/tools/storage/TransactionProcessor.ts @@ -1,4 +1,4 @@ -import { ContractDeployTransaction, ContractTransaction, ContractTransactionResponse, isAddress } from "ethers"; +import { ContractDeployTransaction, ContractTransactionResponse, isAddress } from "ethers"; import { HardhatRuntimeEnvironment } from "hardhat/types"; @@ -13,6 +13,7 @@ import { isDeployedContractAddress, } from "../../utils"; +import { KeyTransactionFields } from "../../types/tools"; import { validateKeyDeploymentFields, validateKeyTxFields } from "../../types/type-checks"; @catchError @@ -32,14 +33,14 @@ export class TransactionProcessor { /** * @param tx - Transaction to save. Acts as a key and value at the same time. */ - public static saveTransaction(tx: ContractTransaction) { + public static saveTransaction(tx: KeyTransactionFields) { this._saveTransaction( { data: tx.data, - from: tx.from!, - chainId: tx.chainId!, + from: tx.from, + chainId: tx.chainId, to: tx.to, - value: tx.value!, + value: tx.value, }, tx, ); @@ -80,7 +81,7 @@ export class TransactionProcessor { } @validateKeyTxFields - public static tryRestoreSavedTransaction(key: ContractTransaction): ContractTransactionResponse { + public static tryRestoreSavedTransaction(key: KeyTransactionFields): ContractTransactionResponse { if (this._deployedContracts.has(key.to)) { throw new MigrateError(`Contract is deployed in the current migration`); } @@ -88,23 +89,23 @@ export class TransactionProcessor { return this._tryGetDataFromStorage( createKeyTxFieldsHash({ data: key.data, - from: key.from!, - chainId: key.chainId!, + from: key.from, + chainId: key.chainId, to: key.to, - value: key.value!, + value: key.value, }), ); } @validateKeyTxFields - private static _saveTransaction(args: ContractTransaction, transaction: ContractTransaction) { + private static _saveTransaction(args: KeyTransactionFields, transaction: KeyTransactionFields) { TransactionStorage.set( createKeyTxFieldsHash({ data: args.data, - from: args.from!, - chainId: args.chainId!, + from: args.from, + chainId: args.chainId, to: args.to, - value: args.value!, + value: args.value, }), transaction, true, From b555a98ac2a641544f33b0f9288bb134bc8f9a76 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Fri, 27 Oct 2023 13:06:43 +0200 Subject: [PATCH 17/36] config --- src/index.ts | 10 +++-- .../hardhat.config.js | 11 +++-- .../hardhat.config.js | 5 --- test/integration/config.ts | 43 ++++++++++++------- test/integration/deployer/deployEthers.ts | 2 + test/integration/deployer/deployTruffle.ts | 2 + .../deployer/deployTypechainEthers.ts | 2 + .../deployer/deployTypechainTruffle.ts | 2 + test/integration/transaction-storage.ts | 2 + 9 files changed, 48 insertions(+), 31 deletions(-) diff --git a/src/index.ts b/src/index.ts index 0239806..25d5583 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,9 +26,9 @@ export { Deployer } from "./deployer/Deployer"; export { DefaultStorage } from "./tools/storage/MigrateStorage"; export { Verifier } from "./verifier/Verifier"; -const migrate: ActionType = async (taskArgs, env) => { - extendConfig(migrateConfigExtender); +extendConfig(migrateConfigExtender); +const migrate: ActionType = async (taskArgs, env) => { env.config.migrate = mergeConfigs(taskArgs, env.config.migrate); // Make sure that contract artifacts are up-to-date. @@ -55,11 +55,13 @@ const migrate: ActionType = async (taskArgs, env) => { }; const migrateVerify: ActionType = async (taskArgs, env) => { - taskArgs = extendVerifyConfigs(taskArgs); + const config = extendVerifyConfigs(taskArgs); Reporter.init(env); - await new Verifier(env, taskArgs).verifyBatch(VerificationProcessor.restoreSavedVerificationFunctions()); + await new Verifier(env, config).verifyBatch( + VerificationProcessor.restoreSavedVerificationFunctions(config.inputFile), + ); }; extendEnvironment((hre) => { diff --git a/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js b/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js index 01ffd3f..5533705 100644 --- a/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js +++ b/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js @@ -6,13 +6,12 @@ module.exports = { to: 5, only: 2, skip: 1, - verify: true, - attempts: 2, wait: 2, + verify: true, + verifyParallel: 4, + verifyAttempts: 5, pathToMigrations: "./deploy/", - verifyConfig: { - parallel: 4, - attempts: 5, - }, + force: true, + continue: true, }, }; diff --git a/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js b/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js index 5b73bf9..963947e 100644 --- a/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js +++ b/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js @@ -2,11 +2,6 @@ require("../../../src"); module.exports = { migrate: { - wait: 0, pathToMigrations: "/deploy", - verifyConfig: { - parallel: 0, - attempts: 0, - }, }, }; diff --git a/test/integration/config.ts b/test/integration/config.ts index f8033fc..69e0a0a 100644 --- a/test/integration/config.ts +++ b/test/integration/config.ts @@ -5,6 +5,8 @@ import { assert, expect } from "chai"; import { HardhatPluginError } from "hardhat/plugins"; import { resetHardhatContext } from "hardhat/plugins-testing"; +import { extendConfig } from "hardhat/config"; +import { migrateConfigExtender } from "../../src/config"; import { MigrateConfig } from "../../src/types/migrations"; import { useEnvironment } from "../helpers"; @@ -34,28 +36,32 @@ describe("config", () => { assert.equal(loadedOptions.skip, 1); }); + it("should apply wait", async function () { + assert.equal(loadedOptions.wait, 2); + }); + it("should apply verify", async function () { assert.isTrue(loadedOptions.verify); }); - it("should apply attempts", async function () { + it("should apply verifyAttempts", async function () { assert.equal(loadedOptions.verifyAttempts, 5); }); - it("should apply parallel", async function () { + it("should apply verifyParallel", async function () { assert.equal(loadedOptions.verifyParallel, 4); }); - it("should apply wait", async function () { - assert.equal(loadedOptions.wait, 2); - }); - it("should apply pathToMigrations", async function () { assert.equal(loadedOptions.pathToMigrations, "./deploy/"); }); - it("should apply continuePreviousDeployment", async function () { - assert.isFalse(loadedOptions.continue); + it("should apply force", async function () { + assert.isTrue(loadedOptions.force); + }); + + it("should apply continue", async function () { + assert.isTrue(loadedOptions.continue); }); }); @@ -81,6 +87,7 @@ describe("config", () => { let loadedOptions: MigrateConfig; beforeEach(function () { + extendConfig(migrateConfigExtender); loadedOptions = this.hre.config.migrate; }); @@ -104,27 +111,31 @@ describe("config", () => { assert.equal(loadedOptions.skip, -1); }); + it("should set to default wait", async function () { + assert.equal(loadedOptions.wait, 1); + }); + it("should set to default verify", async function () { assert.equal(loadedOptions.verify, false); }); - it("should set to default attempts", async function () { + it("should set to default verifyAttempts", async function () { assert.equal(loadedOptions.verifyAttempts, 3); }); - it("should set to default parallel", async function () { - assert.equal(loadedOptions.verifyParallel, 4); - }); - - it("should set to default wait", async function () { - assert.equal(loadedOptions.wait, 1); + it("should set to default verifyParallel", async function () { + assert.equal(loadedOptions.verifyParallel, 1); }); it("should set to default pathToMigrations", async function () { assert.equal(loadedOptions.pathToMigrations, "./deploy"); }); - it("should set to default continuePreviousDeployment", async function () { + it("should set to default force", async function () { + assert.isFalse(loadedOptions.force); + }); + + it("should set to default continue", async function () { assert.isFalse(loadedOptions.continue); }); }); diff --git a/test/integration/deployer/deployEthers.ts b/test/integration/deployer/deployEthers.ts index ceda27e..740fbf4 100644 --- a/test/integration/deployer/deployEthers.ts +++ b/test/integration/deployer/deployEthers.ts @@ -5,6 +5,7 @@ import { useEnvironment } from "../../helpers"; import { Deployer } from "../../../src/deployer/Deployer"; import { TransactionStorage } from "../../../src/tools/storage/MigrateStorage"; +import { Reporter } from "../../../src/tools/reporters/Reporter"; describe("deployer", () => { describe("deploy()", () => { @@ -17,6 +18,7 @@ describe("deployer", () => { beforeEach("setup", async function () { deployer = new Deployer(this.hre); + Reporter.init(this.hre); TransactionStorage.clear(); ContractWithConstructor = await this.hre.ethers.getContractFactory("ContractWithConstructorArguments"); diff --git a/test/integration/deployer/deployTruffle.ts b/test/integration/deployer/deployTruffle.ts index 0d05923..6f466a3 100644 --- a/test/integration/deployer/deployTruffle.ts +++ b/test/integration/deployer/deployTruffle.ts @@ -7,6 +7,7 @@ import { useEnvironment } from "../../helpers"; import { Deployer } from "../../../src/deployer/Deployer"; import { TransactionStorage } from "../../../src/tools/storage/MigrateStorage"; +import { Reporter } from "../../../src/tools/reporters/Reporter"; describe("Truffle -- deployer", () => { describe("deploy()", () => { @@ -18,6 +19,7 @@ describe("Truffle -- deployer", () => { beforeEach("setup", async function () { deployer = new Deployer(this.hre); + Reporter.init(this.hre); TransactionStorage.clear(); contractWithConstructorArtifact = await this.hre.artifacts.require("ContractWithConstructorArguments"); diff --git a/test/integration/deployer/deployTypechainEthers.ts b/test/integration/deployer/deployTypechainEthers.ts index 197647f..9b493f3 100644 --- a/test/integration/deployer/deployTypechainEthers.ts +++ b/test/integration/deployer/deployTypechainEthers.ts @@ -14,6 +14,7 @@ import { Library1__factory, Library2__factory, } from "../../fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types"; +import { Reporter } from "../../../src/tools/reporters/Reporter"; describe("Ehters Typechain -- Deployer", () => { describe("deploy()", () => { @@ -26,6 +27,7 @@ describe("Ehters Typechain -- Deployer", () => { await ArtifactProcessor.parseArtifacts(this.hre); + Reporter.init(this.hre); TransactionStorage.clear(); }); diff --git a/test/integration/deployer/deployTypechainTruffle.ts b/test/integration/deployer/deployTypechainTruffle.ts index bae2ddd..c4c5cb9 100644 --- a/test/integration/deployer/deployTypechainTruffle.ts +++ b/test/integration/deployer/deployTypechainTruffle.ts @@ -7,6 +7,7 @@ import { useEnvironment } from "../../helpers"; import { Deployer } from "../../../src/deployer/Deployer"; +import { Reporter } from "../../../src/tools/reporters/Reporter"; import { TransactionStorage } from "../../../src/tools/storage/MigrateStorage"; describe("Truffle Typechain -- Deployer", () => { @@ -22,6 +23,7 @@ describe("Truffle Typechain -- Deployer", () => { beforeEach("setup", async function () { deployer = new Deployer(this.hre); + Reporter.init(this.hre); TransactionStorage.clear(); contractWithConstructorArtifact = await this.hre.artifacts.require("ContractWithConstructorArguments"); diff --git a/test/integration/transaction-storage.ts b/test/integration/transaction-storage.ts index 20ceeb6..235a2ec 100644 --- a/test/integration/transaction-storage.ts +++ b/test/integration/transaction-storage.ts @@ -12,6 +12,7 @@ import { ContractWithConstructorArguments__factory, ContractWithPayableConstructor__factory, } from "../fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types"; +import { Reporter } from "../../src/tools/reporters/Reporter"; describe("TransactionStorage", async () => { useEnvironment("repeats-typechain-ethers"); @@ -21,6 +22,7 @@ describe("TransactionStorage", async () => { }); afterEach(async function () { + Reporter.init(this.hre); TransactionStorage.clear(); }); From ffea2e232faad5ed09e68c75c60f2770f21096e3 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Fri, 27 Oct 2023 13:31:49 +0200 Subject: [PATCH 18/36] fixed types --- src/deployer/Deployer.ts | 2 +- src/deployer/adapters/AbstractEthersAdapter.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts index 7b6043a..6c9afce 100644 --- a/src/deployer/Deployer.ts +++ b/src/deployer/Deployer.ts @@ -89,7 +89,7 @@ export class Deployer { const txResponse = await signer.sendTransaction(tx); await Promise.all([ - txResponse.wait(this._hre.config.migrate.txConfirmations), + txResponse.wait(this._hre.config.migrate.wait), Reporter.reportTransaction(txResponse, methodString), ]); diff --git a/src/deployer/adapters/AbstractEthersAdapter.ts b/src/deployer/adapters/AbstractEthersAdapter.ts index 240c810..b4cf02d 100644 --- a/src/deployer/adapters/AbstractEthersAdapter.ts +++ b/src/deployer/adapters/AbstractEthersAdapter.ts @@ -2,7 +2,6 @@ import { BaseContract, BaseContractMethod, ContractFactory, - ContractTransaction, ContractTransactionResponse, defineProperties, FunctionFragment, @@ -20,6 +19,7 @@ import { OverridesAndLibs } from "../../types/deployer"; import { Reporter } from "../../tools/reporters/Reporter"; import { TransactionProcessor } from "../../tools/storage/TransactionProcessor"; +import { KeyTransactionFields } from "../../types/tools"; import { MinimalContract } from "../MinimalContract"; type Factory = EthersFactory | PureFactory | ContractFactory; @@ -121,7 +121,7 @@ export abstract class AbstractEthersAdapter extends Adapter { ): (...args: any[]) => Promise { return async (...args: any[]): Promise => { await fillParameters(this._hre, parameters); - const tx = await oldMethod.populateTransaction(...args, parameters); + const tx = (await oldMethod.populateTransaction(...args, parameters)) as KeyTransactionFields; const methodString = getMethodString(contractName, methodName, methodFragments, args); @@ -135,7 +135,7 @@ export abstract class AbstractEthersAdapter extends Adapter { private async _recoverTransaction( methodString: string, - tx: ContractTransaction, + tx: KeyTransactionFields, oldMethod: BaseContractMethod, args: any[], ) { @@ -154,7 +154,7 @@ export abstract class AbstractEthersAdapter extends Adapter { private async _sendTransaction( methodString: string, - tx: ContractTransaction, + tx: KeyTransactionFields, oldMethod: BaseContractMethod, args: any[], ) { From 798f9f66641fcf62b59b8d74fcea99d0cdf91ae1 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Fri, 27 Oct 2023 13:39:27 +0200 Subject: [PATCH 19/36] added info to formatPendingTime() --- src/tools/reporters/Reporter.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/tools/reporters/Reporter.ts b/src/tools/reporters/Reporter.ts index 33b0539..b3e6ded 100644 --- a/src/tools/reporters/Reporter.ts +++ b/src/tools/reporters/Reporter.ts @@ -55,17 +55,17 @@ export class Reporter { public static async reportTransaction(tx: TransactionResponse, instanceName: string) { const timeStart = Date.now(); + const blockStart = await this._hre.ethers.provider.getBlockNumber(); console.log("\n" + underline(this._parseTransactionTitle(tx, instanceName))); console.log(`> explorer: ${await this._getExplorerLink(tx.hash)}`); - const spinner = ora(await this._formatPendingTime(tx, timeStart)).start(); + const formatPendingTimeTask = async () => this._formatPendingTime(tx, timeStart, blockStart); - const spinnerInterval = setInterval( - async () => (spinner.text = await this._formatPendingTime(tx as TransactionResponse, timeStart)), - 1000, - ); + const spinner = ora(await formatPendingTimeTask()).start(); + + const spinnerInterval = setInterval(async () => (spinner.text = await formatPendingTimeTask()), 1000); let receipt: TransactionReceipt; try { @@ -150,8 +150,14 @@ export class Reporter { return `Transaction: ${instanceName}`; } - private static async _formatPendingTime(tx: TransactionResponse, startTime: number): Promise { - return `Blocks: ${await tx.confirmations()} Seconds: ${((Date.now() - startTime) / 1000).toFixed(0)}`; + private static async _formatPendingTime( + tx: TransactionResponse, + startTime: number, + blockStart: number, + ): Promise { + return `Confirmations: ${await tx.confirmations()} Blocks: ${ + (await this._hre.ethers.provider.getBlockNumber()) - blockStart + } Seconds: ${((Date.now() - startTime) / 1000).toFixed(0)}`; } private static async _getExplorerLink(txHash: string): Promise { From f5a5a2f8b8875433b098c01c6dfdaad020d0ed8e Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Fri, 27 Oct 2023 14:41:27 +0200 Subject: [PATCH 20/36] fixed verifier --- src/config.ts | 2 +- src/deployer/MinimalContract.ts | 2 +- src/index.ts | 2 +- src/types/migrations.ts | 2 +- src/types/verifier.ts | 2 +- src/verifier/Verifier.ts | 9 +++------ 6 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/config.ts b/src/config.ts index dfa55cf..c0f08a2 100644 --- a/src/config.ts +++ b/src/config.ts @@ -22,7 +22,7 @@ const defaultConfig: MigrateConfig = { }; const defaultVerifyConfig: MigrateVerifyConfig = { - inputFile: ".storage.json", + inputFile: undefined, parallel: 1, attempts: 3, }; diff --git a/src/deployer/MinimalContract.ts b/src/deployer/MinimalContract.ts index 62933f6..329a898 100644 --- a/src/deployer/MinimalContract.ts +++ b/src/deployer/MinimalContract.ts @@ -129,7 +129,7 @@ export class MinimalContract { contractAddress, contractName: tx.contractName, constructorArguments: args, - chainId: await getChainId(this._hre), + chainId: Number(await getChainId(this._hre)), }); return contractAddress; diff --git a/src/index.ts b/src/index.ts index eeb0c7f..31f7454 100644 --- a/src/index.ts +++ b/src/index.ts @@ -98,7 +98,7 @@ task(TASK_MIGRATE, "Deploy contracts via migration files") .setAction(migrate); task(TASK_MIGRATE_VERIFY, "Verify contracts via .storage") - .addOptionalParam("inputJSON", "The path to the .storage file.", undefined, types.inputFile) + .addOptionalParam("inputFile", "The path to the .storage file.", undefined, types.inputFile) .addOptionalParam("parallel", "The size of the batch for verification.", undefined, types.int) .addOptionalParam("attempts", "The number of attempts to verify the contract.", undefined, types.int) .setAction(migrateVerify); diff --git a/src/types/migrations.ts b/src/types/migrations.ts index f783220..7c198e6 100644 --- a/src/types/migrations.ts +++ b/src/types/migrations.ts @@ -74,5 +74,5 @@ export interface MigrateVerifyConfig extends VerifyConfig { /* * The path to the file with the verification input. */ - inputFile: string; + inputFile: string | undefined; } diff --git a/src/types/verifier.ts b/src/types/verifier.ts index cac1d4e..199bb74 100644 --- a/src/types/verifier.ts +++ b/src/types/verifier.ts @@ -4,7 +4,7 @@ export type VerifierArgs = { contractAddress: string; contractName: string; constructorArguments: Args; - chainId?: bigint; + chainId?: number; }; export interface ChainRecord { diff --git a/src/verifier/Verifier.ts b/src/verifier/Verifier.ts index b324ed5..f34a090 100644 --- a/src/verifier/Verifier.ts +++ b/src/verifier/Verifier.ts @@ -25,7 +25,7 @@ export class Verifier { public async verify(verifierArgs: VerifierArgs): Promise { const { contractAddress, contractName, constructorArguments, chainId } = verifierArgs; - if (chainId && (await getChainId(this._hre)) !== chainId) { + if (chainId && Number(await getChainId(this._hre)) != chainId) { // TODO: Add actions for this case. return; } @@ -56,11 +56,8 @@ export class Verifier { for (let i = 0; i < verifierButchArgs.length; i += parallel) { const batch = verifierButchArgs.slice(i, i + parallel); - await Promise.all( - batch.map((args) => { - this.verify(args); - }), - ); + + await Promise.all(batch.map((args) => this.verify(args))); } } From eefbd594550170da0fafa7f5a21f92efe929e2a7 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 27 Oct 2023 15:41:56 +0300 Subject: [PATCH 21/36] Sorted out imports --- src/index.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/index.ts b/src/index.ts index 31f7454..b0f34b7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,30 +1,28 @@ -import "@nomicfoundation/hardhat-ethers"; import "@nomicfoundation/hardhat-verify"; -import { TASK_COMPILE } from "hardhat/builtin-tasks/task-names"; -import { extendConfig, extendEnvironment, task, types } from "hardhat/config"; import { lazyFunction, lazyObject } from "hardhat/plugins"; +import { TASK_COMPILE } from "hardhat/builtin-tasks/task-names"; import { ActionType, HardhatRuntimeEnvironment } from "hardhat/types"; +import { extendConfig, extendEnvironment, task, types } from "hardhat/config"; import "./type-extensions"; -import { extendVerifyConfigs, mergeConfigs, migrateConfigExtender } from "./config"; import { TASK_MIGRATE, TASK_MIGRATE_VERIFY } from "./constants"; +import { extendVerifyConfigs, mergeConfigs, migrateConfigExtender } from "./config"; -import { Migrator } from "./migrator/Migrator"; +import { MigrateConfig, MigrateVerifyConfig } from "./types/migrations"; import { Reporter } from "./tools/reporters/Reporter"; import { ArtifactProcessor } from "./tools/storage/ArtifactProcessor"; -import { DefaultStorage, MigrateStorage } from "./tools/storage/MigrateStorage"; import { VerificationProcessor } from "./tools/storage/VerificationProcessor"; +import { DefaultStorage, MigrateStorage } from "./tools/storage/MigrateStorage"; import { TruffleAdapter } from "./deployer/adapters/TruffleAdapter"; -import { MigrateConfig, MigrateVerifyConfig } from "./types/migrations"; + +import { Migrator } from "./migrator/Migrator"; import { Verifier } from "./verifier/Verifier"; export { Deployer } from "./deployer/Deployer"; -export { DefaultStorage } from "./tools/storage/MigrateStorage"; -export { Verifier } from "./verifier/Verifier"; extendConfig(migrateConfigExtender); From c6e72a9354bf340b179ec53d4c75ab20f09c6421 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 27 Oct 2023 15:42:34 +0300 Subject: [PATCH 22/36] Used plain ethers for ContractFactory --- src/deployer/MinimalContract.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/deployer/MinimalContract.ts b/src/deployer/MinimalContract.ts index 329a898..fd27f91 100644 --- a/src/deployer/MinimalContract.ts +++ b/src/deployer/MinimalContract.ts @@ -1,4 +1,4 @@ -import { Interface, Overrides, Signer, TransactionResponse } from "ethers"; +import { ethers, Interface, Overrides, Signer, TransactionResponse } from "ethers"; import { HardhatRuntimeEnvironment } from "hardhat/types"; @@ -81,9 +81,9 @@ export class MinimalContract { args: any[], txOverrides: Overrides, ): Promise { - const factory = new this._hre.ethers.ContractFactory(this._interface, this._bytecode); + const factory = new ethers.ContractFactory(this._interface, this._bytecode); - // check opportunity to use the populateTransaction method + // TODO: check the opportunity to use the populateTransaction method return { contractName: this._contractName, chainId: await getChainId(this._hre), From daae823fe646f5f553558503e9ed1b50417d0a88 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 27 Oct 2023 17:10:23 +0300 Subject: [PATCH 23/36] Drop direct ethers. Used custom provider instead. --- src/deployer/Deployer.ts | 26 +++++++------- src/deployer/Linker.ts | 26 +++++++------- src/deployer/MinimalContract.ts | 36 +++++-------------- .../adapters/AbstractEthersAdapter.ts | 20 ++++------- src/deployer/adapters/Adapter.ts | 8 +---- src/deployer/adapters/EthersAdapter.ts | 5 +-- src/deployer/adapters/PureAdapter.ts | 3 +- src/deployer/adapters/PureEthersAdapter.ts | 3 +- src/deployer/adapters/TruffleAdapter.ts | 13 +++---- src/index.ts | 10 ++++-- src/tools/Provider.ts | 14 ++++++++ src/tools/reporters/Reporter.ts | 24 ++++++------- src/tools/storage/TransactionProcessor.ts | 16 +++------ src/utils.ts | 34 ++++++++---------- src/verifier/Verifier.ts | 2 +- test/integration/adapters/ethersAdapter.ts | 14 +++++++- test/integration/adapters/truffleAdapter.ts | 16 +++++++-- test/integration/deployer/deployEthers.ts | 21 ++++++++--- test/integration/deployer/deployTruffle.ts | 7 +++- .../deployer/deployTypechainEthers.ts | 9 ++++- .../deployer/deployTypechainTruffle.ts | 9 ++++- test/integration/transaction-storage.ts | 27 ++++++-------- tsconfig.json | 3 +- 23 files changed, 186 insertions(+), 160 deletions(-) create mode 100644 src/tools/Provider.ts diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts index 6c9afce..036e66f 100644 --- a/src/deployer/Deployer.ts +++ b/src/deployer/Deployer.ts @@ -7,14 +7,14 @@ import { catchError, getChainId, getSignerHelper, isDeployedContractAddress } fr import { MigrateError } from "../errors"; import { Adapter } from "./adapters/Adapter"; -import { EthersAdapter } from "./adapters/EthersAdapter"; import { PureAdapter } from "./adapters/PureAdapter"; -import { PureEthersAdapter } from "./adapters/PureEthersAdapter"; +import { EthersAdapter } from "./adapters/EthersAdapter"; import { TruffleAdapter } from "./adapters/TruffleAdapter"; +import { PureEthersAdapter } from "./adapters/PureEthersAdapter"; -import { Instance, TypedArgs } from "../types/adapter"; import { OverridesAndLibs } from "../types/deployer"; import { KeyTransactionFields } from "../types/tools"; +import { Instance, TypedArgs } from "../types/adapter"; import { isContractFactory, isEthersFactory, isPureFactory, isTruffleFactory } from "../types/type-checks"; import { Reporter } from "../tools/reporters/Reporter"; @@ -56,19 +56,19 @@ export class Deployer { const adapter = this._resolveAdapter(contract); if (contractAddress) { - if (!(await isDeployedContractAddress(this._hre, contractAddress))) { + if (!(await isDeployedContractAddress(contractAddress))) { throw new MigrateError(`Contract with address '${contractAddress}' is not deployed`); } } else { const contractName = adapter.getContractName(contract); - contractAddress = await TransactionProcessor.tryRestoreContractAddressByName(contractName, this._hre); + contractAddress = await TransactionProcessor.tryRestoreContractAddressByName(contractName); } return adapter.toInstance(contract, contractAddress, {}); } public async sendNative(to: string, value: bigint): Promise { - const signer = await getSignerHelper(this._hre); + const signer = await getSignerHelper(); const tx = await this._buildSendTransaction(to, value); @@ -97,16 +97,16 @@ export class Deployer { } public async getSigner(from?: string): Promise { - return getSignerHelper(this._hre, from); + return getSignerHelper(from); } public async getChainId(): Promise { - return getChainId(this._hre); + return getChainId(); } private _resolveAdapter(contract: Instance): Adapter { if (isEthersFactory(contract)) { - return new EthersAdapter(this._hre); + return new EthersAdapter(this._hre.config.migrate); } if (isTruffleFactory(contract)) { @@ -114,11 +114,11 @@ export class Deployer { } if (isPureFactory(contract)) { - return new PureAdapter(this._hre); + return new PureAdapter(this._hre.config.migrate); } if (isContractFactory(contract)) { - return new PureEthersAdapter(this._hre); + return new PureEthersAdapter(this._hre.config.migrate); } throw new MigrateError("Unknown Contract Factory Type"); @@ -128,9 +128,9 @@ export class Deployer { return { to, value, - chainId: await getChainId(this._hre), + chainId: await getChainId(), data: "0x", - from: (await getSignerHelper(this._hre)).address, + from: (await getSignerHelper()).address, }; } } diff --git a/src/deployer/Linker.ts b/src/deployer/Linker.ts index 7209ffe..567d5d3 100644 --- a/src/deployer/Linker.ts +++ b/src/deployer/Linker.ts @@ -1,6 +1,6 @@ import { Interface, isAddress, resolveAddress } from "ethers"; -import { Artifact, HardhatRuntimeEnvironment, Libraries } from "hardhat/types"; +import { Artifact, Libraries } from "hardhat/types"; import { MinimalContract } from "./MinimalContract"; @@ -8,6 +8,7 @@ import { MigrateError } from "../errors"; import { catchError } from "../utils"; +import { MigrateConfig } from "../types/migrations"; import { ArtifactExtended, Link, NeededLibrary } from "../types/deployer"; import { Reporter } from "../tools/reporters/Reporter"; @@ -16,16 +17,17 @@ import { TransactionProcessor } from "../tools/storage/TransactionProcessor"; @catchError export class Linker { + private static _config: MigrateConfig; + + public static setConfig(config: MigrateConfig): void { + this._config = config; + } + public static isBytecodeNeedsLinking(bytecode: string): boolean { return bytecode.indexOf("__") === -1; } - public static async tryLinkBytecode( - hre: HardhatRuntimeEnvironment, - contractName: string, - bytecode: string, - libraries: Libraries, - ): Promise { + public static async tryLinkBytecode(contractName: string, bytecode: string, libraries: Libraries): Promise { const artifact: ArtifactExtended = this._mustGetContractArtifact(contractName); const neededLibraries = artifact.neededLibraries; @@ -44,7 +46,6 @@ export class Linker { if (linksToApply.size < neededLibraries.length) { const separatelyDeployedLibraries = await this._findMissingLibraries( - hre, neededLibraries.filter((lib) => !linksToApply.has(`${lib.sourceName}:${lib.libName}`)), ); @@ -110,14 +111,13 @@ export class Linker { } private static async _findMissingLibraries( - hre: HardhatRuntimeEnvironment, missingLibraries: { sourceName: string; libName: string }[], ): Promise> { const missingLibrariesMap: Map = new Map(); for (const missingLibrary of missingLibraries) { const lib = `${missingLibrary.sourceName}:${missingLibrary.libName}`; - const address = await this._getOrDeployLibrary(hre, lib); + const address = await this._getOrDeployLibrary(lib); if (isAddress(address)) { missingLibrariesMap.set(lib, { @@ -160,15 +160,15 @@ export class Linker { return bytecode; } - private static async _getOrDeployLibrary(hre: HardhatRuntimeEnvironment, libraryName: string) { + private static async _getOrDeployLibrary(libraryName: string) { try { - return await TransactionProcessor.tryRestoreContractAddressByName(libraryName, hre); + return await TransactionProcessor.tryRestoreContractAddressByName(libraryName); } catch { const artifact = this._mustGetLibraryArtifact(libraryName); // https://github.com/ethers-io/ethers.js/issues/2431 // https://github.com/ethers-io/ethers.js/issues/1126 - const core = new MinimalContract(hre, artifact.bytecode, Interface.from(artifact.abi), libraryName); + const core = new MinimalContract(this._config, artifact.bytecode, Interface.from(artifact.abi), libraryName); Reporter.notifyDeploymentOfMissingLibrary(libraryName); diff --git a/src/deployer/MinimalContract.ts b/src/deployer/MinimalContract.ts index fd27f91..3422f1b 100644 --- a/src/deployer/MinimalContract.ts +++ b/src/deployer/MinimalContract.ts @@ -1,17 +1,13 @@ import { ethers, Interface, Overrides, Signer, TransactionResponse } from "ethers"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; - import { Linker } from "./Linker"; import { catchError, fillParameters, getChainId, getSignerHelper } from "../utils"; import { MigrateError } from "../errors"; -import { ContractDeployTransactionWithContractName, OverridesAndLibs } from "../types/deployer"; import { MigrateConfig } from "../types/migrations"; - -import { Verifier } from "../verifier/Verifier"; +import { ContractDeployTransactionWithContractName, OverridesAndLibs } from "../types/deployer"; import { Reporter } from "../tools/reporters/Reporter"; import { ArtifactProcessor } from "../tools/storage/ArtifactProcessor"; @@ -20,21 +16,12 @@ import { VerificationProcessor } from "../tools/storage/VerificationProcessor"; @catchError export class MinimalContract { - private _verifier: Verifier; - private _config: MigrateConfig; - constructor( - private readonly _hre: HardhatRuntimeEnvironment, + private readonly _config: MigrateConfig, private _bytecode: string, private readonly _interface: Interface, private readonly _contractName: string = "", ) { - this._config = _hre.config.migrate; - this._verifier = new Verifier(_hre, { - parallel: this._config.verifyParallel, - attempts: this._config.verifyAttempts, - }); - if (_contractName === "") { try { this._contractName = ArtifactProcessor.tryGetContractName(_bytecode); @@ -45,7 +32,7 @@ export class MinimalContract { } public async deploy(args: any[] = [], parameters: OverridesAndLibs = {}): Promise { - await fillParameters(this._hre, parameters); + await fillParameters(parameters); await this._tryLinkLibraries(parameters); @@ -64,12 +51,7 @@ export class MinimalContract { return; } - this._bytecode = await Linker.tryLinkBytecode( - this._hre, - this._contractName, - this._bytecode, - parameters.libraries || {}, - ); + this._bytecode = await Linker.tryLinkBytecode(this._contractName, this._bytecode, parameters.libraries || {}); } catch (e: any) { throw new MigrateError( `Unable to link libraries for ${this._contractName}! Try manually deploy the libraries and link them.\n Error: ${e.message}`, @@ -86,15 +68,15 @@ export class MinimalContract { // TODO: check the opportunity to use the populateTransaction method return { contractName: this._contractName, - chainId: await getChainId(this._hre), - from: (await getSignerHelper(this._hre, txOverrides.from)).address, + chainId: await getChainId(), + from: (await getSignerHelper(txOverrides.from)).address, ...(await factory.getDeployTransaction(...args, txOverrides)), }; } private async _recoverContractAddress(tx: ContractDeployTransactionWithContractName, args: any[]): Promise { try { - const contractAddress = await TransactionProcessor.tryRestoreContractAddressByKeyFields(tx, this._hre); + const contractAddress = await TransactionProcessor.tryRestoreContractAddressByKeyFields(tx); Reporter.notifyContractRecovery(tx.contractName, contractAddress); @@ -110,7 +92,7 @@ export class MinimalContract { tx: ContractDeployTransactionWithContractName, args: any[], ): Promise { - const signer: Signer = await getSignerHelper(this._hre, tx.from); + const signer: Signer = await getSignerHelper(tx.from); const txResponse = await signer.sendTransaction(tx); @@ -129,7 +111,7 @@ export class MinimalContract { contractAddress, contractName: tx.contractName, constructorArguments: args, - chainId: Number(await getChainId(this._hre)), + chainId: Number(await getChainId()), }); return contractAddress; diff --git a/src/deployer/adapters/AbstractEthersAdapter.ts b/src/deployer/adapters/AbstractEthersAdapter.ts index b4cf02d..5900fa4 100644 --- a/src/deployer/adapters/AbstractEthersAdapter.ts +++ b/src/deployer/adapters/AbstractEthersAdapter.ts @@ -8,36 +8,30 @@ import { Interface, } from "ethers"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; - import { Adapter } from "./Adapter"; +import { MinimalContract } from "../MinimalContract"; import { bytecodeToString, fillParameters, getMethodString, getSignerHelper } from "../../utils"; -import { EthersFactory, PureFactory } from "../../types/adapter"; import { OverridesAndLibs } from "../../types/deployer"; +import { KeyTransactionFields } from "../../types/tools"; +import { EthersFactory, PureFactory } from "../../types/adapter"; import { Reporter } from "../../tools/reporters/Reporter"; import { TransactionProcessor } from "../../tools/storage/TransactionProcessor"; -import { KeyTransactionFields } from "../../types/tools"; -import { MinimalContract } from "../MinimalContract"; type Factory = EthersFactory | PureFactory | ContractFactory; export abstract class AbstractEthersAdapter extends Adapter { private static _processedClasses = new Set(); - constructor(_hre: HardhatRuntimeEnvironment) { - super(_hre); - } - public getRawBytecode(instance: Factory): string { return bytecodeToString(instance.bytecode); } public async fromInstance(instance: Factory): Promise { return new MinimalContract( - this._hre, + this._config, this.getRawBytecode(instance), this.getInterface(instance), this.getContractName(instance), @@ -45,7 +39,7 @@ export abstract class AbstractEthersAdapter extends Adapter { } public async toInstance(instance: Factory, address: string, parameters: OverridesAndLibs): Promise { - const signer = await getSignerHelper(this._hre, parameters.from); + const signer = await getSignerHelper(parameters.from); const contract = new BaseContract(address, this.getInterface(instance), signer); @@ -54,7 +48,7 @@ export abstract class AbstractEthersAdapter extends Adapter { if (!AbstractEthersAdapter._processedClasses.has(contractName)) { AbstractEthersAdapter._processedClasses.add(contractName); - this.overrideConnectMethod(instance, contractName); + await this.overrideConnectMethod(instance, contractName); } return this.insertHandlers(contract, contractName, parameters) as unknown as I; @@ -120,7 +114,7 @@ export abstract class AbstractEthersAdapter extends Adapter { parameters: OverridesAndLibs, ): (...args: any[]) => Promise { return async (...args: any[]): Promise => { - await fillParameters(this._hre, parameters); + await fillParameters(parameters); const tx = (await oldMethod.populateTransaction(...args, parameters)) as KeyTransactionFields; const methodString = getMethodString(contractName, methodName, methodFragments, args); diff --git a/src/deployer/adapters/Adapter.ts b/src/deployer/adapters/Adapter.ts index 83d4bdc..318e8c3 100644 --- a/src/deployer/adapters/Adapter.ts +++ b/src/deployer/adapters/Adapter.ts @@ -1,7 +1,5 @@ import { Interface } from "ethers"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; - import { MinimalContract } from "../MinimalContract"; import { catchError } from "../../utils"; @@ -12,11 +10,7 @@ import { OverridesAndLibs } from "../../types/deployer"; @catchError export abstract class Adapter { - protected _config: MigrateConfig; - - protected constructor(protected _hre: HardhatRuntimeEnvironment) { - this._config = _hre.config.migrate; - } + public constructor(protected _config: MigrateConfig) {} public abstract fromInstance(instance: Instance): Promise; diff --git a/src/deployer/adapters/EthersAdapter.ts b/src/deployer/adapters/EthersAdapter.ts index 58a69cb..45202d1 100644 --- a/src/deployer/adapters/EthersAdapter.ts +++ b/src/deployer/adapters/EthersAdapter.ts @@ -1,11 +1,12 @@ import { BaseContract, ContractRunner, Interface } from "ethers"; +import { AbstractEthersAdapter } from "./AbstractEthersAdapter"; + import { catchError, getSignerHelper } from "../../utils"; import { EthersFactory } from "../../types/adapter"; import { ArtifactProcessor } from "../../tools/storage/ArtifactProcessor"; -import { AbstractEthersAdapter } from "./AbstractEthersAdapter"; @catchError export class EthersAdapter extends AbstractEthersAdapter { @@ -24,7 +25,7 @@ export class EthersAdapter extends AbstractEthersAdapter { public async overrideConnectMethod(instance: EthersFactory, contractName: string) { const connectMethod = instance.connect; - const defaultRunner = await getSignerHelper(this._hre); + const defaultRunner = await getSignerHelper(); instance.connect = (address: string, runner?: ContractRunner): I => { const contract = connectMethod(address, runner ?? defaultRunner) as BaseContract; diff --git a/src/deployer/adapters/PureAdapter.ts b/src/deployer/adapters/PureAdapter.ts index 1f40ff3..29c9d68 100644 --- a/src/deployer/adapters/PureAdapter.ts +++ b/src/deployer/adapters/PureAdapter.ts @@ -1,9 +1,10 @@ import { Interface } from "ethers"; +import { AbstractEthersAdapter } from "./AbstractEthersAdapter"; + import { catchError } from "../../utils"; import { PureFactory } from "../../types/adapter"; -import { AbstractEthersAdapter } from "./AbstractEthersAdapter"; @catchError export class PureAdapter extends AbstractEthersAdapter { diff --git a/src/deployer/adapters/PureEthersAdapter.ts b/src/deployer/adapters/PureEthersAdapter.ts index d437b5a..ca92e7b 100644 --- a/src/deployer/adapters/PureEthersAdapter.ts +++ b/src/deployer/adapters/PureEthersAdapter.ts @@ -1,9 +1,10 @@ import { Addressable, ContractFactory, Interface } from "ethers"; +import { AbstractEthersAdapter } from "./AbstractEthersAdapter"; + import { catchError } from "../../utils"; import { ArtifactProcessor } from "../../tools/storage/ArtifactProcessor"; -import { AbstractEthersAdapter } from "./AbstractEthersAdapter"; @catchError export class PureEthersAdapter extends AbstractEthersAdapter { diff --git a/src/deployer/adapters/TruffleAdapter.ts b/src/deployer/adapters/TruffleAdapter.ts index 2852700..bbe76e4 100644 --- a/src/deployer/adapters/TruffleAdapter.ts +++ b/src/deployer/adapters/TruffleAdapter.ts @@ -16,19 +16,18 @@ import { BaseTruffleMethod, OverridesAndLibs, TruffleTransactionResponse } from import { Reporter } from "../../tools/reporters/Reporter"; import { TruffleReporter } from "../../tools/reporters/TruffleReporter"; - import { ArtifactProcessor } from "../../tools/storage/ArtifactProcessor"; import { TransactionProcessor } from "../../tools/storage/TransactionProcessor"; @catchError export class TruffleAdapter extends Adapter { - constructor(_hre: HardhatRuntimeEnvironment) { - super(_hre); + constructor(private _hre: HardhatRuntimeEnvironment) { + super(_hre.config.migrate); } public async fromInstance(instance: EthersFactory): Promise { return new MinimalContract( - this._hre, + this._config, this.getRawBytecode(instance), this.getInterface(instance), this.getContractName(instance), @@ -165,16 +164,14 @@ export class TruffleAdapter extends Adapter { to: string, parameters: OverridesAndLibs, ): Promise { - await fillParameters(this._hre, parameters); + await fillParameters(parameters); - const tx: KeyTransactionFields = { + return { to: to, from: parameters.from! as string, data: toJSON(args), chainId: toBigInt(String(parameters.chainId)), value: toBigInt(String(parameters.value)), }; - - return tx; } } diff --git a/src/index.ts b/src/index.ts index b0f34b7..93bb45c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,12 +21,18 @@ import { TruffleAdapter } from "./deployer/adapters/TruffleAdapter"; import { Migrator } from "./migrator/Migrator"; import { Verifier } from "./verifier/Verifier"; +import { Provider } from "./tools/Provider"; +import { Linker } from "./deployer/Linker"; export { Deployer } from "./deployer/Deployer"; extendConfig(migrateConfigExtender); const migrate: ActionType = async (taskArgs, env) => { + Linker.setConfig(env.config.migrate); + Reporter.init(env.config.migrate); + await Provider.init(env); + env.config.migrate = mergeConfigs(taskArgs, env.config.migrate); // Make sure that contract artifacts are up-to-date. @@ -41,8 +47,6 @@ const migrate: ActionType = async (taskArgs, env) => { await ArtifactProcessor.parseArtifacts(env); - Reporter.init(env); - overrideTruffleRequire(env); await new Migrator(env).migrate(); @@ -55,7 +59,7 @@ const migrate: ActionType = async (taskArgs, env) => { const migrateVerify: ActionType = async (taskArgs, env) => { const config = extendVerifyConfigs(taskArgs); - Reporter.init(env); + Reporter.init(env.config.migrate); await new Verifier(env, config).verifyBatch( VerificationProcessor.restoreSavedVerificationFunctions(config.inputFile), diff --git a/src/tools/Provider.ts b/src/tools/Provider.ts new file mode 100644 index 0000000..65d67de --- /dev/null +++ b/src/tools/Provider.ts @@ -0,0 +1,14 @@ +import type { HardhatEthersProvider as HardhatEthersProviderT } from "@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider"; + +export class Provider { + public static provider: HardhatEthersProviderT; + + public static async init(hre: any): Promise { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const { HardhatEthersProvider } = require("@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider") as { + HardhatEthersProvider: typeof HardhatEthersProviderT; + }; + + this.provider = new HardhatEthersProvider(hre.network.provider, hre.network.name); + } +} diff --git a/src/tools/reporters/Reporter.ts b/src/tools/reporters/Reporter.ts index b3e6ded..a1c7c6c 100644 --- a/src/tools/reporters/Reporter.ts +++ b/src/tools/reporters/Reporter.ts @@ -1,26 +1,27 @@ /* eslint-disable no-console */ -import axios from "axios"; import ora from "ora"; +import axios from "axios"; import { Network, TransactionReceipt, TransactionResponse, formatEther, formatUnits } from "ethers"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { Provider } from "../Provider"; import { MigrateError } from "../../errors"; import { catchError, underline } from "../../utils"; +import { MigrateConfig } from "../../types/migrations"; import { ChainRecord, predefinedChains } from "../../types/verifier"; @catchError export class Reporter { - private static _hre: HardhatRuntimeEnvironment; + private static _config: MigrateConfig; private static totalCost: bigint = 0n; private static totalTransactions: number = 0; - public static init(hre: HardhatRuntimeEnvironment) { - this._hre = hre; + public static init(config: MigrateConfig) { + this._config = config; } public static async reportMigrationBegin(files: string[]) { @@ -44,7 +45,7 @@ export class Reporter { } public static async reportTransactionByHash(txHash: string, instanceName: string) { - const tx = await this._hre.ethers.provider.getTransaction(txHash); + const tx = await Provider.provider.getTransaction(txHash); if (!tx) { throw new MigrateError("Transaction not found."); @@ -55,7 +56,7 @@ export class Reporter { public static async reportTransaction(tx: TransactionResponse, instanceName: string) { const timeStart = Date.now(); - const blockStart = await this._hre.ethers.provider.getBlockNumber(); + const blockStart = await Provider.provider.getBlockNumber(); console.log("\n" + underline(this._parseTransactionTitle(tx, instanceName))); @@ -70,7 +71,7 @@ export class Reporter { let receipt: TransactionReceipt; try { // We will wait for both contract deployment and common transactions - receipt = (await tx.wait(this._hre.config.migrate.wait))!; + receipt = (await tx.wait(this._config.wait))!; } catch (e: any) { throw new MigrateError(`Transaction failed: ${e.message}`); } finally { @@ -81,8 +82,7 @@ export class Reporter { await this._printTransaction(receipt); - // TODO: do wee need add value to totalCost? - this.totalCost += receipt.fee; + this.totalCost += receipt.fee + tx.value ?? 0n; this.totalTransactions++; } @@ -156,7 +156,7 @@ export class Reporter { blockStart: number, ): Promise { return `Confirmations: ${await tx.confirmations()} Blocks: ${ - (await this._hre.ethers.provider.getBlockNumber()) - blockStart + (await Provider.provider.getBlockNumber()) - blockStart } Seconds: ${((Date.now() - startTime) / 1000).toFixed(0)}`; } @@ -222,7 +222,7 @@ export class Reporter { private static async _getNetwork(): Promise { try { - return this._hre.ethers.provider.getNetwork(); + return Provider.provider.getNetwork(); } catch { return new Network("Local Ethereum", 1337); } diff --git a/src/tools/storage/TransactionProcessor.ts b/src/tools/storage/TransactionProcessor.ts index d57b936..7022645 100644 --- a/src/tools/storage/TransactionProcessor.ts +++ b/src/tools/storage/TransactionProcessor.ts @@ -1,7 +1,5 @@ import { ContractDeployTransaction, ContractTransactionResponse, isAddress } from "ethers"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; - import { TransactionStorage } from "./MigrateStorage"; import { MigrateError } from "../../errors"; @@ -47,10 +45,7 @@ export class TransactionProcessor { } @validateKeyDeploymentFields - public static async tryRestoreContractAddressByKeyFields( - key: ContractDeployTransaction, - hre: HardhatRuntimeEnvironment, - ): Promise { + public static async tryRestoreContractAddressByKeyFields(key: ContractDeployTransaction): Promise { const contractAddress = this._tryGetDataFromStorage( createKeyDeploymentFieldsHash({ data: key.data, @@ -60,20 +55,17 @@ export class TransactionProcessor { }), ); - if (!isAddress(contractAddress) || !(await isDeployedContractAddress(hre, contractAddress))) { + if (!isAddress(contractAddress) || !(await isDeployedContractAddress(contractAddress))) { throw new MigrateError(`Contract address is not valid`); } return contractAddress; } - public static async tryRestoreContractAddressByName( - contractName: string, - hre: HardhatRuntimeEnvironment, - ): Promise { + public static async tryRestoreContractAddressByName(contractName: string): Promise { const contractAddress = this._tryGetDataFromStorage(contractName); - if (!isAddress(contractAddress) || !(await isDeployedContractAddress(hre, contractAddress))) { + if (!isAddress(contractAddress) || !(await isDeployedContractAddress(contractAddress))) { throw new MigrateError(`Contract address is not valid`); } diff --git a/src/utils.ts b/src/utils.ts index 3c52f1f..d3dc1c8 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,37 +1,33 @@ import { join } from "path"; import { realpathSync, existsSync } from "fs"; -import { AddressLike, FunctionFragment, hexlify, id, Overrides, toBigInt } from "ethers"; +import { AddressLike, ethers, FunctionFragment, hexlify, id, Overrides, toBigInt } from "ethers"; import { isBytes } from "@ethersproject/bytes"; import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; - import { MigrateError } from "./errors"; import { KeyDeploymentFields, KeyTransactionFields } from "./types/tools"; import { Bytecode } from "./types/deployer"; +import { Provider } from "./tools/Provider"; -export async function getSignerHelper( - hre: HardhatRuntimeEnvironment, - from?: null | AddressLike, -): Promise { +export async function getSignerHelper(from?: null | AddressLike): Promise { if (!from) { - return hre.ethers.provider.getSigner(); + return Provider.provider.getSigner(); } - const address = await hre.ethers.resolveAddress(from, hre.ethers.provider); + const address = await ethers.resolveAddress(from, Provider.provider); - return hre.ethers.getSigner(address); + return Provider.provider.getSigner(address); } -export async function fillParameters(hre: HardhatRuntimeEnvironment, parameters: Overrides): Promise { +export async function fillParameters(parameters: Overrides): Promise { if (parameters.from === undefined) { - parameters.from = await (await hre.ethers.provider.getSigner()).getAddress(); + parameters.from = await (await Provider.provider.getSigner()).getAddress(); } if (parameters.chainId === undefined) { - parameters.chainId = await getChainId(hre); + parameters.chainId = await getChainId(); } if (parameters.value === undefined) { @@ -53,8 +49,8 @@ export function resolvePathToFile(path: string, file: string = ""): string { return join(realpathSync(path), file); } -export async function getChainId(hre: HardhatRuntimeEnvironment): Promise { - return toBigInt(await hre.ethers.provider.send("eth_chainId")); +export async function getChainId(): Promise { + return toBigInt(await Provider.provider.send("eth_chainId")); } export function toJSON(data: any): string { @@ -96,8 +92,8 @@ export function createKeyTxFieldsHash(keyTxFields: KeyTransactionFields): string return id(toJSON(obj)); } -export async function isDeployedContractAddress(hre: HardhatRuntimeEnvironment, address: string): Promise { - return (await hre.ethers.provider.getCode(address)) !== "0x"; +export async function isDeployedContractAddress(address: string): Promise { + return (await Provider.provider.getCode(address)) !== "0x"; } export function bytecodeToString(bytecode: Bytecode): string { @@ -143,9 +139,9 @@ export function getMethodString( return methodSting; } -export async function waitForBlock(hre: HardhatRuntimeEnvironment, desiredBlock: number) { +export async function waitForBlock(desiredBlock: number) { return new Promise((resolve) => { - hre.ethers.provider.on("block", (blockNumber) => { + Provider.provider.on("block", (blockNumber) => { if (blockNumber == desiredBlock) { resolve(); } diff --git a/src/verifier/Verifier.ts b/src/verifier/Verifier.ts index f34a090..392048c 100644 --- a/src/verifier/Verifier.ts +++ b/src/verifier/Verifier.ts @@ -25,7 +25,7 @@ export class Verifier { public async verify(verifierArgs: VerifierArgs): Promise { const { contractAddress, contractName, constructorArguments, chainId } = verifierArgs; - if (chainId && Number(await getChainId(this._hre)) != chainId) { + if (chainId && Number(await getChainId()) != chainId) { // TODO: Add actions for this case. return; } diff --git a/test/integration/adapters/ethersAdapter.ts b/test/integration/adapters/ethersAdapter.ts index f01f756..95d389a 100644 --- a/test/integration/adapters/ethersAdapter.ts +++ b/test/integration/adapters/ethersAdapter.ts @@ -8,6 +8,8 @@ import { ArtifactProcessor } from "../../../src/tools/storage/ArtifactProcessor" import { PureEthersAdapter } from "../../../src/deployer/adapters/PureEthersAdapter"; import { ContractWithConstructorArguments__factory } from "../../fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types"; +import { Provider } from "../../../src/tools/Provider"; +import { Reporter } from "../../../src/tools/reporters/Reporter"; describe("EthersAdapter", () => { describe("getContractDeployParams()", () => { @@ -47,13 +49,18 @@ describe("EthersAdapter", () => { describe("pure ethers", () => { useEnvironment("minimal-ethers"); + beforeEach(async function () { + await Provider.init(this.hre); + Reporter.init(this.hre.config.migrate); + }); + let ContractWithConstructor: ContractFactory; beforeEach("setup", async function () { pureEhtersAdapter = new PureEthersAdapter(this.hre); await ArtifactProcessor.parseArtifacts(this.hre); - ContractWithConstructor = await this.hre.ethers.getContractFactory("ContractWithConstructorArguments"); + ContractWithConstructor = (new ContractWithConstructorArguments__factory()); }); it("should get abi", async () => { @@ -72,6 +79,11 @@ describe("EthersAdapter", () => { describe("with typechain", () => { useEnvironment("minimal-typechain-ethers"); + beforeEach(async function () { + await Provider.init(this.hre); + Reporter.init(this.hre.config.migrate); + }); + beforeEach("setup", async function () { ethersAdapter = new EthersAdapter(this.hre); await ArtifactProcessor.parseArtifacts(this.hre); diff --git a/test/integration/adapters/truffleAdapter.ts b/test/integration/adapters/truffleAdapter.ts index 1f99196..d5d71e8 100644 --- a/test/integration/adapters/truffleAdapter.ts +++ b/test/integration/adapters/truffleAdapter.ts @@ -7,6 +7,8 @@ import { useEnvironment } from "../../helpers"; import { TruffleAdapter } from "../../../src/deployer/adapters/TruffleAdapter"; import { ArtifactProcessor } from "../../../src/tools/storage/ArtifactProcessor"; +import { Provider } from "../../../src/tools/Provider"; +import { Reporter } from "../../../src/tools/reporters/Reporter"; describe("TruffleAdapter", () => { describe("getContractDeployParams()", () => { @@ -42,9 +44,14 @@ describe("TruffleAdapter", () => { let adapter: TruffleAdapter; - context("with pure truffle", () => { + describe("with pure truffle", () => { useEnvironment("minimal-truffle"); + beforeEach(async function () { + await Provider.init(this.hre); + Reporter.init(this.hre.config.migrate); + }); + let contractWithConstructorArtifact: TruffleContract; beforeEach("setup", async function () { @@ -67,9 +74,14 @@ describe("TruffleAdapter", () => { }); }); - context("with typechain", () => { + describe("with typechain", () => { useEnvironment("minimal-typechain-truffle"); + beforeEach(async function () { + await Provider.init(this.hre); + Reporter.init(this.hre.config.migrate); + }); + let contractWithConstructorArtifact: TruffleContract; beforeEach("setup", async function () { diff --git a/test/integration/deployer/deployEthers.ts b/test/integration/deployer/deployEthers.ts index 740fbf4..4420bc5 100644 --- a/test/integration/deployer/deployEthers.ts +++ b/test/integration/deployer/deployEthers.ts @@ -6,11 +6,21 @@ import { useEnvironment } from "../../helpers"; import { Deployer } from "../../../src/deployer/Deployer"; import { TransactionStorage } from "../../../src/tools/storage/MigrateStorage"; import { Reporter } from "../../../src/tools/reporters/Reporter"; +import { Provider } from "../../../src/tools/Provider"; +import { + ContractWithConstructorArguments__factory, + ContractWithPayableConstructor__factory, +} from "../../fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types"; describe("deployer", () => { describe("deploy()", () => { useEnvironment("minimal-ethers"); + beforeEach(async function () { + await Provider.init(this.hre); + Reporter.init(this.hre.config.migrate); + }); + let deployer: Deployer; let ContractWithConstructor: ContractFactory; let ContractWithPayableConstructor: ContractFactory; @@ -18,11 +28,14 @@ describe("deployer", () => { beforeEach("setup", async function () { deployer = new Deployer(this.hre); - Reporter.init(this.hre); TransactionStorage.clear(); - ContractWithConstructor = await this.hre.ethers.getContractFactory("ContractWithConstructorArguments"); - ContractWithPayableConstructor = await this.hre.ethers.getContractFactory("ContractWithPayableConstructor"); + ContractWithConstructor = >( + (new ContractWithConstructorArguments__factory()) + ); + ContractWithPayableConstructor = >( + (new ContractWithPayableConstructor__factory()) + ); }); it("should deploy contract with constructor arguments", async function () { @@ -38,7 +51,7 @@ describe("deployer", () => { const contract = await deployer.deploy(ContractWithPayableConstructor, [], { value: value }); - expect(await this.hre.ethers.provider.getBalance(contract.getAddress())).to.equal(value); + expect(await Provider.provider.getBalance(contract.getAddress())).to.equal(value); }); it("should revert if artifact is not a contract", async function () { diff --git a/test/integration/deployer/deployTruffle.ts b/test/integration/deployer/deployTruffle.ts index 6f466a3..af545d7 100644 --- a/test/integration/deployer/deployTruffle.ts +++ b/test/integration/deployer/deployTruffle.ts @@ -8,18 +8,23 @@ import { Deployer } from "../../../src/deployer/Deployer"; import { TransactionStorage } from "../../../src/tools/storage/MigrateStorage"; import { Reporter } from "../../../src/tools/reporters/Reporter"; +import { Provider } from "../../../src/tools/Provider"; describe("Truffle -- deployer", () => { describe("deploy()", () => { useEnvironment("minimal-truffle"); + beforeEach(async function () { + await Provider.init(this.hre); + Reporter.init(this.hre.config.migrate); + }); + let contractWithConstructorArtifact: TruffleContract; let deployer: Deployer; beforeEach("setup", async function () { deployer = new Deployer(this.hre); - Reporter.init(this.hre); TransactionStorage.clear(); contractWithConstructorArtifact = await this.hre.artifacts.require("ContractWithConstructorArguments"); diff --git a/test/integration/deployer/deployTypechainEthers.ts b/test/integration/deployer/deployTypechainEthers.ts index 9b493f3..713d721 100644 --- a/test/integration/deployer/deployTypechainEthers.ts +++ b/test/integration/deployer/deployTypechainEthers.ts @@ -15,11 +15,19 @@ import { Library2__factory, } from "../../fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types"; import { Reporter } from "../../../src/tools/reporters/Reporter"; +import { Provider } from "../../../src/tools/Provider"; +import { Linker } from "../../../src/deployer/Linker"; describe("Ehters Typechain -- Deployer", () => { describe("deploy()", () => { useEnvironment("minimal-typechain-ethers"); + beforeEach(async function () { + await Provider.init(this.hre); + Reporter.init(this.hre.config.migrate); + Linker.setConfig(this.hre.config.migrate); + }); + let deployer: Deployer; beforeEach("setup", async function () { @@ -27,7 +35,6 @@ describe("Ehters Typechain -- Deployer", () => { await ArtifactProcessor.parseArtifacts(this.hre); - Reporter.init(this.hre); TransactionStorage.clear(); }); diff --git a/test/integration/deployer/deployTypechainTruffle.ts b/test/integration/deployer/deployTypechainTruffle.ts index c4c5cb9..bc05622 100644 --- a/test/integration/deployer/deployTypechainTruffle.ts +++ b/test/integration/deployer/deployTypechainTruffle.ts @@ -9,11 +9,19 @@ import { Deployer } from "../../../src/deployer/Deployer"; import { Reporter } from "../../../src/tools/reporters/Reporter"; import { TransactionStorage } from "../../../src/tools/storage/MigrateStorage"; +import { Provider } from "../../../src/tools/Provider"; +import { Linker } from "../../../src/deployer/Linker"; describe("Truffle Typechain -- Deployer", () => { describe("deploy()", () => { useEnvironment("minimal-typechain-truffle"); + beforeEach(async function () { + await Provider.init(this.hre); + Reporter.init(this.hre.config.migrate); + Linker.setConfig(this.hre.config.migrate); + }); + let contractWithConstructorArtifact: TruffleContract; let ContractWithExternalLibraryArtifact: TruffleContract; let library1Artifact: TruffleContract; @@ -23,7 +31,6 @@ describe("Truffle Typechain -- Deployer", () => { beforeEach("setup", async function () { deployer = new Deployer(this.hre); - Reporter.init(this.hre); TransactionStorage.clear(); contractWithConstructorArtifact = await this.hre.artifacts.require("ContractWithConstructorArguments"); diff --git a/test/integration/transaction-storage.ts b/test/integration/transaction-storage.ts index 235a2ec..67c7e90 100644 --- a/test/integration/transaction-storage.ts +++ b/test/integration/transaction-storage.ts @@ -13,16 +13,19 @@ import { ContractWithPayableConstructor__factory, } from "../fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types"; import { Reporter } from "../../src/tools/reporters/Reporter"; +import { Provider } from "../../src/tools/Provider"; describe("TransactionStorage", async () => { useEnvironment("repeats-typechain-ethers"); beforeEach(async function () { + await Provider.init(this.hre); + Reporter.init(this.hre.config.migrate); + await ArtifactProcessor.parseArtifacts(this.hre); }); afterEach(async function () { - Reporter.init(this.hre); TransactionStorage.clear(); }); @@ -47,10 +50,7 @@ describe("TransactionStorage", async () => { value: 0, }); - assert.equal( - await TransactionProcessor.tryRestoreContractAddressByKeyFields(tx, this.hre), - await contract.getAddress(), - ); + assert.equal(await TransactionProcessor.tryRestoreContractAddressByKeyFields(tx), await contract.getAddress()); }); it("should save deployment transaction by name", async function () { @@ -59,7 +59,6 @@ describe("TransactionStorage", async () => { assert.equal( await TransactionProcessor.tryRestoreContractAddressByName( "contracts/another-contracts/Contracts.sol:ContractWithConstructorArguments", - this.hre, ), await contract.getAddress(), ); @@ -80,10 +79,7 @@ describe("TransactionStorage", async () => { chainId: await deployer.getChainId(), }); - assert.equal( - await TransactionProcessor.tryRestoreContractAddressByKeyFields(tx, this.hre), - await contract.getAddress(), - ); + assert.equal(await TransactionProcessor.tryRestoreContractAddressByKeyFields(tx), await contract.getAddress()); }); it("should differ contracts with chainId", async function () { @@ -100,7 +96,7 @@ describe("TransactionStorage", async () => { value: 0, }); - await expect(TransactionProcessor.tryRestoreContractAddressByKeyFields(data, this.hre)).to.be.rejectedWith( + await expect(TransactionProcessor.tryRestoreContractAddressByKeyFields(data)).to.be.rejectedWith( "Transaction not found in storage", ); }); @@ -119,7 +115,7 @@ describe("TransactionStorage", async () => { value: 0, }); - await expect(TransactionProcessor.tryRestoreContractAddressByKeyFields(tx, this.hre)).to.be.rejectedWith( + await expect(TransactionProcessor.tryRestoreContractAddressByKeyFields(tx)).to.be.rejectedWith( "Transaction not found in storage", ); }); @@ -139,10 +135,7 @@ describe("TransactionStorage", async () => { value: 0, }); - assert.equal( - await TransactionProcessor.tryRestoreContractAddressByKeyFields(data, this.hre), - await contract.getAddress(), - ); + assert.equal(await TransactionProcessor.tryRestoreContractAddressByKeyFields(data), await contract.getAddress()); }); it("should differ contracts with args", async function () { @@ -159,7 +152,7 @@ describe("TransactionStorage", async () => { value: 0, }); - await expect(TransactionProcessor.tryRestoreContractAddressByKeyFields(data, this.hre)).to.be.rejectedWith( + await expect(TransactionProcessor.tryRestoreContractAddressByKeyFields(data)).to.be.rejectedWith( "Transaction not found in storage", ); }); diff --git a/tsconfig.json b/tsconfig.json index e001075..89a3674 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,8 @@ "outDir": "./dist", "experimentalDecorators": true, "types": [ - "@nomiclabs/hardhat-truffle5" + "@nomiclabs/hardhat-truffle5", + "@nomicfoundation/hardhat-ethers" ] }, "exclude": [ From cccdd37c5972b9270ce6706fdbf7e76b8afdac37 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Fri, 27 Oct 2023 16:15:35 +0200 Subject: [PATCH 24/36] added 'address' property to BaseContract --- src/deployer/adapters/AbstractEthersAdapter.ts | 7 +++++++ src/index.ts | 13 +++++++------ src/type-extensions.ts | 7 +++++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/deployer/adapters/AbstractEthersAdapter.ts b/src/deployer/adapters/AbstractEthersAdapter.ts index 5900fa4..0722d1a 100644 --- a/src/deployer/adapters/AbstractEthersAdapter.ts +++ b/src/deployer/adapters/AbstractEthersAdapter.ts @@ -11,6 +11,8 @@ import { import { Adapter } from "./Adapter"; import { MinimalContract } from "../MinimalContract"; +import "../../type-extensions"; + import { bytecodeToString, fillParameters, getMethodString, getSignerHelper } from "../../utils"; import { OverridesAndLibs } from "../../types/deployer"; @@ -51,6 +53,7 @@ export abstract class AbstractEthersAdapter extends Adapter { await this.overrideConnectMethod(instance, contractName); } + this._insertAddressGetter(contract, address); return this.insertHandlers(contract, contractName, parameters) as unknown as I; } @@ -96,6 +99,10 @@ export abstract class AbstractEthersAdapter extends Adapter { public abstract overrideConnectMethod(instance: Factory, contractName: string): Promise; + private _insertAddressGetter(contract: BaseContract, contractAddress: string): void { + contract.address = contractAddress; + } + private _getContractFunctionFragments(contractInterface: Interface): FunctionFragment[] { const result: FunctionFragment[] = []; diff --git a/src/index.ts b/src/index.ts index 93bb45c..0c92cf2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,30 +1,31 @@ import "@nomicfoundation/hardhat-verify"; -import { lazyFunction, lazyObject } from "hardhat/plugins"; import { TASK_COMPILE } from "hardhat/builtin-tasks/task-names"; -import { ActionType, HardhatRuntimeEnvironment } from "hardhat/types"; import { extendConfig, extendEnvironment, task, types } from "hardhat/config"; +import { lazyFunction, lazyObject } from "hardhat/plugins"; +import { ActionType, HardhatRuntimeEnvironment } from "hardhat/types"; import "./type-extensions"; -import { TASK_MIGRATE, TASK_MIGRATE_VERIFY } from "./constants"; import { extendVerifyConfigs, mergeConfigs, migrateConfigExtender } from "./config"; +import { TASK_MIGRATE, TASK_MIGRATE_VERIFY } from "./constants"; import { MigrateConfig, MigrateVerifyConfig } from "./types/migrations"; import { Reporter } from "./tools/reporters/Reporter"; import { ArtifactProcessor } from "./tools/storage/ArtifactProcessor"; -import { VerificationProcessor } from "./tools/storage/VerificationProcessor"; import { DefaultStorage, MigrateStorage } from "./tools/storage/MigrateStorage"; +import { VerificationProcessor } from "./tools/storage/VerificationProcessor"; import { TruffleAdapter } from "./deployer/adapters/TruffleAdapter"; +import { Linker } from "./deployer/Linker"; import { Migrator } from "./migrator/Migrator"; -import { Verifier } from "./verifier/Verifier"; import { Provider } from "./tools/Provider"; -import { Linker } from "./deployer/Linker"; +import { Verifier } from "./verifier/Verifier"; export { Deployer } from "./deployer/Deployer"; +export { DefaultStorage } from "./tools/storage/MigrateStorage"; extendConfig(migrateConfigExtender); diff --git a/src/type-extensions.ts b/src/type-extensions.ts index c5946b3..72bd4f9 100644 --- a/src/type-extensions.ts +++ b/src/type-extensions.ts @@ -1,3 +1,4 @@ +import "ethers"; import "hardhat/types/config"; import "hardhat/types/runtime"; @@ -23,3 +24,9 @@ declare module "hardhat/types/runtime" { storage: MigrateStorage; } } + +declare module "ethers" { + interface BaseContract { + address: string; + } +} From 42f57659cfcadfccf5ec9fd736f063675df15335 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 27 Oct 2023 17:44:53 +0300 Subject: [PATCH 25/36] Deleted redundant VerificationProcessor --- src/migrator/Migrator.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/migrator/Migrator.ts b/src/migrator/Migrator.ts index d194bf4..63f89f0 100644 --- a/src/migrator/Migrator.ts +++ b/src/migrator/Migrator.ts @@ -16,7 +16,6 @@ import { Deployer } from "../deployer/Deployer"; import { Verifier } from "../verifier/Verifier"; import { Reporter } from "../tools/reporters/Reporter"; -import { VerificationProcessor } from "../tools/storage/VerificationProcessor"; export class Migrator { private readonly _deployer: Deployer; @@ -56,10 +55,6 @@ export class Migrator { } } - if (this._config.verify) { - await this._verifier.verifyBatch(VerificationProcessor.restoreSavedVerificationFunctions()); - } - await Reporter.summary(); } From 5f810b6683f8863e459a070a82f1af50edb3a193 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 27 Oct 2023 17:45:17 +0300 Subject: [PATCH 26/36] Mentioned some insights --- src/deployer/MinimalContract.ts | 1 + src/deployer/adapters/TruffleAdapter.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/deployer/MinimalContract.ts b/src/deployer/MinimalContract.ts index 3422f1b..d0c111f 100644 --- a/src/deployer/MinimalContract.ts +++ b/src/deployer/MinimalContract.ts @@ -76,6 +76,7 @@ export class MinimalContract { private async _recoverContractAddress(tx: ContractDeployTransactionWithContractName, args: any[]): Promise { try { + // TODO: firstly try to recover by contract name. Think about edge cases. const contractAddress = await TransactionProcessor.tryRestoreContractAddressByKeyFields(tx); Reporter.notifyContractRecovery(tx.contractName, contractAddress); diff --git a/src/deployer/adapters/TruffleAdapter.ts b/src/deployer/adapters/TruffleAdapter.ts index bbe76e4..f3d9ba2 100644 --- a/src/deployer/adapters/TruffleAdapter.ts +++ b/src/deployer/adapters/TruffleAdapter.ts @@ -54,6 +54,7 @@ export class TruffleAdapter extends Adapter { return ArtifactProcessor.tryGetContractName(this.getRawBytecode(instance)); } catch { // It is possible was called abstract contract + // TODO: Add Contract Name to Overrides. return (instance as any).contractName || "Unknown Contract"; } } From f134b98cf1eb0defa270d97f416fec8e05ab5020 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Fri, 27 Oct 2023 16:51:21 +0200 Subject: [PATCH 27/36] updated package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6741b96..24a4dde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@solarity/hardhat-migrate", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.3", "description": "Automatic deployment and verification of smart contracts", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", From 698503842b2720647e3d3500c39e5df57c4e3989 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 27 Oct 2023 18:00:55 +0300 Subject: [PATCH 28/36] Fixed bug with config --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 0c92cf2..043a71d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -30,12 +30,13 @@ export { DefaultStorage } from "./tools/storage/MigrateStorage"; extendConfig(migrateConfigExtender); const migrate: ActionType = async (taskArgs, env) => { - Linker.setConfig(env.config.migrate); - Reporter.init(env.config.migrate); await Provider.init(env); env.config.migrate = mergeConfigs(taskArgs, env.config.migrate); + Linker.setConfig(env.config.migrate); + Reporter.init(env.config.migrate); + // Make sure that contract artifacts are up-to-date. await env.run(TASK_COMPILE, { quiet: true, From a7f4791f6adefa72a8bd0a64a1a022a9849191e8 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 27 Oct 2023 18:11:39 +0300 Subject: [PATCH 29/36] Fixed UX reporter --- src/tools/reporters/Reporter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/reporters/Reporter.ts b/src/tools/reporters/Reporter.ts index a1c7c6c..09b4964 100644 --- a/src/tools/reporters/Reporter.ts +++ b/src/tools/reporters/Reporter.ts @@ -155,9 +155,9 @@ export class Reporter { startTime: number, blockStart: number, ): Promise { - return `Confirmations: ${await tx.confirmations()} Blocks: ${ + return `Confirmations: ${await tx.confirmations()}; Blocks: ${ (await Provider.provider.getBlockNumber()) - blockStart - } Seconds: ${((Date.now() - startTime) / 1000).toFixed(0)}`; + }; Seconds: ${((Date.now() - startTime) / 1000).toFixed(0)}`; } private static async _getExplorerLink(txHash: string): Promise { From e50ed00e7c72cd5b9590d9ce802713aeecd49578 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 27 Oct 2023 18:25:48 +0300 Subject: [PATCH 30/36] Refactored redundant setAsDeployed --- src/deployer/Deployer.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts index 036e66f..850dae9 100644 --- a/src/deployer/Deployer.ts +++ b/src/deployer/Deployer.ts @@ -38,29 +38,20 @@ export class Deployer { return adapter.toInstance(contract, contractAddress, parameters); } - public setAsDeployed( - contract: Instance | (T extends Truffle.Contract ? T : never), - address: string, - ): void { - const adapter = this._resolveAdapter(contract); - - const contractName = adapter.getContractName(contract); - - TransactionProcessor.saveDeploymentTransactionWithContractName(contractName, address); - } - public async deployed( contract: Instance | (T extends Truffle.Contract ? T : never), contractAddress?: string, ): Promise { const adapter = this._resolveAdapter(contract); + const contractName = adapter.getContractName(contract); if (contractAddress) { if (!(await isDeployedContractAddress(contractAddress))) { throw new MigrateError(`Contract with address '${contractAddress}' is not deployed`); } + + TransactionProcessor.saveDeploymentTransactionWithContractName(contractName, contractAddress); } else { - const contractName = adapter.getContractName(contract); contractAddress = await TransactionProcessor.tryRestoreContractAddressByName(contractName); } From 35d3f56a2ec1e5ca7a925c7a954a1b02210bf1d0 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 27 Oct 2023 18:30:43 +0300 Subject: [PATCH 31/36] Clarified names --- src/deployer/Deployer.ts | 12 ++++++------ .../adapters/{PureAdapter.ts => BytecodeAdapter.ts} | 2 +- .../{EthersAdapter.ts => EthersContractAdapter.ts} | 2 +- ...{PureEthersAdapter.ts => EthersFactoryAdapter.ts} | 2 +- test/integration/adapters/ethersAdapter.ts | 12 ++++++------ 5 files changed, 15 insertions(+), 15 deletions(-) rename src/deployer/adapters/{PureAdapter.ts => BytecodeAdapter.ts} (90%) rename src/deployer/adapters/{EthersAdapter.ts => EthersContractAdapter.ts} (94%) rename src/deployer/adapters/{PureEthersAdapter.ts => EthersFactoryAdapter.ts} (93%) diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts index 850dae9..c81441d 100644 --- a/src/deployer/Deployer.ts +++ b/src/deployer/Deployer.ts @@ -7,10 +7,10 @@ import { catchError, getChainId, getSignerHelper, isDeployedContractAddress } fr import { MigrateError } from "../errors"; import { Adapter } from "./adapters/Adapter"; -import { PureAdapter } from "./adapters/PureAdapter"; -import { EthersAdapter } from "./adapters/EthersAdapter"; +import { BytecodeAdapter } from "./adapters/BytecodeAdapter"; +import { EthersContractAdapter } from "./adapters/EthersContractAdapter"; import { TruffleAdapter } from "./adapters/TruffleAdapter"; -import { PureEthersAdapter } from "./adapters/PureEthersAdapter"; +import { EthersFactoryAdapter } from "./adapters/EthersFactoryAdapter"; import { OverridesAndLibs } from "../types/deployer"; import { KeyTransactionFields } from "../types/tools"; @@ -97,7 +97,7 @@ export class Deployer { private _resolveAdapter(contract: Instance): Adapter { if (isEthersFactory(contract)) { - return new EthersAdapter(this._hre.config.migrate); + return new EthersContractAdapter(this._hre.config.migrate); } if (isTruffleFactory(contract)) { @@ -105,11 +105,11 @@ export class Deployer { } if (isPureFactory(contract)) { - return new PureAdapter(this._hre.config.migrate); + return new BytecodeAdapter(this._hre.config.migrate); } if (isContractFactory(contract)) { - return new PureEthersAdapter(this._hre.config.migrate); + return new EthersFactoryAdapter(this._hre.config.migrate); } throw new MigrateError("Unknown Contract Factory Type"); diff --git a/src/deployer/adapters/PureAdapter.ts b/src/deployer/adapters/BytecodeAdapter.ts similarity index 90% rename from src/deployer/adapters/PureAdapter.ts rename to src/deployer/adapters/BytecodeAdapter.ts index 29c9d68..99067e8 100644 --- a/src/deployer/adapters/PureAdapter.ts +++ b/src/deployer/adapters/BytecodeAdapter.ts @@ -7,7 +7,7 @@ import { catchError } from "../../utils"; import { PureFactory } from "../../types/adapter"; @catchError -export class PureAdapter extends AbstractEthersAdapter { +export class BytecodeAdapter extends AbstractEthersAdapter { public getInterface(instance: PureFactory): Interface { return Interface.from(instance.abi); } diff --git a/src/deployer/adapters/EthersAdapter.ts b/src/deployer/adapters/EthersContractAdapter.ts similarity index 94% rename from src/deployer/adapters/EthersAdapter.ts rename to src/deployer/adapters/EthersContractAdapter.ts index 45202d1..fee1d50 100644 --- a/src/deployer/adapters/EthersAdapter.ts +++ b/src/deployer/adapters/EthersContractAdapter.ts @@ -9,7 +9,7 @@ import { EthersFactory } from "../../types/adapter"; import { ArtifactProcessor } from "../../tools/storage/ArtifactProcessor"; @catchError -export class EthersAdapter extends AbstractEthersAdapter { +export class EthersContractAdapter extends AbstractEthersAdapter { public getInterface(instance: EthersFactory): Interface { return Interface.from(instance.abi); } diff --git a/src/deployer/adapters/PureEthersAdapter.ts b/src/deployer/adapters/EthersFactoryAdapter.ts similarity index 93% rename from src/deployer/adapters/PureEthersAdapter.ts rename to src/deployer/adapters/EthersFactoryAdapter.ts index ca92e7b..784004b 100644 --- a/src/deployer/adapters/PureEthersAdapter.ts +++ b/src/deployer/adapters/EthersFactoryAdapter.ts @@ -7,7 +7,7 @@ import { catchError } from "../../utils"; import { ArtifactProcessor } from "../../tools/storage/ArtifactProcessor"; @catchError -export class PureEthersAdapter extends AbstractEthersAdapter { +export class EthersFactoryAdapter extends AbstractEthersAdapter { public getInterface(instance: ContractFactory): Interface { return instance.interface; } diff --git a/test/integration/adapters/ethersAdapter.ts b/test/integration/adapters/ethersAdapter.ts index 95d389a..ffc9173 100644 --- a/test/integration/adapters/ethersAdapter.ts +++ b/test/integration/adapters/ethersAdapter.ts @@ -3,9 +3,9 @@ import { ContractFactory, Interface } from "ethers"; import { useEnvironment } from "../../helpers"; -import { EthersAdapter } from "../../../src/deployer/adapters/EthersAdapter"; +import { EthersContractAdapter } from "../../../src/deployer/adapters/EthersContractAdapter"; import { ArtifactProcessor } from "../../../src/tools/storage/ArtifactProcessor"; -import { PureEthersAdapter } from "../../../src/deployer/adapters/PureEthersAdapter"; +import { EthersFactoryAdapter } from "../../../src/deployer/adapters/EthersFactoryAdapter"; import { ContractWithConstructorArguments__factory } from "../../fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types"; import { Provider } from "../../../src/tools/Provider"; @@ -43,8 +43,8 @@ describe("EthersAdapter", () => { const contractWithConstructorBytecode = "0x608060405234801561001057600080fd5b5060405161033e38038061033e8339818101604052602081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b8382019150602082018581111561006957600080fd5b825186600182028301116401000000008211171561008657600080fd5b8083526020830192505050908051906020019080838360005b838110156100ba57808201518184015260208101905061009f565b50505050905090810190601f1680156100e75780820380516001836020036101000a031916815260200191505b50604052505050806000908051906020019061010492919061010b565b50506101a8565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061014c57805160ff191683800117855561017a565b8280016001018555821561017a579182015b8281111561017957825182559160200191906001019061015e565b5b509050610187919061018b565b5090565b5b808211156101a457600081600090555060010161018c565b5090565b610187806101b76000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806306fdde0314610030575b600080fd5b6100386100b3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561007857808201518184015260208101905061005d565b50505050905090810190601f1680156100a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101495780601f1061011e57610100808354040283529160200191610149565b820191906000526020600020905b81548152906001019060200180831161012c57829003601f168201915b50505050508156fea2646970667358221220fafcb337be24b0cc0bd237410e96c0372e20d83b64721391a45edbe34a57235764736f6c63430007030033"; - let ethersAdapter: EthersAdapter; - let pureEhtersAdapter: PureEthersAdapter; + let ethersAdapter: EthersContractAdapter; + let pureEhtersAdapter: EthersFactoryAdapter; describe("pure ethers", () => { useEnvironment("minimal-ethers"); @@ -57,7 +57,7 @@ describe("EthersAdapter", () => { let ContractWithConstructor: ContractFactory; beforeEach("setup", async function () { - pureEhtersAdapter = new PureEthersAdapter(this.hre); + pureEhtersAdapter = new EthersFactoryAdapter(this.hre); await ArtifactProcessor.parseArtifacts(this.hre); ContractWithConstructor = (new ContractWithConstructorArguments__factory()); @@ -85,7 +85,7 @@ describe("EthersAdapter", () => { }); beforeEach("setup", async function () { - ethersAdapter = new EthersAdapter(this.hre); + ethersAdapter = new EthersContractAdapter(this.hre); await ArtifactProcessor.parseArtifacts(this.hre); }); From 5330ce1285f23f3bbb0cbf8a24693ddeb5588aad Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Fri, 27 Oct 2023 18:42:23 +0200 Subject: [PATCH 32/36] trying get deployed contract by name first --- src/deployer/Deployer.ts | 4 +-- src/deployer/MinimalContract.ts | 20 +++++++++---- .../adapters/AbstractEthersAdapter.ts | 8 ++--- src/deployer/adapters/Adapter.ts | 6 ++-- .../adapters/EthersContractAdapter.ts | 11 ++++++- src/deployer/adapters/TruffleAdapter.ts | 30 ++++++++++++++----- 6 files changed, 56 insertions(+), 23 deletions(-) diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts index c81441d..a7392c3 100644 --- a/src/deployer/Deployer.ts +++ b/src/deployer/Deployer.ts @@ -31,7 +31,7 @@ export class Deployer { ): Promise { const adapter = this._resolveAdapter(contract); - const minimalContract = await adapter.fromInstance(contract); + const minimalContract = await adapter.fromInstance(contract, parameters); const contractAddress = await minimalContract.deploy(args, parameters); @@ -43,7 +43,7 @@ export class Deployer { contractAddress?: string, ): Promise { const adapter = this._resolveAdapter(contract); - const contractName = adapter.getContractName(contract); + const contractName = adapter.getContractName(contract, {}); if (contractAddress) { if (!(await isDeployedContractAddress(contractAddress))) { diff --git a/src/deployer/MinimalContract.ts b/src/deployer/MinimalContract.ts index d0c111f..9d2477b 100644 --- a/src/deployer/MinimalContract.ts +++ b/src/deployer/MinimalContract.ts @@ -65,7 +65,6 @@ export class MinimalContract { ): Promise { const factory = new ethers.ContractFactory(this._interface, this._bytecode); - // TODO: check the opportunity to use the populateTransaction method return { contractName: this._contractName, chainId: await getChainId(), @@ -76,17 +75,28 @@ export class MinimalContract { private async _recoverContractAddress(tx: ContractDeployTransactionWithContractName, args: any[]): Promise { try { - // TODO: firstly try to recover by contract name. Think about edge cases. - const contractAddress = await TransactionProcessor.tryRestoreContractAddressByKeyFields(tx); + const contractAddress = await TransactionProcessor.tryRestoreContractAddressByName(tx.contractName); Reporter.notifyContractRecovery(tx.contractName, contractAddress); return contractAddress; } catch { - Reporter.notifyDeploymentInsteadOfRecovery(tx.contractName); + /* empty */ + } - return this._processContractDeploymentTransaction(tx, args); + try { + const contractAddress = await TransactionProcessor.tryRestoreContractAddressByKeyFields(tx); + + Reporter.notifyContractRecovery(tx.contractName, contractAddress); + + return contractAddress; + } catch { + /* empty */ } + + Reporter.notifyDeploymentInsteadOfRecovery(tx.contractName); + + return this._processContractDeploymentTransaction(tx, args); } private async _processContractDeploymentTransaction( diff --git a/src/deployer/adapters/AbstractEthersAdapter.ts b/src/deployer/adapters/AbstractEthersAdapter.ts index 0722d1a..246311f 100644 --- a/src/deployer/adapters/AbstractEthersAdapter.ts +++ b/src/deployer/adapters/AbstractEthersAdapter.ts @@ -15,7 +15,7 @@ import "../../type-extensions"; import { bytecodeToString, fillParameters, getMethodString, getSignerHelper } from "../../utils"; -import { OverridesAndLibs } from "../../types/deployer"; +import { OverridesAndLibs, OverridesAndMisc } from "../../types/deployer"; import { KeyTransactionFields } from "../../types/tools"; import { EthersFactory, PureFactory } from "../../types/adapter"; @@ -31,12 +31,12 @@ export abstract class AbstractEthersAdapter extends Adapter { return bytecodeToString(instance.bytecode); } - public async fromInstance(instance: Factory): Promise { + public async fromInstance(instance: Factory, parameters: OverridesAndMisc): Promise { return new MinimalContract( this._config, this.getRawBytecode(instance), this.getInterface(instance), - this.getContractName(instance), + this.getContractName(instance, parameters), ); } @@ -45,7 +45,7 @@ export abstract class AbstractEthersAdapter extends Adapter { const contract = new BaseContract(address, this.getInterface(instance), signer); - const contractName = this.getContractName(instance); + const contractName = this.getContractName(instance, parameters); if (!AbstractEthersAdapter._processedClasses.has(contractName)) { AbstractEthersAdapter._processedClasses.add(contractName); diff --git a/src/deployer/adapters/Adapter.ts b/src/deployer/adapters/Adapter.ts index 318e8c3..d2dd815 100644 --- a/src/deployer/adapters/Adapter.ts +++ b/src/deployer/adapters/Adapter.ts @@ -6,13 +6,13 @@ import { catchError } from "../../utils"; import { Instance } from "../../types/adapter"; import { MigrateConfig } from "../../types/migrations"; -import { OverridesAndLibs } from "../../types/deployer"; +import { OverridesAndLibs, OverridesAndMisc } from "../../types/deployer"; @catchError export abstract class Adapter { public constructor(protected _config: MigrateConfig) {} - public abstract fromInstance(instance: Instance): Promise; + public abstract fromInstance(instance: Instance, parameters: OverridesAndMisc): Promise; public abstract toInstance(instance: Instance, address: string, parameters: OverridesAndLibs): Promise; @@ -20,5 +20,5 @@ export abstract class Adapter { public abstract getRawBytecode(instance: Instance): string; - public abstract getContractName(instance: Instance): string; + public abstract getContractName(instance: Instance, parameters: OverridesAndMisc): string; } diff --git a/src/deployer/adapters/EthersContractAdapter.ts b/src/deployer/adapters/EthersContractAdapter.ts index fee1d50..bef07f2 100644 --- a/src/deployer/adapters/EthersContractAdapter.ts +++ b/src/deployer/adapters/EthersContractAdapter.ts @@ -5,6 +5,7 @@ import { AbstractEthersAdapter } from "./AbstractEthersAdapter"; import { catchError, getSignerHelper } from "../../utils"; import { EthersFactory } from "../../types/adapter"; +import { OverridesAndMisc } from "../../types/deployer"; import { ArtifactProcessor } from "../../tools/storage/ArtifactProcessor"; @@ -14,10 +15,18 @@ export class EthersContractAdapter extends AbstractEthersAdapter { return Interface.from(instance.abi); } - public getContractName(instance: EthersFactory): string { + public getContractName(instance: EthersFactory, parameters: OverridesAndMisc): string { + if (parameters.misc) { + return parameters.misc; + } + try { return ArtifactProcessor.tryGetContractName(this.getRawBytecode(instance)); } catch { + if ((instance as any).contractName) { + return (instance as any).contractName; + } + return "Unknown Contract"; } } diff --git a/src/deployer/adapters/TruffleAdapter.ts b/src/deployer/adapters/TruffleAdapter.ts index f3d9ba2..a087380 100644 --- a/src/deployer/adapters/TruffleAdapter.ts +++ b/src/deployer/adapters/TruffleAdapter.ts @@ -10,9 +10,14 @@ import { MinimalContract } from "../MinimalContract"; import { bytecodeToString, catchError, fillParameters, getMethodString, toJSON } from "../../utils"; +import { + BaseTruffleMethod, + OverridesAndLibs, + OverridesAndMisc, + TruffleTransactionResponse, +} from "../../types/deployer"; import { KeyTransactionFields } from "../../types/tools"; import { EthersFactory, Instance, TruffleFactory } from "../../types/adapter"; -import { BaseTruffleMethod, OverridesAndLibs, TruffleTransactionResponse } from "../../types/deployer"; import { Reporter } from "../../tools/reporters/Reporter"; import { TruffleReporter } from "../../tools/reporters/TruffleReporter"; @@ -25,12 +30,15 @@ export class TruffleAdapter extends Adapter { super(_hre.config.migrate); } - public async fromInstance(instance: EthersFactory): Promise { + public async fromInstance( + instance: EthersFactory, + parameters: OverridesAndMisc, + ): Promise { return new MinimalContract( this._config, this.getRawBytecode(instance), this.getInterface(instance), - this.getContractName(instance), + this.getContractName(instance, parameters), ); } @@ -49,13 +57,19 @@ export class TruffleAdapter extends Adapter { return bytecodeToString(instance.bytecode); } - public getContractName(instance: Instance): string { + public getContractName(instance: Instance, parameters: OverridesAndMisc): string { + if (parameters.misc) { + return parameters.misc; + } + try { return ArtifactProcessor.tryGetContractName(this.getRawBytecode(instance)); } catch { - // It is possible was called abstract contract - // TODO: Add Contract Name to Overrides. - return (instance as any).contractName || "Unknown Contract"; + if ((instance as any).contractName) { + return (instance as any).contractName; + } + + return "Unknown Contract"; } } @@ -71,7 +85,7 @@ export class TruffleAdapter extends Adapter { protected _insertHandlers(instance: TruffleFactory, contract: I, to: string, parameters: OverridesAndLibs): I { const contractInterface = this.getInterface(instance); - const contractName = this.getContractName(instance); + const contractName = this.getContractName(instance, parameters); for (const methodName of Object.keys((contract as any).contract.methods)) { const oldMethod: BaseTruffleMethod = (contract as any)[methodName]; From 1fbf566026a4fff58443a0946564d4b1639487aa Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Fri, 27 Oct 2023 18:45:39 +0200 Subject: [PATCH 33/36] refactored --- src/deployer/adapters/TruffleAdapter.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/deployer/adapters/TruffleAdapter.ts b/src/deployer/adapters/TruffleAdapter.ts index a087380..c537a55 100644 --- a/src/deployer/adapters/TruffleAdapter.ts +++ b/src/deployer/adapters/TruffleAdapter.ts @@ -10,6 +10,7 @@ import { MinimalContract } from "../MinimalContract"; import { bytecodeToString, catchError, fillParameters, getMethodString, toJSON } from "../../utils"; +import { EthersFactory, Instance, TruffleFactory } from "../../types/adapter"; import { BaseTruffleMethod, OverridesAndLibs, @@ -17,7 +18,6 @@ import { TruffleTransactionResponse, } from "../../types/deployer"; import { KeyTransactionFields } from "../../types/tools"; -import { EthersFactory, Instance, TruffleFactory } from "../../types/adapter"; import { Reporter } from "../../tools/reporters/Reporter"; import { TruffleReporter } from "../../tools/reporters/TruffleReporter"; @@ -97,6 +97,7 @@ export class TruffleAdapter extends Adapter { // Ambiguous function description in ABI continue; } + if (functionStateMutability === "view" || functionStateMutability === "pure") { continue; } From 5d310d31d4b1ceed49a29d6231e1361bf3819527 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 27 Oct 2023 20:29:10 +0300 Subject: [PATCH 34/36] Clarified names --- src/deployer/adapters/AbstractEthersAdapter.ts | 4 ++-- src/deployer/adapters/BytecodeAdapter.ts | 8 ++++---- src/deployer/adapters/EthersContractAdapter.ts | 8 ++++---- src/deployer/adapters/TruffleAdapter.ts | 4 ++-- src/types/adapter.ts | 6 +++--- src/types/type-checks.ts | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/deployer/adapters/AbstractEthersAdapter.ts b/src/deployer/adapters/AbstractEthersAdapter.ts index 0722d1a..9ae35fe 100644 --- a/src/deployer/adapters/AbstractEthersAdapter.ts +++ b/src/deployer/adapters/AbstractEthersAdapter.ts @@ -17,12 +17,12 @@ import { bytecodeToString, fillParameters, getMethodString, getSignerHelper } fr import { OverridesAndLibs } from "../../types/deployer"; import { KeyTransactionFields } from "../../types/tools"; -import { EthersFactory, PureFactory } from "../../types/adapter"; +import { EthersContract, BytecodeFactory } from "../../types/adapter"; import { Reporter } from "../../tools/reporters/Reporter"; import { TransactionProcessor } from "../../tools/storage/TransactionProcessor"; -type Factory = EthersFactory | PureFactory | ContractFactory; +type Factory = EthersContract | BytecodeFactory | ContractFactory; export abstract class AbstractEthersAdapter extends Adapter { private static _processedClasses = new Set(); diff --git a/src/deployer/adapters/BytecodeAdapter.ts b/src/deployer/adapters/BytecodeAdapter.ts index 99067e8..f18a4af 100644 --- a/src/deployer/adapters/BytecodeAdapter.ts +++ b/src/deployer/adapters/BytecodeAdapter.ts @@ -4,20 +4,20 @@ import { AbstractEthersAdapter } from "./AbstractEthersAdapter"; import { catchError } from "../../utils"; -import { PureFactory } from "../../types/adapter"; +import { BytecodeFactory } from "../../types/adapter"; @catchError export class BytecodeAdapter extends AbstractEthersAdapter { - public getInterface(instance: PureFactory): Interface { + public getInterface(instance: BytecodeFactory): Interface { return Interface.from(instance.abi); } - public getContractName(instance: PureFactory): string { + public getContractName(instance: BytecodeFactory): string { return instance.contractName; } // eslint-disable-next-line @typescript-eslint/no-unused-vars - public async overrideConnectMethod(_instance: PureFactory, _contractName: string) { + public async overrideConnectMethod(_instance: BytecodeFactory, _contractName: string) { return; } } diff --git a/src/deployer/adapters/EthersContractAdapter.ts b/src/deployer/adapters/EthersContractAdapter.ts index fee1d50..6d8ba4e 100644 --- a/src/deployer/adapters/EthersContractAdapter.ts +++ b/src/deployer/adapters/EthersContractAdapter.ts @@ -4,17 +4,17 @@ import { AbstractEthersAdapter } from "./AbstractEthersAdapter"; import { catchError, getSignerHelper } from "../../utils"; -import { EthersFactory } from "../../types/adapter"; +import { EthersContract } from "../../types/adapter"; import { ArtifactProcessor } from "../../tools/storage/ArtifactProcessor"; @catchError export class EthersContractAdapter extends AbstractEthersAdapter { - public getInterface(instance: EthersFactory): Interface { + public getInterface(instance: EthersContract): Interface { return Interface.from(instance.abi); } - public getContractName(instance: EthersFactory): string { + public getContractName(instance: EthersContract): string { try { return ArtifactProcessor.tryGetContractName(this.getRawBytecode(instance)); } catch { @@ -22,7 +22,7 @@ export class EthersContractAdapter extends AbstractEthersAdapter { } } - public async overrideConnectMethod(instance: EthersFactory, contractName: string) { + public async overrideConnectMethod(instance: EthersContract, contractName: string) { const connectMethod = instance.connect; const defaultRunner = await getSignerHelper(); diff --git a/src/deployer/adapters/TruffleAdapter.ts b/src/deployer/adapters/TruffleAdapter.ts index f3d9ba2..c153101 100644 --- a/src/deployer/adapters/TruffleAdapter.ts +++ b/src/deployer/adapters/TruffleAdapter.ts @@ -11,7 +11,7 @@ import { MinimalContract } from "../MinimalContract"; import { bytecodeToString, catchError, fillParameters, getMethodString, toJSON } from "../../utils"; import { KeyTransactionFields } from "../../types/tools"; -import { EthersFactory, Instance, TruffleFactory } from "../../types/adapter"; +import { EthersContract, Instance, TruffleFactory } from "../../types/adapter"; import { BaseTruffleMethod, OverridesAndLibs, TruffleTransactionResponse } from "../../types/deployer"; import { Reporter } from "../../tools/reporters/Reporter"; @@ -25,7 +25,7 @@ export class TruffleAdapter extends Adapter { super(_hre.config.migrate); } - public async fromInstance(instance: EthersFactory): Promise { + public async fromInstance(instance: EthersContract): Promise { return new MinimalContract( this._config, this.getRawBytecode(instance), diff --git a/src/types/adapter.ts b/src/types/adapter.ts index 1a802f7..4b18108 100644 --- a/src/types/adapter.ts +++ b/src/types/adapter.ts @@ -2,7 +2,7 @@ import { ContractFactory, InterfaceAbi } from "ethers"; import { Bytecode } from "./deployer"; -export interface EthersFactory { +export interface EthersContract { new (...args: any): A; abi: any; @@ -24,7 +24,7 @@ export interface TruffleFactory extends Truffle.Contract { contractName: string; } -export interface PureFactory { +export interface BytecodeFactory { abi: InterfaceAbi; bytecode: Bytecode; contractName: string; @@ -48,4 +48,4 @@ export type TypedArgs = A extends { deploy(...args: any): any } ? TruffleParameters : any; -export type Instance = TruffleFactory | EthersFactory | PureFactory | ContractFactory; +export type Instance = TruffleFactory | EthersContract | BytecodeFactory | ContractFactory; diff --git a/src/types/type-checks.ts b/src/types/type-checks.ts index c2a021b..6b3f25b 100644 --- a/src/types/type-checks.ts +++ b/src/types/type-checks.ts @@ -1,6 +1,6 @@ import { ContractFactory } from "ethers"; -import { EthersFactory, PureFactory, TruffleFactory } from "./adapter"; +import { EthersContract, BytecodeFactory, TruffleFactory } from "./adapter"; import { KeyDeploymentFields, KeyTransactionFields } from "./tools"; import { MigrateError } from "../errors"; @@ -65,7 +65,7 @@ export function validateKeyTxFields(target: any, propertyKey: string, descriptor return descriptor; } -export function isEthersFactory(instance: any): instance is EthersFactory { +export function isEthersFactory(instance: any): instance is EthersContract { return instance.createInterface !== undefined; } @@ -73,7 +73,7 @@ export function isTruffleFactory(instance: any): instance is TruffleFactory Date: Fri, 27 Oct 2023 20:29:40 +0300 Subject: [PATCH 35/36] Drop overbalanced logic --- src/index.ts | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/index.ts b/src/index.ts index 043a71d..81c1089 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,9 @@ import "@nomicfoundation/hardhat-verify"; +import { ActionType } from "hardhat/types"; +import { lazyObject } from "hardhat/plugins"; import { TASK_COMPILE } from "hardhat/builtin-tasks/task-names"; import { extendConfig, extendEnvironment, task, types } from "hardhat/config"; -import { lazyFunction, lazyObject } from "hardhat/plugins"; -import { ActionType, HardhatRuntimeEnvironment } from "hardhat/types"; import "./type-extensions"; @@ -17,8 +17,6 @@ import { ArtifactProcessor } from "./tools/storage/ArtifactProcessor"; import { DefaultStorage, MigrateStorage } from "./tools/storage/MigrateStorage"; import { VerificationProcessor } from "./tools/storage/VerificationProcessor"; -import { TruffleAdapter } from "./deployer/adapters/TruffleAdapter"; - import { Linker } from "./deployer/Linker"; import { Migrator } from "./migrator/Migrator"; import { Provider } from "./tools/Provider"; @@ -49,8 +47,6 @@ const migrate: ActionType = async (taskArgs, env) => { await ArtifactProcessor.parseArtifacts(env); - overrideTruffleRequire(env); - await new Migrator(env).migrate(); if (env.config.migrate.verify) { @@ -106,17 +102,3 @@ task(TASK_MIGRATE_VERIFY, "Verify contracts via .storage") .addOptionalParam("parallel", "The size of the batch for verification.", undefined, types.int) .addOptionalParam("attempts", "The number of attempts to verify the contract.", undefined, types.int) .setAction(migrateVerify); - -const overrideTruffleRequire = (env: HardhatRuntimeEnvironment) => { - const old = env.artifacts.require; - - env.artifacts.require = lazyFunction(() => { - return (contractPath: string): any => { - const res = old(contractPath); - - new TruffleAdapter(env).overrideConnectMethod(res); - - return res; - }; - }); -}; From a728339a5401300b455151b40cb3b1ddba63a90e Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 27 Oct 2023 20:32:36 +0300 Subject: [PATCH 36/36] Further renaming --- src/deployer/Deployer.ts | 6 +++--- src/types/type-checks.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts index a7392c3..ea07e72 100644 --- a/src/deployer/Deployer.ts +++ b/src/deployer/Deployer.ts @@ -15,7 +15,7 @@ import { EthersFactoryAdapter } from "./adapters/EthersFactoryAdapter"; import { OverridesAndLibs } from "../types/deployer"; import { KeyTransactionFields } from "../types/tools"; import { Instance, TypedArgs } from "../types/adapter"; -import { isContractFactory, isEthersFactory, isPureFactory, isTruffleFactory } from "../types/type-checks"; +import { isContractFactory, isEthersContract, isBytecodeFactory, isTruffleFactory } from "../types/type-checks"; import { Reporter } from "../tools/reporters/Reporter"; import { TransactionProcessor } from "../tools/storage/TransactionProcessor"; @@ -96,7 +96,7 @@ export class Deployer { } private _resolveAdapter(contract: Instance): Adapter { - if (isEthersFactory(contract)) { + if (isEthersContract(contract)) { return new EthersContractAdapter(this._hre.config.migrate); } @@ -104,7 +104,7 @@ export class Deployer { return new TruffleAdapter(this._hre); } - if (isPureFactory(contract)) { + if (isBytecodeFactory(contract)) { return new BytecodeAdapter(this._hre.config.migrate); } diff --git a/src/types/type-checks.ts b/src/types/type-checks.ts index 6b3f25b..567e161 100644 --- a/src/types/type-checks.ts +++ b/src/types/type-checks.ts @@ -65,7 +65,7 @@ export function validateKeyTxFields(target: any, propertyKey: string, descriptor return descriptor; } -export function isEthersFactory(instance: any): instance is EthersContract { +export function isEthersContract(instance: any): instance is EthersContract { return instance.createInterface !== undefined; } @@ -73,7 +73,7 @@ export function isTruffleFactory(instance: any): instance is TruffleFactory