From 1806805497a63b623113863cc3c1bf6e1f2ea238 Mon Sep 17 00:00:00 2001 From: Or Noyman <17881579+fullkomnun@users.noreply.github.com> Date: Mon, 26 Feb 2024 12:23:39 +0200 Subject: [PATCH 1/3] update 'hardhat' v2.16.0 -> v2.19.4 --- package.json | 2 +- pnpm-lock.yaml | 209 +++++++++++++++++++++++-------------------------- 2 files changed, 101 insertions(+), 110 deletions(-) diff --git a/package.json b/package.json index 2e6ec82..1a2e160 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dotenv": "^16.3.1", "ethers": "^6.6.1", "fs-extra": "^11.1.1", - "hardhat": "^2.16.0", + "hardhat": "^2.19.4", "hardhat-deploy": "^0.11.34", "hardhat-deploy-ethers": "^0.4.0", "hardhat-deploy-tenderly": "^0.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 686570a..7039832 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,18 +1,22 @@ lockfileVersion: '6.0' +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + devDependencies: '@nomicfoundation/hardhat-chai-matchers': specifier: ^2.0.1 - version: 2.0.1(@nomicfoundation/hardhat-ethers@3.0.2)(chai@4.3.7)(ethers@6.6.1)(hardhat@2.16.0) + version: 2.0.1(@nomicfoundation/hardhat-ethers@3.0.2)(chai@4.3.7)(ethers@6.6.1)(hardhat@2.19.4) '@nomicfoundation/hardhat-ethers': specifier: ^3.0.2 - version: 3.0.2(ethers@6.6.1)(hardhat@2.16.0) + version: 3.0.2(ethers@6.6.1)(hardhat@2.19.4) '@openzeppelin/contracts': specifier: ^4.9.2 version: 4.9.2 '@typechain/hardhat': specifier: ^8.0.0 - version: 8.0.0(@typechain/ethers-v6@0.4.0)(ethers@6.6.1)(hardhat@2.16.0)(typechain@8.2.0) + version: 8.0.0(@typechain/ethers-v6@0.4.0)(ethers@6.6.1)(hardhat@2.19.4)(typechain@8.2.0) '@types/chai': specifier: ^4.3.5 version: 4.3.5 @@ -38,20 +42,20 @@ devDependencies: specifier: ^11.1.1 version: 11.1.1 hardhat: - specifier: ^2.16.0 - version: 2.16.0(ts-node@10.9.1)(typescript@5.1.3) + specifier: ^2.19.4 + version: 2.19.4(ts-node@10.9.1)(typescript@5.1.3) hardhat-deploy: specifier: ^0.11.34 version: 0.11.34 hardhat-deploy-ethers: specifier: ^0.4.0 - version: 0.4.0(@nomicfoundation/hardhat-ethers@3.0.2)(hardhat-deploy@0.11.34)(hardhat@2.16.0) + version: 0.4.0(@nomicfoundation/hardhat-ethers@3.0.2)(hardhat-deploy@0.11.34)(hardhat@2.19.4) hardhat-deploy-tenderly: specifier: ^0.2.0 - version: 0.2.0(hardhat-deploy@0.11.34)(hardhat@2.16.0) + version: 0.2.0(hardhat-deploy@0.11.34)(hardhat@2.19.4) hardhat-gas-reporter: specifier: ^1.0.9 - version: 1.0.9(hardhat@2.16.0) + version: 1.0.9(hardhat@2.19.4) mocha: specifier: ^10.2.0 version: 10.2.0 @@ -63,7 +67,7 @@ devDependencies: version: 1.1.3(prettier@2.8.8) solidity-coverage: specifier: ^0.8.3 - version: 0.8.3(hardhat@2.16.0) + version: 0.8.3(hardhat@2.19.4) ts-node: specifier: ^10.9.1 version: 10.9.1(@types/node@20.3.1)(typescript@5.1.3) @@ -494,15 +498,15 @@ packages: fastq: 1.15.0 dev: true - /@nomicfoundation/ethereumjs-block@5.0.1: - resolution: {integrity: sha512-u1Yioemi6Ckj3xspygu/SfFvm8vZEO8/Yx5a1QLzi6nVU0jz3Pg2OmHKJ5w+D9Ogk1vhwRiqEBAqcb0GVhCyHw==} + /@nomicfoundation/ethereumjs-block@5.0.2: + resolution: {integrity: sha512-hSe6CuHI4SsSiWWjHDIzWhSiAVpzMUcDRpWYzN0T9l8/Rz7xNn3elwVOJ/tAyS0LqL6vitUD78Uk7lQDXZun7Q==} engines: {node: '>=14'} dependencies: - '@nomicfoundation/ethereumjs-common': 4.0.1 - '@nomicfoundation/ethereumjs-rlp': 5.0.1 - '@nomicfoundation/ethereumjs-trie': 6.0.1 - '@nomicfoundation/ethereumjs-tx': 5.0.1 - '@nomicfoundation/ethereumjs-util': 9.0.1 + '@nomicfoundation/ethereumjs-common': 4.0.2 + '@nomicfoundation/ethereumjs-rlp': 5.0.2 + '@nomicfoundation/ethereumjs-trie': 6.0.2 + '@nomicfoundation/ethereumjs-tx': 5.0.2 + '@nomicfoundation/ethereumjs-util': 9.0.2 ethereum-cryptography: 0.1.3 ethers: 5.7.2 transitivePeerDependencies: @@ -510,17 +514,17 @@ packages: - utf-8-validate dev: true - /@nomicfoundation/ethereumjs-blockchain@7.0.1: - resolution: {integrity: sha512-NhzndlGg829XXbqJEYrF1VeZhAwSPgsK/OB7TVrdzft3y918hW5KNd7gIZ85sn6peDZOdjBsAXIpXZ38oBYE5A==} + /@nomicfoundation/ethereumjs-blockchain@7.0.2: + resolution: {integrity: sha512-8UUsSXJs+MFfIIAKdh3cG16iNmWzWC/91P40sazNvrqhhdR/RtGDlFk2iFTGbBAZPs2+klZVzhRX8m2wvuvz3w==} engines: {node: '>=14'} dependencies: - '@nomicfoundation/ethereumjs-block': 5.0.1 - '@nomicfoundation/ethereumjs-common': 4.0.1 - '@nomicfoundation/ethereumjs-ethash': 3.0.1 - '@nomicfoundation/ethereumjs-rlp': 5.0.1 - '@nomicfoundation/ethereumjs-trie': 6.0.1 - '@nomicfoundation/ethereumjs-tx': 5.0.1 - '@nomicfoundation/ethereumjs-util': 9.0.1 + '@nomicfoundation/ethereumjs-block': 5.0.2 + '@nomicfoundation/ethereumjs-common': 4.0.2 + '@nomicfoundation/ethereumjs-ethash': 3.0.2 + '@nomicfoundation/ethereumjs-rlp': 5.0.2 + '@nomicfoundation/ethereumjs-trie': 6.0.2 + '@nomicfoundation/ethereumjs-tx': 5.0.2 + '@nomicfoundation/ethereumjs-util': 9.0.2 abstract-level: 1.0.3 debug: 4.3.4(supports-color@8.1.1) ethereum-cryptography: 0.1.3 @@ -533,20 +537,20 @@ packages: - utf-8-validate dev: true - /@nomicfoundation/ethereumjs-common@4.0.1: - resolution: {integrity: sha512-OBErlkfp54GpeiE06brBW/TTbtbuBJV5YI5Nz/aB2evTDo+KawyEzPjBlSr84z/8MFfj8wS2wxzQX1o32cev5g==} + /@nomicfoundation/ethereumjs-common@4.0.2: + resolution: {integrity: sha512-I2WGP3HMGsOoycSdOTSqIaES0ughQTueOsddJ36aYVpI3SN8YSusgRFLwzDJwRFVIYDKx/iJz0sQ5kBHVgdDwg==} dependencies: - '@nomicfoundation/ethereumjs-util': 9.0.1 + '@nomicfoundation/ethereumjs-util': 9.0.2 crc-32: 1.2.2 dev: true - /@nomicfoundation/ethereumjs-ethash@3.0.1: - resolution: {integrity: sha512-KDjGIB5igzWOp8Ik5I6QiRH5DH+XgILlplsHR7TEuWANZA759G6krQ6o8bvj+tRUz08YygMQu/sGd9mJ1DYT8w==} + /@nomicfoundation/ethereumjs-ethash@3.0.2: + resolution: {integrity: sha512-8PfoOQCcIcO9Pylq0Buijuq/O73tmMVURK0OqdjhwqcGHYC2PwhbajDh7GZ55ekB0Px197ajK3PQhpKoiI/UPg==} engines: {node: '>=14'} dependencies: - '@nomicfoundation/ethereumjs-block': 5.0.1 - '@nomicfoundation/ethereumjs-rlp': 5.0.1 - '@nomicfoundation/ethereumjs-util': 9.0.1 + '@nomicfoundation/ethereumjs-block': 5.0.2 + '@nomicfoundation/ethereumjs-rlp': 5.0.2 + '@nomicfoundation/ethereumjs-util': 9.0.2 abstract-level: 1.0.3 bigint-crypto-utils: 3.2.2 ethereum-cryptography: 0.1.3 @@ -555,14 +559,14 @@ packages: - utf-8-validate dev: true - /@nomicfoundation/ethereumjs-evm@2.0.1: - resolution: {integrity: sha512-oL8vJcnk0Bx/onl+TgQOQ1t/534GKFaEG17fZmwtPFeH8S5soiBYPCLUrvANOl4sCp9elYxIMzIiTtMtNNN8EQ==} + /@nomicfoundation/ethereumjs-evm@2.0.2: + resolution: {integrity: sha512-rBLcUaUfANJxyOx9HIdMX6uXGin6lANCulIm/pjMgRqfiCRMZie3WKYxTSd8ZE/d+qT+zTedBF4+VHTdTSePmQ==} engines: {node: '>=14'} dependencies: '@ethersproject/providers': 5.7.2 - '@nomicfoundation/ethereumjs-common': 4.0.1 - '@nomicfoundation/ethereumjs-tx': 5.0.1 - '@nomicfoundation/ethereumjs-util': 9.0.1 + '@nomicfoundation/ethereumjs-common': 4.0.2 + '@nomicfoundation/ethereumjs-tx': 5.0.2 + '@nomicfoundation/ethereumjs-util': 9.0.2 debug: 4.3.4(supports-color@8.1.1) ethereum-cryptography: 0.1.3 mcl-wasm: 0.7.9 @@ -573,17 +577,17 @@ packages: - utf-8-validate dev: true - /@nomicfoundation/ethereumjs-rlp@5.0.1: - resolution: {integrity: sha512-xtxrMGa8kP4zF5ApBQBtjlSbN5E2HI8m8FYgVSYAnO6ssUoY5pVPGy2H8+xdf/bmMa22Ce8nWMH3aEW8CcqMeQ==} + /@nomicfoundation/ethereumjs-rlp@5.0.2: + resolution: {integrity: sha512-QwmemBc+MMsHJ1P1QvPl8R8p2aPvvVcKBbvHnQOKBpBztEo0omN0eaob6FeZS/e3y9NSe+mfu3nNFBHszqkjTA==} engines: {node: '>=14'} hasBin: true dev: true - /@nomicfoundation/ethereumjs-statemanager@2.0.1: - resolution: {integrity: sha512-B5ApMOnlruVOR7gisBaYwFX+L/AP7i/2oAahatssjPIBVDF6wTX1K7Qpa39E/nzsH8iYuL3krkYeUFIdO3EMUQ==} + /@nomicfoundation/ethereumjs-statemanager@2.0.2: + resolution: {integrity: sha512-dlKy5dIXLuDubx8Z74sipciZnJTRSV/uHG48RSijhgm1V7eXYFC567xgKtsKiVZB1ViTP9iFL4B6Je0xD6X2OA==} dependencies: - '@nomicfoundation/ethereumjs-common': 4.0.1 - '@nomicfoundation/ethereumjs-rlp': 5.0.1 + '@nomicfoundation/ethereumjs-common': 4.0.2 + '@nomicfoundation/ethereumjs-rlp': 5.0.2 debug: 4.3.4(supports-color@8.1.1) ethereum-cryptography: 0.1.3 ethers: 5.7.2 @@ -594,54 +598,54 @@ packages: - utf-8-validate dev: true - /@nomicfoundation/ethereumjs-trie@6.0.1: - resolution: {integrity: sha512-A64It/IMpDVODzCgxDgAAla8jNjNtsoQZIzZUfIV5AY6Coi4nvn7+VReBn5itlxMiL2yaTlQr9TRWp3CSI6VoA==} + /@nomicfoundation/ethereumjs-trie@6.0.2: + resolution: {integrity: sha512-yw8vg9hBeLYk4YNg5MrSJ5H55TLOv2FSWUTROtDtTMMmDGROsAu+0tBjiNGTnKRi400M6cEzoFfa89Fc5k8NTQ==} engines: {node: '>=14'} dependencies: - '@nomicfoundation/ethereumjs-rlp': 5.0.1 - '@nomicfoundation/ethereumjs-util': 9.0.1 + '@nomicfoundation/ethereumjs-rlp': 5.0.2 + '@nomicfoundation/ethereumjs-util': 9.0.2 '@types/readable-stream': 2.3.15 ethereum-cryptography: 0.1.3 readable-stream: 3.6.2 dev: true - /@nomicfoundation/ethereumjs-tx@5.0.1: - resolution: {integrity: sha512-0HwxUF2u2hrsIM1fsasjXvlbDOq1ZHFV2dd1yGq8CA+MEYhaxZr8OTScpVkkxqMwBcc5y83FyPl0J9MZn3kY0w==} + /@nomicfoundation/ethereumjs-tx@5.0.2: + resolution: {integrity: sha512-T+l4/MmTp7VhJeNloMkM+lPU3YMUaXdcXgTGCf8+ZFvV9NYZTRLFekRwlG6/JMmVfIfbrW+dRRJ9A6H5Q/Z64g==} engines: {node: '>=14'} dependencies: '@chainsafe/ssz': 0.9.4 '@ethersproject/providers': 5.7.2 - '@nomicfoundation/ethereumjs-common': 4.0.1 - '@nomicfoundation/ethereumjs-rlp': 5.0.1 - '@nomicfoundation/ethereumjs-util': 9.0.1 + '@nomicfoundation/ethereumjs-common': 4.0.2 + '@nomicfoundation/ethereumjs-rlp': 5.0.2 + '@nomicfoundation/ethereumjs-util': 9.0.2 ethereum-cryptography: 0.1.3 transitivePeerDependencies: - bufferutil - utf-8-validate dev: true - /@nomicfoundation/ethereumjs-util@9.0.1: - resolution: {integrity: sha512-TwbhOWQ8QoSCFhV/DDfSmyfFIHjPjFBj957219+V3jTZYZ2rf9PmDtNOeZWAE3p3vlp8xb02XGpd0v6nTUPbsA==} + /@nomicfoundation/ethereumjs-util@9.0.2: + resolution: {integrity: sha512-4Wu9D3LykbSBWZo8nJCnzVIYGvGCuyiYLIJa9XXNVt1q1jUzHdB+sJvx95VGCpPkCT+IbLecW6yfzy3E1bQrwQ==} engines: {node: '>=14'} dependencies: '@chainsafe/ssz': 0.10.2 - '@nomicfoundation/ethereumjs-rlp': 5.0.1 + '@nomicfoundation/ethereumjs-rlp': 5.0.2 ethereum-cryptography: 0.1.3 dev: true - /@nomicfoundation/ethereumjs-vm@7.0.1: - resolution: {integrity: sha512-rArhyn0jPsS/D+ApFsz3yVJMQ29+pVzNZ0VJgkzAZ+7FqXSRtThl1C1prhmlVr3YNUlfpZ69Ak+RUT4g7VoOuQ==} + /@nomicfoundation/ethereumjs-vm@7.0.2: + resolution: {integrity: sha512-Bj3KZT64j54Tcwr7Qm/0jkeZXJMfdcAtRBedou+Hx0dPOSIgqaIr0vvLwP65TpHbak2DmAq+KJbW2KNtIoFwvA==} engines: {node: '>=14'} dependencies: - '@nomicfoundation/ethereumjs-block': 5.0.1 - '@nomicfoundation/ethereumjs-blockchain': 7.0.1 - '@nomicfoundation/ethereumjs-common': 4.0.1 - '@nomicfoundation/ethereumjs-evm': 2.0.1 - '@nomicfoundation/ethereumjs-rlp': 5.0.1 - '@nomicfoundation/ethereumjs-statemanager': 2.0.1 - '@nomicfoundation/ethereumjs-trie': 6.0.1 - '@nomicfoundation/ethereumjs-tx': 5.0.1 - '@nomicfoundation/ethereumjs-util': 9.0.1 + '@nomicfoundation/ethereumjs-block': 5.0.2 + '@nomicfoundation/ethereumjs-blockchain': 7.0.2 + '@nomicfoundation/ethereumjs-common': 4.0.2 + '@nomicfoundation/ethereumjs-evm': 2.0.2 + '@nomicfoundation/ethereumjs-rlp': 5.0.2 + '@nomicfoundation/ethereumjs-statemanager': 2.0.2 + '@nomicfoundation/ethereumjs-trie': 6.0.2 + '@nomicfoundation/ethereumjs-tx': 5.0.2 + '@nomicfoundation/ethereumjs-util': 9.0.2 debug: 4.3.4(supports-color@8.1.1) ethereum-cryptography: 0.1.3 mcl-wasm: 0.7.9 @@ -652,7 +656,7 @@ packages: - utf-8-validate dev: true - /@nomicfoundation/hardhat-chai-matchers@2.0.1(@nomicfoundation/hardhat-ethers@3.0.2)(chai@4.3.7)(ethers@6.6.1)(hardhat@2.16.0): + /@nomicfoundation/hardhat-chai-matchers@2.0.1(@nomicfoundation/hardhat-ethers@3.0.2)(chai@4.3.7)(ethers@6.6.1)(hardhat@2.19.4): resolution: {integrity: sha512-qWKndseO8IPt8HiVamgEAutcBOYtX7/O6NPfe7uMNWxY2ywWaiWjDcRFuYYqxrZOMyQZl6ZuiHxbaRNctTUgLw==} peerDependencies: '@nomicfoundation/hardhat-ethers': ^3.0.0 @@ -660,17 +664,17 @@ packages: ethers: ^6.1.0 hardhat: ^2.9.4 dependencies: - '@nomicfoundation/hardhat-ethers': 3.0.2(ethers@6.6.1)(hardhat@2.16.0) + '@nomicfoundation/hardhat-ethers': 3.0.2(ethers@6.6.1)(hardhat@2.19.4) '@types/chai-as-promised': 7.1.5 chai: 4.3.7 chai-as-promised: 7.1.1(chai@4.3.7) deep-eql: 4.1.3 ethers: 6.6.1 - hardhat: 2.16.0(ts-node@10.9.1)(typescript@5.1.3) + hardhat: 2.19.4(ts-node@10.9.1)(typescript@5.1.3) ordinal: 1.0.3 dev: true - /@nomicfoundation/hardhat-ethers@3.0.2(ethers@6.6.1)(hardhat@2.16.0): + /@nomicfoundation/hardhat-ethers@3.0.2(ethers@6.6.1)(hardhat@2.19.4): resolution: {integrity: sha512-4Pu3OwyEvnq/gvW2IZ1Lnbcz4yCC4xqzbHze34mXkqbCwV2kHOx6jX3prFDWQ1koxtin725lAazGh9CJtTaYjg==} peerDependencies: ethers: ^6.1.0 @@ -678,7 +682,7 @@ packages: dependencies: debug: 4.3.4(supports-color@8.1.1) ethers: 6.6.1 - hardhat: 2.16.0(ts-node@10.9.1)(typescript@5.1.3) + hardhat: 2.19.4(ts-node@10.9.1)(typescript@5.1.3) transitivePeerDependencies: - supports-color dev: true @@ -939,7 +943,7 @@ packages: typescript: 5.1.3 dev: true - /@typechain/hardhat@8.0.0(@typechain/ethers-v6@0.4.0)(ethers@6.6.1)(hardhat@2.16.0)(typechain@8.2.0): + /@typechain/hardhat@8.0.0(@typechain/ethers-v6@0.4.0)(ethers@6.6.1)(hardhat@2.19.4)(typechain@8.2.0): resolution: {integrity: sha512-XUVbqlMx8tJTOmzZCD/r196CidtNWAnTBZRcYxjLTKgcJMvc/kHQpWBnVMMB5QHxVKpYpCiz8g07FYCpG8rrjA==} peerDependencies: '@typechain/ethers-v6': ^0.4.0 @@ -950,7 +954,7 @@ packages: '@typechain/ethers-v6': 0.4.0(ethers@6.6.1)(typechain@8.2.0)(typescript@5.1.3) ethers: 6.6.1 fs-extra: 9.1.0 - hardhat: 2.16.0(ts-node@10.9.1)(typescript@5.1.3) + hardhat: 2.19.4(ts-node@10.9.1)(typescript@5.1.3) typechain: 8.2.0(typescript@5.1.3) dev: true @@ -1054,13 +1058,6 @@ packages: resolution: {integrity: sha512-LEyx4aLEC3x6T0UguF6YILf+ntvmOaWsVfENmIW0E9H09vKlLDGelMjjSm0jkDHALj8A8quZ/HapKNigzwge+Q==} dev: true - /abort-controller@3.0.0: - resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} - engines: {node: '>=6.5'} - dependencies: - event-target-shim: 5.0.1 - dev: true - /abstract-level@1.0.3: resolution: {integrity: sha512-t6jv+xHy+VYwc4xqZMn2Pa9DjcdzvzZmQGRjTFc8spIbRGHgBrEKbPq+rYXc7CCo0lxgYvSgKVg9qZAhpVQSjA==} engines: {node: '>=12'} @@ -1132,6 +1129,7 @@ packages: /amdefine@1.0.1: resolution: {integrity: sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==} engines: {node: '>=0.4.2'} + requiresBuild: true dev: true optional: true @@ -2183,11 +2181,6 @@ packages: strip-hex-prefix: 1.0.0 dev: true - /event-target-shim@5.0.1: - resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} - engines: {node: '>=6'} - dev: true - /evp_bytestokey@1.0.3: resolution: {integrity: sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==} dependencies: @@ -2597,26 +2590,26 @@ packages: har-schema: 2.0.0 dev: true - /hardhat-deploy-ethers@0.4.0(@nomicfoundation/hardhat-ethers@3.0.2)(hardhat-deploy@0.11.34)(hardhat@2.16.0): + /hardhat-deploy-ethers@0.4.0(@nomicfoundation/hardhat-ethers@3.0.2)(hardhat-deploy@0.11.34)(hardhat@2.19.4): resolution: {integrity: sha512-UfnriZBeTkLa6VTvaFibJM1pIhPxDx1FiMKBglo6R1hAKmTl0EeDh7BPAWoe7fDosZXYBd40O6xqd1qilb4t/w==} peerDependencies: '@nomicfoundation/hardhat-ethers': ^3.0.2 hardhat: ^2.16.0 hardhat-deploy: ^0.11.34 dependencies: - '@nomicfoundation/hardhat-ethers': 3.0.2(ethers@6.6.1)(hardhat@2.16.0) - hardhat: 2.16.0(ts-node@10.9.1)(typescript@5.1.3) + '@nomicfoundation/hardhat-ethers': 3.0.2(ethers@6.6.1)(hardhat@2.19.4) + hardhat: 2.19.4(ts-node@10.9.1)(typescript@5.1.3) hardhat-deploy: 0.11.34 dev: true - /hardhat-deploy-tenderly@0.2.0(hardhat-deploy@0.11.34)(hardhat@2.16.0): + /hardhat-deploy-tenderly@0.2.0(hardhat-deploy@0.11.34)(hardhat@2.19.4): resolution: {integrity: sha512-obJm+Wh7tRsLRFgmZkkUGC1/RU37J2gHQfCt+ndbSswW5XCjSOIu6tkShhYp147HqOPml84X2qX6qZku1ykIZQ==} peerDependencies: hardhat: ^2.0.0 hardhat-deploy: ^0.11.10 dependencies: axios: 0.24.0 - hardhat: 2.16.0(ts-node@10.9.1)(typescript@5.1.3) + hardhat: 2.19.4(ts-node@10.9.1)(typescript@5.1.3) hardhat-deploy: 0.11.34 js-yaml: 4.1.0 transitivePeerDependencies: @@ -2656,22 +2649,21 @@ packages: - utf-8-validate dev: true - /hardhat-gas-reporter@1.0.9(hardhat@2.16.0): + /hardhat-gas-reporter@1.0.9(hardhat@2.19.4): resolution: {integrity: sha512-INN26G3EW43adGKBNzYWOlI3+rlLnasXTwW79YNnUhXPDa+yHESgt639dJEs37gCjhkbNKcRRJnomXEuMFBXJg==} peerDependencies: hardhat: ^2.0.2 dependencies: array-uniq: 1.0.3 eth-gas-reporter: 0.2.25 - hardhat: 2.16.0(ts-node@10.9.1)(typescript@5.1.3) + hardhat: 2.19.4(ts-node@10.9.1)(typescript@5.1.3) sha1: 1.1.1 transitivePeerDependencies: - '@codechecks/client' dev: true - /hardhat@2.16.0(ts-node@10.9.1)(typescript@5.1.3): - resolution: {integrity: sha512-7VQEJPQRAZdtrYUZaU9GgCpP3MBNy/pTdscARNJQMWKj5C+R7V32G5uIZKIqZ4QiqXa6CBfxxe+G+ahxUbHZHA==} - engines: {node: '>=14.0.0'} + /hardhat@2.19.4(ts-node@10.9.1)(typescript@5.1.3): + resolution: {integrity: sha512-fTQJpqSt3Xo9Mn/WrdblNGAfcANM6XC3tAEi6YogB4s02DmTf93A8QsGb8uR0KR8TFcpcS8lgiW4ugAIYpnbrQ==} hasBin: true peerDependencies: ts-node: '*' @@ -2684,21 +2676,20 @@ packages: dependencies: '@ethersproject/abi': 5.7.0 '@metamask/eth-sig-util': 4.0.1 - '@nomicfoundation/ethereumjs-block': 5.0.1 - '@nomicfoundation/ethereumjs-blockchain': 7.0.1 - '@nomicfoundation/ethereumjs-common': 4.0.1 - '@nomicfoundation/ethereumjs-evm': 2.0.1 - '@nomicfoundation/ethereumjs-rlp': 5.0.1 - '@nomicfoundation/ethereumjs-statemanager': 2.0.1 - '@nomicfoundation/ethereumjs-trie': 6.0.1 - '@nomicfoundation/ethereumjs-tx': 5.0.1 - '@nomicfoundation/ethereumjs-util': 9.0.1 - '@nomicfoundation/ethereumjs-vm': 7.0.1 + '@nomicfoundation/ethereumjs-block': 5.0.2 + '@nomicfoundation/ethereumjs-blockchain': 7.0.2 + '@nomicfoundation/ethereumjs-common': 4.0.2 + '@nomicfoundation/ethereumjs-evm': 2.0.2 + '@nomicfoundation/ethereumjs-rlp': 5.0.2 + '@nomicfoundation/ethereumjs-statemanager': 2.0.2 + '@nomicfoundation/ethereumjs-trie': 6.0.2 + '@nomicfoundation/ethereumjs-tx': 5.0.2 + '@nomicfoundation/ethereumjs-util': 9.0.2 + '@nomicfoundation/ethereumjs-vm': 7.0.2 '@nomicfoundation/solidity-analyzer': 0.1.1 '@sentry/node': 5.30.0 '@types/bn.js': 5.1.1 '@types/lru-cache': 5.1.1 - abort-controller: 3.0.0 adm-zip: 0.4.16 aggregate-error: 3.1.0 ansi-escapes: 4.3.2 @@ -4175,7 +4166,7 @@ packages: resolution: {integrity: sha512-wciNMLg/Irp8OKGrh3S2tfvZiZ0NEyILfcRCXCD4mp7SgK/i9gzLfhY2hY7VMCQJ3kH9UB9BzNdibIVMchzyYw==} dev: true - /solidity-coverage@0.8.3(hardhat@2.16.0): + /solidity-coverage@0.8.3(hardhat@2.19.4): resolution: {integrity: sha512-hbcNgj5z8zzgTlnp4F0pXiqj1v5ua8P4DH5i9cWOBtFPfUuIohLoXu5WiAixexWmpKVjyxXqupnu/mPb4IGr7Q==} hasBin: true peerDependencies: @@ -4191,7 +4182,7 @@ packages: ghost-testrpc: 0.0.2 global-modules: 2.0.0 globby: 10.0.2 - hardhat: 2.16.0(ts-node@10.9.1)(typescript@5.1.3) + hardhat: 2.19.4(ts-node@10.9.1)(typescript@5.1.3) jsonschema: 1.4.1 lodash: 4.17.21 mocha: 7.1.2 From b546bcdff36be681cc12d34632a77b97a333080b Mon Sep 17 00:00:00 2001 From: Or Noyman <17881579+fullkomnun@users.noreply.github.com> Date: Mon, 26 Feb 2024 14:26:37 +0200 Subject: [PATCH 2/3] migrate to esm --- .env.example | 2 ++ .mocharc.cjs | 35 ++++++++++++++++++++++ .mocharc.js | 16 ---------- .prettierrc.js => .prettierrc.cjs | 8 ++--- .setup.js => .setup.cjs | 0 _scripts.js => _scripts.cjs | 23 +++++++++++++++ deploy/001_deploy_simple_erc20.ts | 2 +- deploy/002_deploy_greetings_registry.ts | 2 +- hardhat.config.ts => hardhat.config.cts | 30 ++++++++++++++++++- package.json | 39 +++++++++++++------------ scripts/fundingFromCoinbase.ts | 26 ++++++++--------- scripts/seed.ts | 6 ++-- scripts/setMessage.ts | 3 +- test/GreetingsRegistry.test.ts | 8 +++-- test/SimpleERC20.test.ts | 8 +++-- test/utils/{index.ts => index.cts} | 3 +- tsconfig.json | 16 ++++++---- utils/{network.ts => network.cts} | 0 18 files changed, 157 insertions(+), 70 deletions(-) create mode 100644 .mocharc.cjs delete mode 100644 .mocharc.js rename .prettierrc.js => .prettierrc.cjs (68%) rename .setup.js => .setup.cjs (100%) rename _scripts.js => _scripts.cjs (90%) rename hardhat.config.ts => hardhat.config.cts (69%) rename test/utils/{index.ts => index.cts} (93%) rename utils/{network.ts => network.cts} (100%) diff --git a/.env.example b/.env.example index d1d4f40..4924be0 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,5 @@ +HARDHAT_TYPECHECK=false + # network specific node uri : `"ETH_NODE_URI_" + networkName.toUpperCase()` ETH_NODE_URI_MAINNET=https://eth-mainnet.alchemyapi.io/v2/ # generic node uri (if no specific found) : diff --git a/.mocharc.cjs b/.mocharc.cjs new file mode 100644 index 0000000..4e1433b --- /dev/null +++ b/.mocharc.cjs @@ -0,0 +1,35 @@ +'use strict'; +process.env.TS_NODE_FILES = true; +function stringToBoolean(val, defaultVal) { + const strValue = String(val).toLowerCase(); + switch (strValue) { + case 'true': + case '1': + return true; + case 'false': + case '0': + return false; + default: + return defaultVal; // Default to 'defaultVal' if the value is not recognized + } +} +module.exports = { + 'allow-uncaught': true, + diff: true, + extension: ['ts'], + recursive: true, + reporter: 'spec', + require: ['ts-node/register', 'hardhat/register'], // ['ts-node/register/transpile-only'], (for yarn link ) + 'node-option': [ + 'experimental-specifier-resolution=node', + `loader=ts-node/esm${stringToBoolean(process.env.HARDHAT_TYPECHECK, false) ? '' : '/transpile-only'}`, + 'no-warnings=ExperimentalWarning', + 'enable-source-maps', + ], + slow: 300, + spec: 'test/**/*.test.ts', + timeout: 20000, + ui: 'bdd', + watch: false, + 'watch-files': ['src/**/*.sol', 'test/**/*.ts'], +}; diff --git a/.mocharc.js b/.mocharc.js deleted file mode 100644 index c91178c..0000000 --- a/.mocharc.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; -process.env.TS_NODE_FILES = true; -module.exports = { - 'allow-uncaught': true, - diff: true, - extension: ['ts'], - recursive: true, - reporter: 'spec', - require: ['ts-node/register', 'hardhat/register'], // ['ts-node/register/transpile-only'], (for yarn link ) - slow: 300, - spec: 'test/**/*.test.ts', - timeout: 20000, - ui: 'bdd', - watch: false, - 'watch-files': ['src/**/*.sol', 'test/**/*.ts'], -}; diff --git a/.prettierrc.js b/.prettierrc.cjs similarity index 68% rename from .prettierrc.js rename to .prettierrc.cjs index c043b42..2f2c7cf 100644 --- a/.prettierrc.js +++ b/.prettierrc.cjs @@ -9,9 +9,9 @@ module.exports = { options: { printWidth: 120, singleQuote: false, - parser: 'solidity-parse' - } - } + parser: 'solidity-parse', + }, + }, ], - plugins: [require('prettier-plugin-solidity')] + plugins: [require('prettier-plugin-solidity')], }; diff --git a/.setup.js b/.setup.cjs similarity index 100% rename from .setup.js rename to .setup.cjs diff --git a/_scripts.js b/_scripts.cjs similarity index 90% rename from _scripts.js rename to _scripts.cjs index 047837d..57909dc 100644 --- a/_scripts.js +++ b/_scripts.cjs @@ -6,6 +6,25 @@ const {spawn} = require('child_process'); const path = require('path'); require('dotenv').config(); +function stringToBoolean(val, defaultVal) { + const strValue = String(val).toLowerCase(); + switch (strValue) { + case 'true': + case '1': + return true; + case 'false': + case '0': + return false; + default: + return defaultVal; // Default to 'defaultVal' if the value is not recognized + } +} + +// Conditionally set NODE_OPTIONS based on HARDHAT_TYPECHECK +const nodeOptions = `--loader ts-node/esm${ + stringToBoolean(process.env.HARDHAT_TYPECHECK, false) ? '' : '/transpile-only' +} --no-warnings=ExperimentalWarning`; + const commandlineArgs = process.argv.slice(2); function parseArgs(rawArgs, numFixedArgs, expectedOptions) { @@ -57,6 +76,10 @@ function execute(command) { }; spawn(command.split(' ')[0], command.split(' ').slice(1), { stdio: 'inherit', + env: { + ...process.env, + NODE_OPTIONS: nodeOptions, + }, shell: true, }).on('exit', onExit); }); diff --git a/deploy/001_deploy_simple_erc20.ts b/deploy/001_deploy_simple_erc20.ts index 7737f58..679e2bf 100644 --- a/deploy/001_deploy_simple_erc20.ts +++ b/deploy/001_deploy_simple_erc20.ts @@ -1,5 +1,5 @@ import {HardhatRuntimeEnvironment} from 'hardhat/types'; -import {DeployFunction} from 'hardhat-deploy/types'; +import {DeployFunction} from 'hardhat-deploy/types.js'; import {parseEther} from 'ethers'; const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { diff --git a/deploy/002_deploy_greetings_registry.ts b/deploy/002_deploy_greetings_registry.ts index b813f58..f97f5eb 100644 --- a/deploy/002_deploy_greetings_registry.ts +++ b/deploy/002_deploy_greetings_registry.ts @@ -1,5 +1,5 @@ import {HardhatRuntimeEnvironment} from 'hardhat/types'; -import {DeployFunction} from 'hardhat-deploy/types'; +import {DeployFunction} from 'hardhat-deploy/types.js'; const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const {deployer} = await hre.getNamedAccounts(); diff --git a/hardhat.config.ts b/hardhat.config.cts similarity index 69% rename from hardhat.config.ts rename to hardhat.config.cts index 3530f6a..d0dae60 100644 --- a/hardhat.config.ts +++ b/hardhat.config.cts @@ -1,6 +1,11 @@ import 'dotenv/config'; import {HardhatUserConfig} from 'hardhat/types'; +import {join} from 'path'; +import {writeFile} from 'fs/promises'; +import {subtask} from 'hardhat/config'; +import {TASK_COMPILE_SOLIDITY} from 'hardhat/builtin-tasks/task-names'; + import '@nomicfoundation/hardhat-chai-matchers'; import '@nomicfoundation/hardhat-ethers'; import '@typechain/hardhat'; @@ -11,7 +16,30 @@ import 'hardhat-deploy'; import 'hardhat-deploy-ethers'; import 'hardhat-deploy-tenderly'; -import {node_url, accounts, addForkConfiguration} from './utils/network'; +import {node_url, accounts, addForkConfiguration} from './utils/network.cjs'; + +// overriding 'hardhat' compile solidity task to generate "commonjs" 'package.json' for typechain after compilation +// see: https://github.com/NomicFoundation/hardhat/issues/3385#issuecomment-1841380253 + +subtask(TASK_COMPILE_SOLIDITY).setAction(async (_, {config}, runSuper) => { + const superRes = await runSuper(); + const basePath = config.paths.root; + const packageJsonContent = '{ "type": "commonjs" }'; + const paths = ['typechain-types']; + + const writePackageJson = async (path: string) => { + const fullPath = join(basePath, path, 'package.json'); + try { + await writeFile(fullPath, packageJsonContent); + } catch (error) { + console.error(`Error writing package.json at ${path}: `, error); + } + }; + + await Promise.all(paths.map(writePackageJson)); + + return superRes; +}); const config: HardhatUserConfig = { solidity: { diff --git a/package.json b/package.json index 1a2e160..966940a 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "mycontracts", "version": "0.0.1", "description": "", + "type": "module", "devDependencies": { "@nomicfoundation/hardhat-chai-matchers": "^2.0.1", "@nomicfoundation/hardhat-ethers": "^3.0.2", @@ -28,27 +29,27 @@ "typescript": "^5.1.3" }, "scripts": { - "prepare": "node ./.setup.js && hardhat typechain", - "format": "prettier --check \"**/*.{ts,js,sol}\"", - "format:fix": "prettier --write \"**/*.{ts,js,sol}\"", + "prepare": "node ./.setup.cjs && hardhat typechain", + "format": "prettier --check \"**/*.{ts,mts,cts,js,mjs,cjs,sol}\"", + "format:fix": "prettier --write \"**/*.{ts,mts,cts,js,mjs,cjs,sol}\"", "compile": "hardhat compile", - "void:deploy": "hardhat deploy --report-gas", + "void:deploy": "cross-env NODE_OPTIONS='--loader ts-node/esm/transpile-only --no-warnings=ExperimentalWarning' hardhat deploy --report-gas", "test": "cross-env HARDHAT_DEPLOY_FIXTURE=true HARDHAT_COMPILE=true mocha --bail --recursive test", - "gas": "cross-env REPORT_GAS=true hardhat test", - "coverage": "cross-env HARDHAT_DEPLOY_FIXTURE=true hardhat coverage", - "dev:node": "cross-env MINING_INTERVAL=\"3000,5000\" hardhat node --hostname 0.0.0.0", - "dev": "cross-env MINING_INTERVAL=\"3000,5000\" hardhat node --hostname 0.0.0.0 --watch", - "local:dev": "hardhat --network localhost deploy --watch", - "execute": "node ./_scripts.js run", - "deploy": "node ./_scripts.js deploy", - "verify": "node ./_scripts.js verify", - "export": "node ./_scripts.js export", + "gas": "cross-env NODE_OPTIONS='--loader ts-node/esm/transpile-only --no-warnings=ExperimentalWarning' REPORT_GAS=true hardhat test", + "coverage": "cross-env NODE_OPTIONS='--loader ts-node/esm/transpile-only --no-warnings=ExperimentalWarning' HARDHAT_DEPLOY_FIXTURE=true hardhat coverage", + "dev:node": "cross-env NODE_OPTIONS='--loader ts-node/esm/transpile-only --no-warnings=ExperimentalWarning' MINING_INTERVAL=\"3000,5000\" hardhat node --hostname 0.0.0.0", + "dev": "cross-env NODE_OPTIONS='--loader ts-node/esm/transpile-only --no-warnings=ExperimentalWarning' MINING_INTERVAL=\"3000,5000\" hardhat node --hostname 0.0.0.0 --watch", + "local:dev": "cross-env NODE_OPTIONS='--loader ts-node/esm/transpile-only --no-warnings=ExperimentalWarning' hardhat --network localhost deploy --watch", + "execute": "node ./_scripts.cjs run", + "deploy": "node ./_scripts.cjs deploy", + "verify": "node ./_scripts.cjs verify", + "export": "node ./_scripts.cjs export", "hardhat": "hardhat", - "fork:execute": "node ./_scripts.js fork:run", - "fork:deploy": "node ./_scripts.js fork:deploy", - "fork:dev": "node ./_scripts.js fork:dev", - "fork:node": "node ./_scripts.js fork:node", - "fork:test": "node ./_scripts.js fork:test", - "tenderly:push": "node ./_scripts.js tenderly:push" + "fork:execute": "node ./_scripts.cjs fork:run", + "fork:deploy": "node ./_scripts.cjs fork:deploy", + "fork:dev": "node ./_scripts.cjs fork:dev", + "fork:node": "node ./_scripts.cjs fork:node", + "fork:test": "node ./_scripts.cjs fork:test", + "tenderly:push": "node ./_scripts.cjs tenderly:push" } } diff --git a/scripts/fundingFromCoinbase.ts b/scripts/fundingFromCoinbase.ts index b21fe9b..df39c1d 100644 --- a/scripts/fundingFromCoinbase.ts +++ b/scripts/fundingFromCoinbase.ts @@ -1,8 +1,8 @@ // script used to fund account from a geth coinbase account (geth --dev) -import {ethers, network} from 'hardhat'; -import {BigNumber, providers} from 'ethers'; - -const {JsonRpcProvider} = providers; +import {TransactionResponse} from 'ethers'; +import {JsonRpcProvider} from 'ethers'; +import hre from 'hardhat'; +const {ethers, network, getUnnamedAccounts} = hre; function wait(numSec: number): Promise { return new Promise((resolve) => { @@ -34,7 +34,7 @@ async function main() { console.log('no coinbase'); return; } - const accounts = await ethers.provider.listAccounts(); + const accounts = await getUnnamedAccounts(); let accountsToFund = accounts; if (coinbase === accounts[0]) { accountsToFund = accounts.slice(1); @@ -42,22 +42,22 @@ async function main() { const coinbaseBalance = await ethers.provider.getBalance(coinbase); const nonce = await ethers.provider.getTransactionCount(coinbase); - const maxAmount = BigNumber.from('10000000000000000000'); - let amount = coinbaseBalance.div(accountsToFund.length); - if (amount.gt(maxAmount)) { + const maxAmount = 10000000000000000000n; + let amount = coinbaseBalance / BigInt(accountsToFund.length); + if (amount > maxAmount) { amount = maxAmount; } - if (coinbaseBalance.gt(0)) { + if (coinbaseBalance > 0n) { const rawProvider = new JsonRpcProvider(network.config.url); - const coinbaseSigner = rawProvider.getSigner(coinbase); - const txs: providers.TransactionResponse[] = []; + const coinbaseSigner = await rawProvider.getSigner(coinbase); + const txs: TransactionResponse[] = []; for (let i = 0; i < accountsToFund.length; i++) { const to = accountsToFund[i]; const tx = await coinbaseSigner.sendTransaction({ to, - value: amount.sub(21000).toHexString(), - nonce: BigNumber.from(nonce + i).toHexString(), + value: amount - 21000n, + nonce: nonce + i, }); console.log(`${to}: ${tx.hash}`); txs.push(tx); diff --git a/scripts/seed.ts b/scripts/seed.ts index 0569359..7b91405 100644 --- a/scripts/seed.ts +++ b/scripts/seed.ts @@ -1,4 +1,6 @@ -import {getUnnamedAccounts, ethers} from 'hardhat'; +import hre from 'hardhat'; +import type {GreetingsRegistry} from '../typechain-types/index.js'; +const {getUnnamedAccounts, ethers} = hre; const messages = ['Hello', '你好', 'سلام', 'здравствуйте', 'Habari', 'Bonjour', 'नमस्ते']; @@ -15,7 +17,7 @@ async function main() { for (let i = 0; i < messages.length; i++) { const sender = others[i]; if (sender) { - const greetingsRegistryContract = await ethers.getContract('GreetingsRegistry', sender); + const greetingsRegistryContract = await ethers.getContract('GreetingsRegistry', sender); await waitFor(greetingsRegistryContract.setMessage(messages[i])); } } diff --git a/scripts/setMessage.ts b/scripts/setMessage.ts index 01826a7..9743009 100644 --- a/scripts/setMessage.ts +++ b/scripts/setMessage.ts @@ -1,4 +1,5 @@ -import {deployments, getUnnamedAccounts} from 'hardhat'; +import hre from 'hardhat'; +const {deployments, getUnnamedAccounts} = hre; const {execute} = deployments; // example script diff --git a/test/GreetingsRegistry.test.ts b/test/GreetingsRegistry.test.ts index a97c383..fa942b9 100644 --- a/test/GreetingsRegistry.test.ts +++ b/test/GreetingsRegistry.test.ts @@ -1,7 +1,9 @@ import {expect} from 'chai'; -import {ethers, deployments, getUnnamedAccounts} from 'hardhat'; -import {GreetingsRegistry} from '../typechain-types'; -import {setupUsers} from './utils'; +import hre from 'hardhat'; +const {ethers, deployments, getUnnamedAccounts} = hre; +import {GreetingsRegistry} from '../typechain-types/index.js'; +import UtilsModule from './utils/index.cjs'; +const {setupUsers} = UtilsModule; const setup = deployments.createFixture(async () => { await deployments.fixture('GreetingsRegistry'); diff --git a/test/SimpleERC20.test.ts b/test/SimpleERC20.test.ts index e63e956..b95df37 100644 --- a/test/SimpleERC20.test.ts +++ b/test/SimpleERC20.test.ts @@ -1,7 +1,9 @@ import {expect} from 'chai'; -import {ethers, deployments, getUnnamedAccounts, getNamedAccounts} from 'hardhat'; -import {IERC20} from '../typechain-types'; -import {setupUser, setupUsers} from './utils'; +import hre from 'hardhat'; +const {ethers, deployments, getUnnamedAccounts, getNamedAccounts} = hre; +import {IERC20} from '../typechain-types/index.js'; +import UtilsModule from './utils/index.cjs'; +const {setupUser, setupUsers} = UtilsModule; const setup = deployments.createFixture(async () => { await deployments.fixture('SimpleERC20'); diff --git a/test/utils/index.ts b/test/utils/index.cts similarity index 93% rename from test/utils/index.ts rename to test/utils/index.cts index 3fa4618..9e98899 100644 --- a/test/utils/index.ts +++ b/test/utils/index.cts @@ -1,5 +1,6 @@ import {BaseContract} from 'ethers'; -import {ethers} from 'hardhat'; +import hre from 'hardhat'; +const {ethers} = hre; export async function setupUsers( addresses: string[], diff --git a/tsconfig.json b/tsconfig.json index adc7d80..2f6c6e8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,18 +1,24 @@ { "compilerOptions": { - "target": "es5", - "module": "commonjs", + "target": "ES2020", + "module": "Node16", "strict": true, "esModuleInterop": true, - "moduleResolution": "node", + "moduleResolution": "Node16", "forceConsistentCasingInFileNames": true, "outDir": "dist" }, + "ts-node": { + "esm": true, + "experimentalSpecifierResolution": "node", + "experimentalResolver": true, + "files": true, + }, "include": [ - "hardhat.config.ts", + "hardhat.config.cts", "./scripts", "./deploy", "./test", - "typechain/**/*" + "typechain-types/**/*" ] } diff --git a/utils/network.ts b/utils/network.cts similarity index 100% rename from utils/network.ts rename to utils/network.cts From ffa6f8c8f6c659997b3d48e6faefd00b8cb21c3f Mon Sep 17 00:00:00 2001 From: Or Noyman <17881579+fullkomnun@users.noreply.github.com> Date: Mon, 26 Feb 2024 20:37:18 +0200 Subject: [PATCH 3/3] patch 'hardhat-deploy@0.11.34' to support both cjs/esm scripts --- package.json | 5 +++ patches/hardhat-deploy@0.11.34.patch | 48 ++++++++++++++++++++++++++++ pnpm-lock.yaml | 14 +++++--- 3 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 patches/hardhat-deploy@0.11.34.patch diff --git a/package.json b/package.json index 966940a..e29a322 100644 --- a/package.json +++ b/package.json @@ -51,5 +51,10 @@ "fork:node": "node ./_scripts.cjs fork:node", "fork:test": "node ./_scripts.cjs fork:test", "tenderly:push": "node ./_scripts.cjs tenderly:push" + }, + "pnpm": { + "patchedDependencies": { + "hardhat-deploy@0.11.34": "patches/hardhat-deploy@0.11.34.patch" + } } } diff --git a/patches/hardhat-deploy@0.11.34.patch b/patches/hardhat-deploy@0.11.34.patch new file mode 100644 index 0000000..d0b1214 --- /dev/null +++ b/patches/hardhat-deploy@0.11.34.patch @@ -0,0 +1,48 @@ +diff --git a/dist/src/DeploymentsManager.js b/dist/src/DeploymentsManager.js +index 9a0de00de387641947da608bef1184c6b185a072..d3e76ff1269e3c01e3c2901147f8086f577cbdc6 100644 +--- a/dist/src/DeploymentsManager.js ++++ b/dist/src/DeploymentsManager.js +@@ -733,10 +733,7 @@ class DeploymentsManager { + // console.log("fetching " + scriptFilePath); + try { + delete require.cache[scriptFilePath]; // ensure we reload it every time, so changes are taken in consideration +- deployFunc = require(scriptFilePath); +- if (deployFunc.default) { +- deployFunc = deployFunc.default; +- } ++ deployFunc = await dynamicImportModule(scriptFilePath); + funcByFilePath[scriptFilePath] = deployFunc; + } + catch (e) { +@@ -1104,5 +1101,31 @@ class DeploymentsManager { + }; + } + } ++async function dynamicImportModule(path) { ++ // Adjust the function to handle both ESM and CJS modules uniformly ++ let module; ++ try { ++ module = await import(path); ++ } catch (error) { ++ if (error.code === 'ERR_REQUIRE_ESM') { ++ // The error indicates that the module is an ESM ++ throw error; ++ } else { ++ // Fallback to CommonJS require ++ module = require(path); ++ } ++ } ++ // Check if the module has a 'default' property and if it looks like a wrapped CJS module ++ if (module.default && typeof module.default === 'object' && 'default' in module.default) { ++ // This is a workaround for the double 'default' wrapping issue ++ return module.default.default; ++ } else if (module.default) { ++ // Handle normal ESM default export ++ return module.default; ++ } else { ++ // Return the module directly if it's not using ESM default export ++ return module; ++ } ++} + exports.DeploymentsManager = DeploymentsManager; + //# sourceMappingURL=DeploymentsManager.js.map diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7039832..b1e9cf4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,11 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +patchedDependencies: + hardhat-deploy@0.11.34: + hash: w4abf3cdwie5pl2s3fu6peb2r4 + path: patches/hardhat-deploy@0.11.34.patch + devDependencies: '@nomicfoundation/hardhat-chai-matchers': specifier: ^2.0.1 @@ -46,7 +51,7 @@ devDependencies: version: 2.19.4(ts-node@10.9.1)(typescript@5.1.3) hardhat-deploy: specifier: ^0.11.34 - version: 0.11.34 + version: 0.11.34(patch_hash=w4abf3cdwie5pl2s3fu6peb2r4) hardhat-deploy-ethers: specifier: ^0.4.0 version: 0.4.0(@nomicfoundation/hardhat-ethers@3.0.2)(hardhat-deploy@0.11.34)(hardhat@2.19.4) @@ -2599,7 +2604,7 @@ packages: dependencies: '@nomicfoundation/hardhat-ethers': 3.0.2(ethers@6.6.1)(hardhat@2.19.4) hardhat: 2.19.4(ts-node@10.9.1)(typescript@5.1.3) - hardhat-deploy: 0.11.34 + hardhat-deploy: 0.11.34(patch_hash=w4abf3cdwie5pl2s3fu6peb2r4) dev: true /hardhat-deploy-tenderly@0.2.0(hardhat-deploy@0.11.34)(hardhat@2.19.4): @@ -2610,13 +2615,13 @@ packages: dependencies: axios: 0.24.0 hardhat: 2.19.4(ts-node@10.9.1)(typescript@5.1.3) - hardhat-deploy: 0.11.34 + hardhat-deploy: 0.11.34(patch_hash=w4abf3cdwie5pl2s3fu6peb2r4) js-yaml: 4.1.0 transitivePeerDependencies: - debug dev: true - /hardhat-deploy@0.11.34: + /hardhat-deploy@0.11.34(patch_hash=w4abf3cdwie5pl2s3fu6peb2r4): resolution: {integrity: sha512-N6xcwD8LSMV/IyfEr8TfR2YRbOh9Q4QvitR9MKZRTXQmgQiiMGjX+2efMjKgNMxwCVlmpfnE1tyDxOJOOUseLQ==} dependencies: '@ethersproject/abi': 5.7.0 @@ -2648,6 +2653,7 @@ packages: - supports-color - utf-8-validate dev: true + patched: true /hardhat-gas-reporter@1.0.9(hardhat@2.19.4): resolution: {integrity: sha512-INN26G3EW43adGKBNzYWOlI3+rlLnasXTwW79YNnUhXPDa+yHESgt639dJEs37gCjhkbNKcRRJnomXEuMFBXJg==}