From dbda536d5ed927f9cdc795d69b0b72eb001922d9 Mon Sep 17 00:00:00 2001 From: dule-git <61541725+dule-git@users.noreply.github.com> Date: Wed, 25 Sep 2024 15:54:17 +0200 Subject: [PATCH] Add link-local-hardhat-tenderly command (#222) * move VersionCompatibilityChecker to package * check if hardhat-tenderly version is outdated * encapsulate compatibility version checks into functions * add link-local-hardhat-tenderly command --- .../ethers-v5/link-local-hardhat-tenderly.js | 14 ++++++++++++++ .../contract-verification/ethers-v5/package.json | 3 ++- .../ethers-v6/link-local-hardhat-tenderly.js | 14 ++++++++++++++ .../contract-verification/ethers-v6/package.json | 1 + 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 examples/contract-verification/ethers-v5/link-local-hardhat-tenderly.js create mode 100644 examples/contract-verification/ethers-v6/link-local-hardhat-tenderly.js diff --git a/examples/contract-verification/ethers-v5/link-local-hardhat-tenderly.js b/examples/contract-verification/ethers-v5/link-local-hardhat-tenderly.js new file mode 100644 index 00000000..17e2acc2 --- /dev/null +++ b/examples/contract-verification/ethers-v5/link-local-hardhat-tenderly.js @@ -0,0 +1,14 @@ +const fs = require("fs"); + +main(); + +function main() { + setLinkPathForDependency("link:../../../packages/hre-extender-v1"); +} + +function setLinkPathForDependency(linkPath) { + const packageJson = JSON.parse(fs.readFileSync("package.json", 'utf8')); + packageJson.dependencies["@tenderly/hardhat-tenderly"] = linkPath; + + fs.writeFileSync("package.json", JSON.stringify(packageJson, null, 2), 'utf8'); +} diff --git a/examples/contract-verification/ethers-v5/package.json b/examples/contract-verification/ethers-v5/package.json index 401f6400..7f9f3d75 100644 --- a/examples/contract-verification/ethers-v5/package.json +++ b/examples/contract-verification/ethers-v5/package.json @@ -9,6 +9,7 @@ "eslint": "eslint 'scripts/**/*.ts'", "prettier": "prettier \"**/*.{js,md,json}\"", "build": "tsc -b", + "link-local-hardhat-tenderly": "node --loader ts-node/esm link-local-hardhat-tenderly.js", "public:greeter:automatic": "TENDERLY_PRIVATE_VERIFICATION=false TENDERLY_AUTOMATIC_VERIFICATION=true npx hardhat run scripts/greeter/automatic.ts", "public:greeter:manual-simple": "TENDERLY_PRIVATE_VERIFICATION=false TENDERLY_AUTOMATIC_VERIFICATION=false npx hardhat run scripts/greeter/manual-simple.ts", "public:greeter:manual-advanced": "TENDERLY_PRIVATE_VERIFICATION=false TENDERLY_AUTOMATIC_VERIFICATION=false npx hardhat run scripts/greeter/manual-advanced.ts", @@ -62,4 +63,4 @@ "solidity-coverage": "^0.8.1", "typechain": "^8.3.0" } -} +} \ No newline at end of file diff --git a/examples/contract-verification/ethers-v6/link-local-hardhat-tenderly.js b/examples/contract-verification/ethers-v6/link-local-hardhat-tenderly.js new file mode 100644 index 00000000..a51f230f --- /dev/null +++ b/examples/contract-verification/ethers-v6/link-local-hardhat-tenderly.js @@ -0,0 +1,14 @@ +const fs = require("fs"); + +main(); + +function main() { + setLinkPathForDependency("link:../../../packages/hre-extender-v2"); +} + +function setLinkPathForDependency(linkPath) { + const packageJson = JSON.parse(fs.readFileSync("package.json", 'utf8')); + packageJson.dependencies["@tenderly/hardhat-tenderly"] = linkPath; + + fs.writeFileSync("package.json", JSON.stringify(packageJson, null, 2), 'utf8'); +} diff --git a/examples/contract-verification/ethers-v6/package.json b/examples/contract-verification/ethers-v6/package.json index 04c883e9..def500d2 100644 --- a/examples/contract-verification/ethers-v6/package.json +++ b/examples/contract-verification/ethers-v6/package.json @@ -10,6 +10,7 @@ "prettier": "prettier \"**/*.{js,md,json}\"", "build": "tsc -b", "clean": "rm -rf node_modules && rm -rf dist", + "link-local-hardhat-tenderly": "node --loader ts-node/esm link-local-hardhat-tenderly.js", "public:greeter:automatic": "TENDERLY_PRIVATE_VERIFICATION=false TENDERLY_AUTOMATIC_VERIFICATION=true npx hardhat run scripts/greeter/automatic.ts", "public:greeter:manual-simple": "TENDERLY_PRIVATE_VERIFICATION=false TENDERLY_AUTOMATIC_VERIFICATION=false npx hardhat run scripts/greeter/manual-simple.ts", "public:greeter:manual-advanced": "TENDERLY_PRIVATE_VERIFICATION=false TENDERLY_AUTOMATIC_VERIFICATION=false npx hardhat run scripts/greeter/manual-advanced.ts",