diff --git a/.gitignore b/.gitignore index e4421fa..7553465 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ -# Build directory -/dist - # Logs logs *.log diff --git a/README.md b/README.md index 5acdfe1..aad40aa 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,13 @@ npm install --save-dev request-xdeployer @nomiclabs/hardhat-ethers @openzeppelin Or if you are using [Yarn](https://classic.yarnpkg.com): ```bash -yarn add --dev request-xdeployer @nomiclabs/hardhat-ethers @openzeppelin/contracts +yarn add --dev @requestnetwork/xdeployer @nomiclabs/hardhat-ethers @openzeppelin/contracts ``` > **Note:** This plugin uses the optional chaining operator (`?.`). Optional chaining is _not_ supported in Node.js v13 and below. In your `hardhat.config.ts`: ```ts -import "xdeployer"; +import "@requestnetwork/xdeployer"; ``` ## Required Plugins diff --git a/dist/src/abi/Create2Deployer.json b/dist/src/abi/Create2Deployer.json new file mode 100644 index 0000000..f612b0a --- /dev/null +++ b/dist/src/abi/Create2Deployer.json @@ -0,0 +1,16 @@ +[ + "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "event Paused(address account)", + "event Unpaused(address account)", + "function computeAddress(bytes32 salt, bytes32 codeHash) view returns (address)", + "function computeAddressWithDeployer(bytes32 salt, bytes32 codeHash, address deployer) pure returns (address)", + "function deploy(uint256 value, bytes32 salt, bytes code)", + "function deployERC1820Implementer(uint256 value, bytes32 salt)", + "function killCreate2Deployer(address payoutAddress)", + "function owner() view returns (address)", + "function pause()", + "function paused() view returns (bool)", + "function renounceOwnership()", + "function transferOwnership(address newOwner)", + "function unpause()" +] diff --git a/dist/src/config.d.ts b/dist/src/config.d.ts new file mode 100644 index 0000000..8281c1f --- /dev/null +++ b/dist/src/config.d.ts @@ -0,0 +1,3 @@ +import { ConfigExtender } from "hardhat/types"; +export declare const xdeployConfigExtender: ConfigExtender; +//# sourceMappingURL=config.d.ts.map \ No newline at end of file diff --git a/dist/src/config.d.ts.map b/dist/src/config.d.ts.map new file mode 100644 index 0000000..ab70f40 --- /dev/null +++ b/dist/src/config.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,eAAO,MAAM,qBAAqB,EAAE,cAmBnC,CAAC"} \ No newline at end of file diff --git a/dist/src/config.js b/dist/src/config.js new file mode 100644 index 0000000..7632fee --- /dev/null +++ b/dist/src/config.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.xdeployConfigExtender = void 0; +const constants_1 = require("./constants"); +const xdeployConfigExtender = (config, userConfig) => { + const defaultConfig = { + salt: undefined, + signer: undefined, + networks: [], + rpcUrls: [], + gasLimit: constants_1.GASLIMIT, + deployerAddress: constants_1.CREATE2_DEPLOYER_ADDRESS, + }; + if (userConfig.xdeploy) { + const customConfig = userConfig.xdeploy; + config.xdeploy = { + ...defaultConfig, + ...customConfig, + }; + } + else { + config.xdeploy = defaultConfig; + } +}; +exports.xdeployConfigExtender = xdeployConfigExtender; +//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/dist/src/config.js.map b/dist/src/config.js.map new file mode 100644 index 0000000..e2cc65b --- /dev/null +++ b/dist/src/config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;AACA,2CAAiE;AAE1D,MAAM,qBAAqB,GAAmB,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;IAC1E,MAAM,aAAa,GAAG;QACpB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,oBAAQ;QAClB,eAAe,EAAE,oCAAwB;KAC1C,CAAC;IAEF,IAAI,UAAU,CAAC,OAAO,EAAE;QACtB,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,CAAC;QACxC,MAAM,CAAC,OAAO,GAAG;YACf,GAAG,aAAa;YAChB,GAAG,YAAY;SAChB,CAAC;KACH;SAAM;QACL,MAAM,CAAC,OAAO,GAAG,aAAa,CAAC;KAChC;AACH,CAAC,CAAC;AAnBW,QAAA,qBAAqB,yBAmBhC"} \ No newline at end of file diff --git a/dist/src/constants.d.ts b/dist/src/constants.d.ts new file mode 100644 index 0000000..451ce64 --- /dev/null +++ b/dist/src/constants.d.ts @@ -0,0 +1,13 @@ +export declare const CREATE2_DEPLOYER_ADDRESS = "0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2"; +export declare const AMOUNT = 0; +export declare const GASLIMIT: number; +export declare const PLUGIN_NAME = "xdeployer"; +export declare const TASK_VERIFY_NETWORK_ARGUMENTS = "verify:get-network-arguments"; +export declare const TASK_VERIFY_SUPPORTED_NETWORKS = "verify:get-supported-networks"; +export declare const TASK_VERIFY_EQUAL_ARGS_NETWORKS = "verify:get-equal-args-networks"; +export declare const TASK_VERIFY_SALT = "verify:get-salt"; +export declare const TASK_VERIFY_SIGNER = "verify:get-signer"; +export declare const TASK_VERIFY_CONTRACT = "verify:get-contract"; +export declare const TASK_VERIFY_GASLIMIT = "verify:get-gaslimit"; +export declare const TASK_VERIFY_DEPLOYER_ADDRESS = "verify:deployer-address"; +//# sourceMappingURL=constants.d.ts.map \ No newline at end of file diff --git a/dist/src/constants.d.ts.map b/dist/src/constants.d.ts.map new file mode 100644 index 0000000..ee70d32 --- /dev/null +++ b/dist/src/constants.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,+CACS,CAAC;AAC/C,eAAO,MAAM,MAAM,IAAI,CAAC;AACxB,eAAO,MAAM,QAAQ,QAAgB,CAAC;AACtC,eAAO,MAAM,WAAW,cAAc,CAAC;AACvC,eAAO,MAAM,6BAA6B,iCAAiC,CAAC;AAC5E,eAAO,MAAM,8BAA8B,kCAAkC,CAAC;AAC9E,eAAO,MAAM,+BAA+B,mCAAmC,CAAC;AAChF,eAAO,MAAM,gBAAgB,oBAAoB,CAAC;AAClD,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AACtD,eAAO,MAAM,oBAAoB,wBAAwB,CAAC;AAC1D,eAAO,MAAM,oBAAoB,wBAAwB,CAAC;AAC1D,eAAO,MAAM,4BAA4B,4BAA4B,CAAC"} \ No newline at end of file diff --git a/dist/src/constants.js b/dist/src/constants.js new file mode 100644 index 0000000..6c6df5d --- /dev/null +++ b/dist/src/constants.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TASK_VERIFY_DEPLOYER_ADDRESS = exports.TASK_VERIFY_GASLIMIT = exports.TASK_VERIFY_CONTRACT = exports.TASK_VERIFY_SIGNER = exports.TASK_VERIFY_SALT = exports.TASK_VERIFY_EQUAL_ARGS_NETWORKS = exports.TASK_VERIFY_SUPPORTED_NETWORKS = exports.TASK_VERIFY_NETWORK_ARGUMENTS = exports.PLUGIN_NAME = exports.GASLIMIT = exports.AMOUNT = exports.CREATE2_DEPLOYER_ADDRESS = void 0; +exports.CREATE2_DEPLOYER_ADDRESS = "0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2"; +exports.AMOUNT = 0; +exports.GASLIMIT = 1.5 * 10 ** 6; +exports.PLUGIN_NAME = "xdeployer"; +exports.TASK_VERIFY_NETWORK_ARGUMENTS = "verify:get-network-arguments"; +exports.TASK_VERIFY_SUPPORTED_NETWORKS = "verify:get-supported-networks"; +exports.TASK_VERIFY_EQUAL_ARGS_NETWORKS = "verify:get-equal-args-networks"; +exports.TASK_VERIFY_SALT = "verify:get-salt"; +exports.TASK_VERIFY_SIGNER = "verify:get-signer"; +exports.TASK_VERIFY_CONTRACT = "verify:get-contract"; +exports.TASK_VERIFY_GASLIMIT = "verify:get-gaslimit"; +exports.TASK_VERIFY_DEPLOYER_ADDRESS = "verify:deployer-address"; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/dist/src/constants.js.map b/dist/src/constants.js.map new file mode 100644 index 0000000..805a755 --- /dev/null +++ b/dist/src/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GACnC,4CAA4C,CAAC;AAClC,QAAA,MAAM,GAAG,CAAC,CAAC;AACX,QAAA,QAAQ,GAAG,GAAG,GAAG,EAAE,IAAI,CAAC,CAAC;AACzB,QAAA,WAAW,GAAG,WAAW,CAAC;AAC1B,QAAA,6BAA6B,GAAG,8BAA8B,CAAC;AAC/D,QAAA,8BAA8B,GAAG,+BAA+B,CAAC;AACjE,QAAA,+BAA+B,GAAG,gCAAgC,CAAC;AACnE,QAAA,gBAAgB,GAAG,iBAAiB,CAAC;AACrC,QAAA,kBAAkB,GAAG,mBAAmB,CAAC;AACzC,QAAA,oBAAoB,GAAG,qBAAqB,CAAC;AAC7C,QAAA,oBAAoB,GAAG,qBAAqB,CAAC;AAC7C,QAAA,4BAA4B,GAAG,yBAAyB,CAAC"} \ No newline at end of file diff --git a/dist/src/index.d.ts b/dist/src/index.d.ts new file mode 100644 index 0000000..f9f51b5 --- /dev/null +++ b/dist/src/index.d.ts @@ -0,0 +1,6 @@ +import { CREATE2_DEPLOYER_ADDRESS } from "./constants"; +import "./type-extensions"; +import "@nomiclabs/hardhat-ethers"; +import { IDeploymentParams, IDeploymentResult } from "./types"; +export { CREATE2_DEPLOYER_ADDRESS, IDeploymentParams, IDeploymentResult }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/index.d.ts.map b/dist/src/index.d.ts.map new file mode 100644 index 0000000..b9aa0fe --- /dev/null +++ b/dist/src/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,wBAAwB,EAWzB,MAAM,aAAa,CAAC;AACrB,OAAO,mBAAmB,CAAC;AAI3B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAqQ/D,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/src/index.js b/dist/src/index.js new file mode 100644 index 0000000..3bbf75b --- /dev/null +++ b/dist/src/index.js @@ -0,0 +1,185 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CREATE2_DEPLOYER_ADDRESS = void 0; +/* eslint-disable @typescript-eslint/no-explicit-any */ +const config_1 = require("hardhat/config"); +const config_2 = require("./config"); +const networks_1 = require("./networks"); +const constants_1 = require("./constants"); +Object.defineProperty(exports, "CREATE2_DEPLOYER_ADDRESS", { enumerable: true, get: function () { return constants_1.CREATE2_DEPLOYER_ADDRESS; } }); +require("./type-extensions"); +const Create2Deployer_json_1 = __importDefault(require("./abi/Create2Deployer.json")); +const plugins_1 = require("hardhat/plugins"); +require("@nomiclabs/hardhat-ethers"); +(0, config_1.extendConfig)(config_2.xdeployConfigExtender); +(0, config_1.task)("xdeploy", "Deploys the contract across all predefined networks").setAction(async ({ contract, constructorArgs }, hre) => { + console.log(`Deployment of ${contract} through xdeployer starting now !`); + await hre.run(constants_1.TASK_VERIFY_NETWORK_ARGUMENTS); + await hre.run(constants_1.TASK_VERIFY_SUPPORTED_NETWORKS); + await hre.run(constants_1.TASK_VERIFY_EQUAL_ARGS_NETWORKS); + await hre.run(constants_1.TASK_VERIFY_SALT); + await hre.run(constants_1.TASK_VERIFY_SIGNER); + await hre.run(constants_1.TASK_VERIFY_CONTRACT, { contract }); + await hre.run(constants_1.TASK_VERIFY_GASLIMIT); + await hre.run(constants_1.TASK_VERIFY_DEPLOYER_ADDRESS); + await hre.run("compile"); + if (hre.config.xdeploy.rpcUrls && hre.config.xdeploy.networks) { + const providers = []; + const wallets = []; + const signers = []; + const create2Deployer = []; + const createReceipt = []; + const result = []; + let initcode; + const Contract = await hre.ethers.getContractFactory(contract); + if (constructorArgs && contract) { + initcode = await Contract.getDeployTransaction(...constructorArgs); + } + else if (!constructorArgs && contract) { + initcode = await Contract.getDeployTransaction(); + } + for (let i = 0; i < hre.config.xdeploy.rpcUrls.length; i++) { + providers[i] = new hre.ethers.providers.JsonRpcProvider(hre.config.xdeploy.rpcUrls[i]); + wallets[i] = new hre.ethers.Wallet(hre.config.xdeploy.signer, providers[i]); + signers[i] = wallets[i].connect(providers[i]); + let computedContractAddress; + if (hre.config.xdeploy.networks[i] !== "hardhat" && + hre.config.xdeploy.networks[i] !== "localhost") { + if (!hre.config.xdeploy.deployerAddress) { + throw new Error("Deployer address undefined"); + } + create2Deployer[i] = new hre.ethers.Contract(hre.config.xdeploy.deployerAddress, Create2Deployer_json_1.default, signers[i]); + if (hre.config.xdeploy.salt) { + try { + computedContractAddress = await create2Deployer[i].computeAddress(hre.ethers.utils.id(hre.config.xdeploy.salt), hre.ethers.utils.keccak256(initcode.data)); + } + catch (err) { + throw new Error("Contract address could not be computed, check your contract name and arguments"); + } + try { + createReceipt[i] = await create2Deployer[i].deploy(constants_1.AMOUNT, hre.ethers.utils.id(hre.config.xdeploy.salt), initcode.data, { gasLimit: hre.config.xdeploy.gasLimit }); + createReceipt[i] = await createReceipt[i].wait(); + result[i] = { + network: hre.config.xdeploy.networks[i], + contract: contract, + address: computedContractAddress, + receipt: createReceipt[i], + deployed: true, + error: undefined, + }; + } + catch (err) { + result[i] = { + network: hre.config.xdeploy.networks[i], + contract: contract, + address: computedContractAddress, + receipt: undefined, + deployed: false, + error: err, + }; + } + } + } + else if (hre.config.xdeploy.networks[i] === "hardhat" || + hre.config.xdeploy.networks[i] === "localhost") { + const hhcreate2Deployer = await hre.ethers.getContractFactory("Create2DeployerLocal"); + create2Deployer[i] = await hhcreate2Deployer.deploy(); + if (hre.config.xdeploy.salt) { + try { + computedContractAddress = await create2Deployer[i].computeAddress(hre.ethers.utils.id(hre.config.xdeploy.salt), hre.ethers.utils.keccak256(initcode.data)); + } + catch (err) { + throw new Error("Contract address could not be computed, check your contract name and arguments"); + } + try { + createReceipt[i] = await create2Deployer[i].deploy(constants_1.AMOUNT, hre.ethers.utils.id(hre.config.xdeploy.salt), initcode.data, { gasLimit: hre.config.xdeploy.gasLimit }); + createReceipt[i] = await createReceipt[i].wait(); + result[i] = { + network: hre.config.xdeploy.networks[i], + contract: contract, + address: computedContractAddress, + receipt: createReceipt[i], + deployed: true, + error: undefined, + }; + } + catch (err) { + result[i] = { + network: hre.config.xdeploy.networks[i], + contract: contract, + address: computedContractAddress, + receipt: undefined, + deployed: false, + error: err, + }; + } + } + } + } + return result; + } +}); +(0, config_1.subtask)(constants_1.TASK_VERIFY_NETWORK_ARGUMENTS).setAction(async (_, hre) => { + if (!hre.config.xdeploy.networks || + hre.config.xdeploy.networks.length === 0) { + throw new plugins_1.NomicLabsHardhatPluginError(constants_1.PLUGIN_NAME, `Please provide at least one deployment network via the hardhat config. + E.g.: { [...], xdeploy: { networks: ["rinkeby", "kovan"] }, [...] } + The current supported networks are ${networks_1.networks}.`); + } +}); +(0, config_1.subtask)(constants_1.TASK_VERIFY_DEPLOYER_ADDRESS).setAction(async (_, hre) => { + if (!hre.config.xdeploy.deployerAddress || + hre.config.xdeploy.deployerAddress === "" || + !hre.ethers.utils.isAddress(hre.config.xdeploy.deployerAddress)) { + throw new plugins_1.NomicLabsHardhatPluginError(constants_1.PLUGIN_NAME, `The deployer contract address that you specified `); + } +}); +(0, config_1.subtask)(constants_1.TASK_VERIFY_SUPPORTED_NETWORKS).setAction(async (_, hre) => { + const unsupported = hre?.config?.xdeploy?.networks?.filter((v) => !networks_1.networks.includes(v)); + if (hre.config.xdeploy.deployerAddress === constants_1.CREATE2_DEPLOYER_ADDRESS && + unsupported && + unsupported.length > 0) { + throw new plugins_1.NomicLabsHardhatPluginError(constants_1.PLUGIN_NAME, `You have tried to configure a network that this plugin does not yet support, + or you have misspelled the network name. The currently supported networks are + ${networks_1.networks}.`); + } +}); +(0, config_1.subtask)(constants_1.TASK_VERIFY_EQUAL_ARGS_NETWORKS).setAction(async (_, hre) => { + if (hre.config.xdeploy.networks && + hre.config.xdeploy.rpcUrls && + hre.config.xdeploy.rpcUrls.length !== hre.config.xdeploy.networks.length) { + throw new plugins_1.NomicLabsHardhatPluginError(constants_1.PLUGIN_NAME, `The parameters "network" and "rpcUrls" do not have the same length. + Please ensure that both parameters have the same length, i.e. for each + network there is a corresponding rpcUrls entry.`); + } +}); +(0, config_1.subtask)(constants_1.TASK_VERIFY_SALT).setAction(async (_, hre) => { + if (!hre.config.xdeploy.salt || hre.config.xdeploy.salt === "") { + throw new plugins_1.NomicLabsHardhatPluginError(constants_1.PLUGIN_NAME, `Please provide an arbitrary value as salt. + E.g.: { [...], xdeploy: { salt: "WAGMI" }, [...] }.`); + } +}); +(0, config_1.subtask)(constants_1.TASK_VERIFY_SIGNER).setAction(async (_, hre) => { + if (!hre.config.xdeploy.signer || hre.config.xdeploy.signer === "") { + throw new plugins_1.NomicLabsHardhatPluginError(constants_1.PLUGIN_NAME, `Please provide a signer private key. We recommend using a .env file. + See https://www.npmjs.com/package/dotenv. + E.g.: { [...], xdeploy: { signer: process.env.PRIVATE_KEY }, [...] }.`); + } +}); +(0, config_1.subtask)(constants_1.TASK_VERIFY_CONTRACT).setAction(async ({ contract }) => { + if (!contract || contract === "") { + throw new plugins_1.NomicLabsHardhatPluginError(constants_1.PLUGIN_NAME, `Please specify the contract name of the smart contract to be deployed. + E.g.: { [...], xdeploy: { contract: "ERC20" }, [...] }.`); + } +}); +(0, config_1.subtask)(constants_1.TASK_VERIFY_GASLIMIT).setAction(async (_, hre) => { + if (hre.config.xdeploy.gasLimit && + hre.config.xdeploy.gasLimit > 15 * 10 ** 6) { + throw new plugins_1.NomicLabsHardhatPluginError(constants_1.PLUGIN_NAME, `Please specify a lower gasLimit. Each block has currently + a target size of 15 million gas.`); + } +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/src/index.js.map b/dist/src/index.js.map new file mode 100644 index 0000000..1af8566 --- /dev/null +++ b/dist/src/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAuD;AACvD,2CAA6D;AAC7D,qCAAiD;AACjD,yCAAsC;AACtC,2CAYqB;AA2QZ,yGAtRP,oCAAwB,OAsRO;AA1QjC,6BAA2B;AAC3B,sFAA6C;AAE7C,6CAA8D;AAC9D,qCAAmC;AAGnC,IAAA,qBAAY,EAAC,8BAAqB,CAAC,CAAC;AAEpC,IAAA,aAAI,EACF,SAAS,EACT,qDAAqD,CACtD,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,GAAG,EAAE,EAAE;IACvD,OAAO,CAAC,GAAG,CAAC,iBAAiB,QAAQ,mCAAmC,CAAC,CAAC;IAE1E,MAAM,GAAG,CAAC,GAAG,CAAC,yCAA6B,CAAC,CAAC;IAC7C,MAAM,GAAG,CAAC,GAAG,CAAC,0CAA8B,CAAC,CAAC;IAC9C,MAAM,GAAG,CAAC,GAAG,CAAC,2CAA+B,CAAC,CAAC;IAC/C,MAAM,GAAG,CAAC,GAAG,CAAC,4BAAgB,CAAC,CAAC;IAChC,MAAM,GAAG,CAAC,GAAG,CAAC,8BAAkB,CAAC,CAAC;IAClC,MAAM,GAAG,CAAC,GAAG,CAAC,gCAAoB,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClD,MAAM,GAAG,CAAC,GAAG,CAAC,gCAAoB,CAAC,CAAC;IACpC,MAAM,GAAG,CAAC,GAAG,CAAC,wCAA4B,CAAC,CAAC;IAE5C,MAAM,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAEzB,IAAI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,EAAE,EAAE,EAAE;IAC7D,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,EAAE,EAAE;QAChC,MAAM,IAAI,qCAA2B,CACnC,uBAAW,EACX;8DACwD,CACzD,CAAC;KACH;AACH,CAAC,CAAC,CAAC;AAEH,IAAA,gBAAO,EAAC,gCAAoB,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE;IACvD,IACE,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ;QAC3B,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAC1C;QACA,MAAM,IAAI,qCAA2B,CACnC,uBAAW,EACX;uCACiC,CAClC,CAAC;KACH;AACH,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/src/networks.d.ts b/dist/src/networks.d.ts new file mode 100644 index 0000000..2f5e477 --- /dev/null +++ b/dist/src/networks.d.ts @@ -0,0 +1,2 @@ +export declare const networks: string[]; +//# sourceMappingURL=networks.d.ts.map \ No newline at end of file diff --git a/dist/src/networks.d.ts.map b/dist/src/networks.d.ts.map new file mode 100644 index 0000000..49a8b94 --- /dev/null +++ b/dist/src/networks.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../../src/networks.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,QAAQ,UAoCpB,CAAC"} \ No newline at end of file diff --git a/dist/src/networks.js b/dist/src/networks.js new file mode 100644 index 0000000..a561479 --- /dev/null +++ b/dist/src/networks.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.networks = void 0; +// List of supported networks +exports.networks = [ + "localhost", + "hardhat", + "rinkeby", + "ropsten", + "kovan", + "goerli", + "bscTestnet", + "optimismTestnet", + "arbitrumTestnet", + "mumbai", + "hecoTestnet", + "fantomTestnet", + "fuji", + "sokol", + "moonbaseAlpha", + "alfajores", + "auroraTestnet", + "harmonyTestnet", + "spark", + "ethMain", + "bscMain", + "optimismMain", + "arbitrumMain", + "polygon", + "hecoMain", + "fantomMain", + "avalanche", + "gnosis", + "moonriver", + "moonbeam", + "celo", + "auroraMain", + "harmonyMain", + "autobahn", + "fuse", +]; +//# sourceMappingURL=networks.js.map \ No newline at end of file diff --git a/dist/src/networks.js.map b/dist/src/networks.js.map new file mode 100644 index 0000000..9819294 --- /dev/null +++ b/dist/src/networks.js.map @@ -0,0 +1 @@ +{"version":3,"file":"networks.js","sourceRoot":"","sources":["../../src/networks.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAChB,QAAA,QAAQ,GAAG;IACtB,WAAW;IACX,SAAS;IACT,SAAS;IACT,SAAS;IACT,OAAO;IACP,QAAQ;IACR,YAAY;IACZ,iBAAiB;IACjB,iBAAiB;IACjB,QAAQ;IACR,aAAa;IACb,eAAe;IACf,MAAM;IACN,OAAO;IACP,eAAe;IACf,WAAW;IACX,eAAe;IACf,gBAAgB;IAChB,OAAO;IACP,SAAS;IACT,SAAS;IACT,cAAc;IACd,cAAc;IACd,SAAS;IACT,UAAU;IACV,YAAY;IACZ,WAAW;IACX,QAAQ;IACR,WAAW;IACX,UAAU;IACV,MAAM;IACN,YAAY;IACZ,aAAa;IACb,UAAU;IACV,MAAM;CACP,CAAC"} \ No newline at end of file diff --git a/dist/src/type-extensions.d.ts b/dist/src/type-extensions.d.ts new file mode 100644 index 0000000..4c02151 --- /dev/null +++ b/dist/src/type-extensions.d.ts @@ -0,0 +1,11 @@ +import "hardhat/types/config"; +import { XdeployConfig } from "./types"; +declare module "hardhat/types/config" { + interface HardhatUserConfig { + xdeploy?: XdeployConfig; + } + interface HardhatConfig { + xdeploy: XdeployConfig; + } +} +//# sourceMappingURL=type-extensions.d.ts.map \ No newline at end of file diff --git a/dist/src/type-extensions.d.ts.map b/dist/src/type-extensions.d.ts.map new file mode 100644 index 0000000..4929131 --- /dev/null +++ b/dist/src/type-extensions.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"type-extensions.d.ts","sourceRoot":"","sources":["../../src/type-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,iBAAiB;QACzB,OAAO,CAAC,EAAE,aAAa,CAAC;KACzB;IAED,UAAU,aAAa;QACrB,OAAO,EAAE,aAAa,CAAC;KACxB;CACF"} \ No newline at end of file diff --git a/dist/src/type-extensions.js b/dist/src/type-extensions.js new file mode 100644 index 0000000..dcea680 --- /dev/null +++ b/dist/src/type-extensions.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +require("hardhat/types/config"); +//# sourceMappingURL=type-extensions.js.map \ No newline at end of file diff --git a/dist/src/type-extensions.js.map b/dist/src/type-extensions.js.map new file mode 100644 index 0000000..3c8c55d --- /dev/null +++ b/dist/src/type-extensions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"type-extensions.js","sourceRoot":"","sources":["../../src/type-extensions.ts"],"names":[],"mappings":";;AAAA,gCAA8B"} \ No newline at end of file diff --git a/dist/src/types.d.ts b/dist/src/types.d.ts new file mode 100644 index 0000000..ebd9293 --- /dev/null +++ b/dist/src/types.d.ts @@ -0,0 +1,21 @@ +export interface XdeployConfig { + salt?: string; + signer?: any; + networks?: Array; + rpcUrls?: Array; + gasLimit?: number; + deployerAddress?: string; +} +export interface IDeploymentParams { + contract: string; + constructorArgs?: Array; +} +export interface IDeploymentResult { + network: string; + contract: string; + address: string | undefined; + receipt: any; + deployed: boolean; + error: string | undefined; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/dist/src/types.d.ts.map b/dist/src/types.d.ts.map new file mode 100644 index 0000000..c648547 --- /dev/null +++ b/dist/src/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzB,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B"} \ No newline at end of file diff --git a/dist/src/types.js b/dist/src/types.js new file mode 100644 index 0000000..11e638d --- /dev/null +++ b/dist/src/types.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/dist/src/types.js.map b/dist/src/types.js.map new file mode 100644 index 0000000..7b5fff8 --- /dev/null +++ b/dist/src/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/test/fixture-projects/hardhat-project-with-constructor/hardhat.config.d.ts b/dist/test/fixture-projects/hardhat-project-with-constructor/hardhat.config.d.ts new file mode 100644 index 0000000..1f51f3e --- /dev/null +++ b/dist/test/fixture-projects/hardhat-project-with-constructor/hardhat.config.d.ts @@ -0,0 +1,5 @@ +import { HardhatUserConfig } from "hardhat/types"; +import "../../../src/index"; +declare const config: HardhatUserConfig; +export default config; +//# sourceMappingURL=hardhat.config.d.ts.map \ No newline at end of file diff --git a/dist/test/fixture-projects/hardhat-project-with-constructor/hardhat.config.d.ts.map b/dist/test/fixture-projects/hardhat-project-with-constructor/hardhat.config.d.ts.map new file mode 100644 index 0000000..a2d2d44 --- /dev/null +++ b/dist/test/fixture-projects/hardhat-project-with-constructor/hardhat.config.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hardhat.config.d.ts","sourceRoot":"","sources":["../../../../test/fixture-projects/hardhat-project-with-constructor/hardhat.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,oBAAoB,CAAC;AAG5B,QAAA,MAAM,MAAM,EAAE,iBA8Bb,CAAC;AAEF,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/dist/test/fixture-projects/hardhat-project-with-constructor/hardhat.config.js b/dist/test/fixture-projects/hardhat-project-with-constructor/hardhat.config.js new file mode 100644 index 0000000..1671bd8 --- /dev/null +++ b/dist/test/fixture-projects/hardhat-project-with-constructor/hardhat.config.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +require("../../../src/index"); +const ethers_1 = require("ethers"); +const config = { + solidity: { + version: "0.8.9", + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, + networks: { + hardhat: { + accounts: [ + { + privateKey: "0xe1904817e407877ea09135933f39121aa68ed0d9729d301084c544204171d100", + balance: "100000000000000000000", + }, + ], + }, + }, + defaultNetwork: "hardhat", + xdeploy: { + salt: ethers_1.ethers.utils.id(Date.now().toString()), + signer: "0xe1904817e407877ea09135933f39121aa68ed0d9729d301084c544204171d100", + networks: ["hardhat"], + rpcUrls: ["hardhat"], + gasLimit: 1.2 * 10 ** 6, + }, +}; +exports.default = config; +//# sourceMappingURL=hardhat.config.js.map \ No newline at end of file diff --git a/dist/test/fixture-projects/hardhat-project-with-constructor/hardhat.config.js.map b/dist/test/fixture-projects/hardhat-project-with-constructor/hardhat.config.js.map new file mode 100644 index 0000000..5277550 --- /dev/null +++ b/dist/test/fixture-projects/hardhat-project-with-constructor/hardhat.config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hardhat.config.js","sourceRoot":"","sources":["../../../../test/fixture-projects/hardhat-project-with-constructor/hardhat.config.ts"],"names":[],"mappings":";;AACA,8BAA4B;AAC5B,mCAAgC;AAEhC,MAAM,MAAM,GAAsB;IAChC,QAAQ,EAAE;QACR,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE;YACR,SAAS,EAAE;gBACT,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,GAAG;aACV;SACF;KACF;IACD,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,QAAQ,EAAE;gBACR;oBACE,UAAU,EACR,oEAAoE;oBACtE,OAAO,EAAE,uBAAuB;iBACjC;aACF;SACF;KACF;IACD,cAAc,EAAE,SAAS;IACzB,OAAO,EAAE;QACP,IAAI,EAAE,eAAM,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC5C,MAAM,EACJ,oEAAoE;QACtE,QAAQ,EAAE,CAAC,SAAS,CAAC;QACrB,OAAO,EAAE,CAAC,SAAS,CAAC;QACpB,QAAQ,EAAE,GAAG,GAAG,EAAE,IAAI,CAAC;KACxB;CACF,CAAC;AAEF,kBAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/dist/test/fixture-projects/hardhat-project-without-constructor/hardhat.config.d.ts b/dist/test/fixture-projects/hardhat-project-without-constructor/hardhat.config.d.ts new file mode 100644 index 0000000..1f51f3e --- /dev/null +++ b/dist/test/fixture-projects/hardhat-project-without-constructor/hardhat.config.d.ts @@ -0,0 +1,5 @@ +import { HardhatUserConfig } from "hardhat/types"; +import "../../../src/index"; +declare const config: HardhatUserConfig; +export default config; +//# sourceMappingURL=hardhat.config.d.ts.map \ No newline at end of file diff --git a/dist/test/fixture-projects/hardhat-project-without-constructor/hardhat.config.d.ts.map b/dist/test/fixture-projects/hardhat-project-without-constructor/hardhat.config.d.ts.map new file mode 100644 index 0000000..49c5258 --- /dev/null +++ b/dist/test/fixture-projects/hardhat-project-without-constructor/hardhat.config.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hardhat.config.d.ts","sourceRoot":"","sources":["../../../../test/fixture-projects/hardhat-project-without-constructor/hardhat.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,oBAAoB,CAAC;AAG5B,QAAA,MAAM,MAAM,EAAE,iBA8Bb,CAAC;AAEF,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/dist/test/fixture-projects/hardhat-project-without-constructor/hardhat.config.js b/dist/test/fixture-projects/hardhat-project-without-constructor/hardhat.config.js new file mode 100644 index 0000000..1671bd8 --- /dev/null +++ b/dist/test/fixture-projects/hardhat-project-without-constructor/hardhat.config.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +require("../../../src/index"); +const ethers_1 = require("ethers"); +const config = { + solidity: { + version: "0.8.9", + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, + networks: { + hardhat: { + accounts: [ + { + privateKey: "0xe1904817e407877ea09135933f39121aa68ed0d9729d301084c544204171d100", + balance: "100000000000000000000", + }, + ], + }, + }, + defaultNetwork: "hardhat", + xdeploy: { + salt: ethers_1.ethers.utils.id(Date.now().toString()), + signer: "0xe1904817e407877ea09135933f39121aa68ed0d9729d301084c544204171d100", + networks: ["hardhat"], + rpcUrls: ["hardhat"], + gasLimit: 1.2 * 10 ** 6, + }, +}; +exports.default = config; +//# sourceMappingURL=hardhat.config.js.map \ No newline at end of file diff --git a/dist/test/fixture-projects/hardhat-project-without-constructor/hardhat.config.js.map b/dist/test/fixture-projects/hardhat-project-without-constructor/hardhat.config.js.map new file mode 100644 index 0000000..e07658f --- /dev/null +++ b/dist/test/fixture-projects/hardhat-project-without-constructor/hardhat.config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hardhat.config.js","sourceRoot":"","sources":["../../../../test/fixture-projects/hardhat-project-without-constructor/hardhat.config.ts"],"names":[],"mappings":";;AACA,8BAA4B;AAC5B,mCAAgC;AAEhC,MAAM,MAAM,GAAsB;IAChC,QAAQ,EAAE;QACR,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE;YACR,SAAS,EAAE;gBACT,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,GAAG;aACV;SACF;KACF;IACD,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,QAAQ,EAAE;gBACR;oBACE,UAAU,EACR,oEAAoE;oBACtE,OAAO,EAAE,uBAAuB;iBACjC;aACF;SACF;KACF;IACD,cAAc,EAAE,SAAS;IACzB,OAAO,EAAE;QACP,IAAI,EAAE,eAAM,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC5C,MAAM,EACJ,oEAAoE;QACtE,QAAQ,EAAE,CAAC,SAAS,CAAC;QACrB,OAAO,EAAE,CAAC,SAAS,CAAC;QACpB,QAAQ,EAAE,GAAG,GAAG,EAAE,IAAI,CAAC;KACxB;CACF,CAAC;AAEF,kBAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/dist/test/helpers.d.ts b/dist/test/helpers.d.ts new file mode 100644 index 0000000..4fc7310 --- /dev/null +++ b/dist/test/helpers.d.ts @@ -0,0 +1,8 @@ +import { HardhatRuntimeEnvironment } from "hardhat/types"; +declare module "mocha" { + interface Context { + hre: HardhatRuntimeEnvironment; + } +} +export declare function useEnvironment(fixtureProjectName: string): void; +//# sourceMappingURL=helpers.d.ts.map \ No newline at end of file diff --git a/dist/test/helpers.d.ts.map b/dist/test/helpers.d.ts.map new file mode 100644 index 0000000..ac9aaef --- /dev/null +++ b/dist/test/helpers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../test/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,OAAO;QACf,GAAG,EAAE,yBAAyB,CAAC;KAChC;CACF;AAED,wBAAgB,cAAc,CAAC,kBAAkB,EAAE,MAAM,QAWxD"} \ No newline at end of file diff --git a/dist/test/helpers.js b/dist/test/helpers.js new file mode 100644 index 0000000..5f94574 --- /dev/null +++ b/dist/test/helpers.js @@ -0,0 +1,21 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.useEnvironment = void 0; +const plugins_testing_1 = require("hardhat/plugins-testing"); +const path_1 = __importDefault(require("path")); +function useEnvironment(fixtureProjectName) { + const networkName = "hardhat"; + beforeEach("Loading hardhat environment", function () { + process.chdir(path_1.default.join(__dirname, "fixture-projects", fixtureProjectName)); + process.env.HARDHAT_NETWORK = networkName; + this.hre = require("hardhat"); + }); + afterEach("Resetting hardhat", function () { + (0, plugins_testing_1.resetHardhatContext)(); + }); +} +exports.useEnvironment = useEnvironment; +//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/dist/test/helpers.js.map b/dist/test/helpers.js.map new file mode 100644 index 0000000..038a82b --- /dev/null +++ b/dist/test/helpers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../test/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,6DAA8D;AAE9D,gDAAwB;AAQxB,SAAgB,cAAc,CAAC,kBAA0B;IACvD,MAAM,WAAW,GAAG,SAAS,CAAC;IAC9B,UAAU,CAAC,6BAA6B,EAAE;QACxC,OAAO,CAAC,KAAK,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CAAC;QAC5E,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,WAAW,CAAC;QAC1C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,mBAAmB,EAAE;QAC7B,IAAA,qCAAmB,GAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC;AAXD,wCAWC"} \ No newline at end of file diff --git a/dist/test/xdeploy_with_constructor.test.d.ts b/dist/test/xdeploy_with_constructor.test.d.ts new file mode 100644 index 0000000..faf15e3 --- /dev/null +++ b/dist/test/xdeploy_with_constructor.test.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=xdeploy_with_constructor.test.d.ts.map \ No newline at end of file diff --git a/dist/test/xdeploy_with_constructor.test.d.ts.map b/dist/test/xdeploy_with_constructor.test.d.ts.map new file mode 100644 index 0000000..09752fb --- /dev/null +++ b/dist/test/xdeploy_with_constructor.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"xdeploy_with_constructor.test.d.ts","sourceRoot":"","sources":["../../test/xdeploy_with_constructor.test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/test/xdeploy_with_constructor.test.js b/dist/test/xdeploy_with_constructor.test.js new file mode 100644 index 0000000..a39a3d4 --- /dev/null +++ b/dist/test/xdeploy_with_constructor.test.js @@ -0,0 +1,266 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const helpers_1 = require("./helpers"); +const chai_1 = require("chai"); +const plugins_1 = require("hardhat/plugins"); +describe("Plugin test xdeploy on Hardhat with constructor", function () { + describe("Hardhat Runtime Environment (HRE) extension", function () { + (0, helpers_1.useEnvironment)("hardhat-project-with-constructor"); + it("calling xdeploy successfully", async function () { + return this.hre.run("xdeploy", { + contract: "ERC20Mock", + constructorArgs: [ + "MyToken", + "MTKN", + "0x9F3f11d72d96910df008Cfe3aBA40F361D2EED03", + 100000000000000000000n, + ], + }); + }); + it("should fail due to missing network arguments - version 1", async function () { + this.hre.config.xdeploy.networks = []; + return this.hre + .run("xdeploy", { + contract: "ERC20Mock", + constructorArgs: [ + "MyToken", + "MTKN", + "0x9F3f11d72d96910df008Cfe3aBA40F361D2EED03", + 100000000000000000000n, + ], + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing network arguments should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please provide at least one deployment network via the hardhat config."); + }); + }); + it("should fail due to missing network arguments - version 2", async function () { + this.hre.config.xdeploy.networks = undefined; + return this.hre + .run("xdeploy", { + contract: "ERC20Mock", + constructorArgs: [ + "MyToken", + "MTKN", + "0x9F3f11d72d96910df008Cfe3aBA40F361D2EED03", + 100000000000000000000n, + ], + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing network arguments should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please provide at least one deployment network via the hardhat config."); + }); + }); + it("should fail due to unsupported network argument", async function () { + this.hre.config.xdeploy.networks = ["hardhat", "WAGMI"]; + return this.hre + .run("xdeploy", { + contract: "ERC20Mock", + constructorArgs: [ + "MyToken", + "MTKN", + "0x9F3f11d72d96910df008Cfe3aBA40F361D2EED03", + 100000000000000000000n, + ], + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "unsupported network arguments should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("You have tried to configure a network that this plugin does not yet support,"); + }); + }); + it("should fail due to unequal length of `networks` and `rpcUrls`", async function () { + this.hre.config.xdeploy.networks = ["hardhat"]; + this.hre.config.xdeploy.rpcUrls = [ + "hardhat", + "https://mainnet.infura.io/v3/506b137aa", + ]; + return this.hre + .run("xdeploy", { + contract: "ERC20Mock", + constructorArgs: [ + "MyToken", + "MTKN", + "0x9F3f11d72d96910df008Cfe3aBA40F361D2EED03", + 100000000000000000000n, + ], + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "unequal length of `networks` and `rpcUrls` arguments should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please ensure that both parameters have the same length"); + }); + }); + it("should fail due to missing salt value - version 1", async function () { + this.hre.config.xdeploy.salt = undefined; + return this.hre + .run("xdeploy", { + contract: "ERC20Mock", + constructorArgs: [ + "MyToken", + "MTKN", + "0x9F3f11d72d96910df008Cfe3aBA40F361D2EED03", + 100000000000000000000n, + ], + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing salt value should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please provide an arbitrary value as salt."); + }); + }); + it("should fail due to missing salt value - version 2", async function () { + this.hre.config.xdeploy.salt = ""; + return this.hre + .run("xdeploy", { + contract: "ERC20Mock", + constructorArgs: [ + "MyToken", + "MTKN", + "0x9F3f11d72d96910df008Cfe3aBA40F361D2EED03", + 100000000000000000000n, + ], + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing salt value should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please provide an arbitrary value as salt."); + }); + }); + it("should fail due to missing signer - version 1", async function () { + this.hre.config.xdeploy.signer = undefined; + return this.hre + .run("xdeploy", { + contract: "ERC20Mock", + constructorArgs: [ + "MyToken", + "MTKN", + "0x9F3f11d72d96910df008Cfe3aBA40F361D2EED03", + 100000000000000000000n, + ], + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing signer value should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please provide a signer private key."); + }); + }); + it("should fail due to missing signer - version 2", async function () { + this.hre.config.xdeploy.signer = ""; + return this.hre + .run("xdeploy", { + contract: "ERC20Mock", + constructorArgs: [ + "MyToken", + "MTKN", + "0x9F3f11d72d96910df008Cfe3aBA40F361D2EED03", + 100000000000000000000n, + ], + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing signer value should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please provide a signer private key."); + }); + }); + it("should fail due to missing contract - version 1", async function () { + return this.hre + .run("xdeploy", { + contract: undefined, + constructorArgs: [ + "MyToken", + "MTKN", + "0x9F3f11d72d96910df008Cfe3aBA40F361D2EED03", + 100000000000000000000n, + ], + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing contract value should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please specify the contract name of the smart contract to be deployed."); + }); + }); + it("should fail due to missing contract - version 2", async function () { + return this.hre + .run("xdeploy", { + contract: "", + constructorArgs: [ + "MyToken", + "MTKN", + "0x9F3f11d72d96910df008Cfe3aBA40F361D2EED03", + 100000000000000000000n, + ], + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing contract value should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please specify the contract name of the smart contract to be deployed."); + }); + }); + it("should fail due to exceeding gasLimit", async function () { + this.hre.config.xdeploy.gasLimit = 15.1 * 10 ** 6; + return this.hre + .run("xdeploy", { + contract: "ERC20Mock", + constructorArgs: [ + "MyToken", + "MTKN", + "0x9F3f11d72d96910df008Cfe3aBA40F361D2EED03", + 100000000000000000000n, + ], + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "too high gasLimit should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please specify a lower gasLimit."); + }); + }); + }); +}); +//# sourceMappingURL=xdeploy_with_constructor.test.js.map \ No newline at end of file diff --git a/dist/test/xdeploy_with_constructor.test.js.map b/dist/test/xdeploy_with_constructor.test.js.map new file mode 100644 index 0000000..6f345ed --- /dev/null +++ b/dist/test/xdeploy_with_constructor.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"xdeploy_with_constructor.test.js","sourceRoot":"","sources":["../../test/xdeploy_with_constructor.test.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,+BAAsC;AACtC,6CAA8D;AAE9D,QAAQ,CAAC,iDAAiD,EAAE;IAC1D,QAAQ,CAAC,6CAA6C,EAAE;QACtD,IAAA,wBAAc,EAAC,kCAAkC,CAAC,CAAC;QACnD,EAAE,CAAC,8BAA8B,EAAE,KAAK;YACtC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE;gBAC7B,QAAQ,EAAE,WAAW;gBACrB,eAAe,EAAE;oBACf,SAAS;oBACT,MAAM;oBACN,4CAA4C;oBAC5C,sBAAsB;iBACvB;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0DAA0D,EAAE,KAAK;YAClE,IAA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,oDAAoD,CACrD,CAAC;gBACF,IAAA,aAAM,EAAC,MAAM,CAAC,OAAO,CAAC;qBACnB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;qBACjB,GAAG,CAAC,OAAO,CACV,wEAAwE,CACzE,CAAC;YACN,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uCAAuC,EAAE,KAAK;YAC/C,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC;YAClD,OAAO,IAAI,CAAC,GAAG;iBACZ,GAAG,CAAC,SAAS,EAAE;gBACd,QAAQ,EAAE,WAAW;gBACrB,eAAe,EAAE;oBACf,SAAS;oBACT,MAAM;oBACN,4CAA4C;oBAC5C,sBAAsB;iBACvB;aACF,CAAC;iBACD,IAAI,CAAC,GAAG,EAAE;gBACT,aAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;YAChD,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;gBAChB,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAChC,qCAA2B,EAC3B,+CAA+C,CAChD,CAAC;gBACF,IAAA,aAAM,EAAC,MAAM,CAAC,OAAO,CAAC;qBACnB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;qBACjB,GAAG,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;YACrD,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/test/xdeploy_without_constructor.test.d.ts b/dist/test/xdeploy_without_constructor.test.d.ts new file mode 100644 index 0000000..baeb1e6 --- /dev/null +++ b/dist/test/xdeploy_without_constructor.test.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=xdeploy_without_constructor.test.d.ts.map \ No newline at end of file diff --git a/dist/test/xdeploy_without_constructor.test.d.ts.map b/dist/test/xdeploy_without_constructor.test.d.ts.map new file mode 100644 index 0000000..eae835e --- /dev/null +++ b/dist/test/xdeploy_without_constructor.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"xdeploy_without_constructor.test.d.ts","sourceRoot":"","sources":["../../test/xdeploy_without_constructor.test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/test/xdeploy_without_constructor.test.js b/dist/test/xdeploy_without_constructor.test.js new file mode 100644 index 0000000..70baed9 --- /dev/null +++ b/dist/test/xdeploy_without_constructor.test.js @@ -0,0 +1,192 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const helpers_1 = require("./helpers"); +const chai_1 = require("chai"); +const plugins_1 = require("hardhat/plugins"); +describe("Plugin test xdeploy on Hardhat without constructor", function () { + describe("Hardhat Runtime Environment (HRE) extension", function () { + (0, helpers_1.useEnvironment)("hardhat-project-without-constructor"); + it("calling xdeploy successfully", async function () { + return this.hre.run("xdeploy", { + contract: "SimpleContract", + }); + }); + it("should fail due to missing network arguments - version 1", async function () { + this.hre.config.xdeploy.networks = []; + return this.hre + .run("xdeploy", { + contract: "SimpleContract", + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing network arguments should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please provide at least one deployment network via the hardhat config."); + }); + }); + it("should fail due to missing network arguments - version 2", async function () { + this.hre.config.xdeploy.networks = undefined; + return this.hre + .run("xdeploy", { + contract: "SimpleContract", + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing network arguments should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please provide at least one deployment network via the hardhat config."); + }); + }); + it("should fail due to unsupported network argument", async function () { + this.hre.config.xdeploy.networks = ["hardhat", "WAGMI"]; + return this.hre + .run("xdeploy", { + contract: "SimpleContract", + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "unsupported network arguments should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("You have tried to configure a network that this plugin does not yet support,"); + }); + }); + it("should fail due to unequal length of `networks` and `rpcUrls`", async function () { + this.hre.config.xdeploy.networks = ["hardhat"]; + this.hre.config.xdeploy.rpcUrls = [ + "hardhat", + "https://mainnet.infura.io/v3/506b137aa", + ]; + return this.hre + .run("xdeploy", { + contract: "SimpleContract", + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "unequal length of `networks` and `rpcUrls` arguments should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please ensure that both parameters have the same length"); + }); + }); + it("should fail due to missing salt value - version 1", async function () { + this.hre.config.xdeploy.salt = undefined; + return this.hre + .run("xdeploy", { + contract: "SimpleContract", + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing salt value should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please provide an arbitrary value as salt."); + }); + }); + it("should fail due to missing salt value - version 2", async function () { + this.hre.config.xdeploy.salt = ""; + return this.hre + .run("xdeploy", { + contract: "SimpleContract", + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing salt value should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please provide an arbitrary value as salt."); + }); + }); + it("should fail due to missing signer - version 1", async function () { + this.hre.config.xdeploy.signer = undefined; + return this.hre + .run("xdeploy", { + contract: "SimpleContract", + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing signer value should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please provide a signer private key."); + }); + }); + it("should fail due to missing signer - version 2", async function () { + this.hre.config.xdeploy.signer = ""; + return this.hre + .run("xdeploy", { + contract: "SimpleContract", + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing signer value should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please provide a signer private key."); + }); + }); + it("should fail due to missing contract - version 1", async function () { + return this.hre + .run("xdeploy") + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing contract value should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please specify the contract name of the smart contract to be deployed."); + }); + }); + it("should fail due to missing contract - version 2", async function () { + return this.hre + .run("xdeploy", { + contract: "", + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "missing contract value should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please specify the contract name of the smart contract to be deployed."); + }); + }); + it("should fail due to exceeding gasLimit", async function () { + this.hre.config.xdeploy.gasLimit = 15.1 * 10 ** 6; + return this.hre + .run("xdeploy", { + contract: "SimpleContract", + }) + .then(() => { + chai_1.assert.fail("deployment request should fail"); + }) + .catch((reason) => { + (0, chai_1.expect)(reason).to.be.an.instanceOf(plugins_1.NomicLabsHardhatPluginError, "too high gasLimit should throw a plugin error"); + (0, chai_1.expect)(reason.message) + .to.be.a("string") + .and.include("Please specify a lower gasLimit."); + }); + }); + }); +}); +//# sourceMappingURL=xdeploy_without_constructor.test.js.map \ No newline at end of file diff --git a/dist/test/xdeploy_without_constructor.test.js.map b/dist/test/xdeploy_without_constructor.test.js.map new file mode 100644 index 0000000..15182b6 --- /dev/null +++ b/dist/test/xdeploy_without_constructor.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"xdeploy_without_constructor.test.js","sourceRoot":"","sources":["../../test/xdeploy_without_constructor.test.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,+BAAsC;AACtC,6CAA8D;AAE9D,QAAQ,CAAC,oDAAoD,EAAE;IAC7D,QAAQ,CAAC,6CAA6C,EAAE;QACtD,IAAA,wBAAc,EAAC,qCAAqC,CAAC,CAAC;QACtD,EAAE,CAAC,8BAA8B,EAAE,KAAK;YACtC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE;gBAC7B,QAAQ,EAAE,gBAAgB;aAC3B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0DAA0D,EAAE,KAAK;YAClE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,GAAG,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC,GAAG;iBACZ,GAAG,CAAC,SAAS,EAAE;gBACd,QAAQ,EAAE,gBAAgB;aAC3B,CAAC;iBACD,IAAI,CAAC,GAAG,EAAE;gBACT,aAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;YAChD,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;gBAChB,IAAA,aAAM,EAAC,MAAM,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AC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAChC,qCAA2B,EAC3B,oDAAoD,CACrD,CAAC;gBACF,IAAA,aAAM,EAAC,MAAM,CAAC,OAAO,CAAC;qBACnB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;qBACjB,GAAG,CAAC,OAAO,CACV,wEAAwE,CACzE,CAAC;YACN,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uCAAuC,EAAE,KAAK;YAC/C,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC;YAClD,OAAO,IAAI,CAAC,GAAG;iBACZ,GAAG,CAAC,SAAS,EAAE;gBACd,QAAQ,EAAE,gBAAgB;aAC3B,CAAC;iBACD,IAAI,CAAC,GAAG,EAAE;gBACT,aAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;YAChD,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;gBAChB,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAChC,qCAA2B,EAC3B,+CAA+C,CAChD,CAAC;gBACF,IAAA,aAAM,EAAC,MAAM,CAAC,OAAO,CAAC;qBACnB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;qBACjB,GAAG,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;YACrD,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index fdac208..981b15c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@requestnetwork/xdeployer", - "version": "1.2.6", + "version": "1.2.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@requestnetwork/xdeployer", - "version": "1.2.6", + "version": "1.2.7", "license": "MIT", "devDependencies": { "@nomiclabs/hardhat-ethers": "^2.0.5", diff --git a/package.json b/package.json index 0dfbfb5..7b381e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@requestnetwork/xdeployer", - "version": "1.2.6", + "version": "1.2.7", "description": "Fork of https://github.com/pcaversaccio/xdeployer", "license": "MIT", "main": "dist/src/index.js",