UNPKG

deployment-tool

Version:

Tool to deploy and upgrade contracts on Ethereum Mainnet

107 lines 5.24 kB
#!/usr/bin/env node "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); require("@nomiclabs/hardhat-ethers"); require("@openzeppelin/hardhat-upgrades"); require("hardhat-awesome-cli"); const config_1 = require("hardhat/config"); const plugins_1 = require("hardhat/plugins"); const path_1 = __importDefault(require("path")); const ContractDeployment_1 = require("./ContractDeployment"); const serveTasks_1 = __importDefault(require("./serveTasks")); require("./type-extensions"); (0, config_1.extendConfig)(async (config, userConfig) => { var _a; const userPath = (_a = userConfig.paths) === null || _a === void 0 ? void 0 : _a.deployment; let deployment; if (userPath === undefined) deployment = path_1.default.join(config.paths.root, 'deployment'); else { if (path_1.default.isAbsolute(userPath)) deployment = userPath; else deployment = path_1.default.normalize(path_1.default.join(config.paths.root, userPath)); } config.paths.deployment = deployment; }); (0, config_1.extendEnvironment)(async (hre) => { hre.contractDeployment = (0, plugins_1.lazyObject)(() => new ContractDeployment_1.ContractDeployment(hre)); }); /** * deployment task implementation * @param {HardhatUserArgs} args * @param {HardhatEnv} env */ (0, config_1.task)('deployment', 'Deploy or Update a proxy contract').setAction(async function (args, env) { // Call function await (0, serveTasks_1.default)('', args, env); }); /** * deploy-contract task implementation * @param {HardhatUserArgs} args * @param {HardhatEnv} env */ (0, config_1.task)('deploy-contract', 'Deploy a proxy contract, initialize it, save the address, commit, pull and push') .addOptionalParam('contractName', 'The name of the contract to deploy', '') .addOptionalParam('initializeArguments', 'The initialize() argument', '') .addOptionalParam('initializeSignature', 'Function signature of the initialize function', '') .addOptionalParam('tag', 'Add a extra tag to this version of the contract', '') .addOptionalParam('extra', 'Extra data to save with this deployment', '') .addOptionalParam('skipGit', 'Skit git commit, pull & push', 'false') .addOptionalParam('verifyContract', 'Validate the contract on Etherscan.io', 'false') .setAction(async function (args, env) { // Call function await (0, serveTasks_1.default)('deploy-contract', args, env); }); /** * upgrade-contract task implementation * @param {HardhatUserArgs} args * @param {HardhatEnv} env */ (0, config_1.task)('upgrade-contract', 'Upgrade a proxy contract, save the address, commit, pull and push') .addOptionalParam('contractName', 'The name of the contract to deploy', '') .addOptionalParam('tag', 'Add a extra tag to this version of the contract', '') .addOptionalParam('extra', 'Extra data to save with this deployment', '') .addOptionalParam('skipGit', 'Skit git commit, pull & push', 'false') .addOptionalParam('verifyContract', 'Validate the contract on Etherscan.io', 'false') .setAction(async function (args, env) { // Call function await (0, serveTasks_1.default)('upgrade-contract', args, env); }); /** * deploy-contract-static task implementation * @param {HardhatUserArgs} args * @param {HardhatEnv} env */ (0, config_1.task)('deploy-contract-static', 'Deploy a static contract, save the address, commit, pull and push') .addOptionalParam('contractName', 'The name of the contract to deploy', '') .addOptionalParam('constructorArguments', 'The constructor() argument', '') .addOptionalParam('tag', 'Add a extra tag to this version of the contract', '') .addOptionalParam('extra', 'Extra data to save with this deployment', '') .addOptionalParam('skipGit', 'Skit git commit, pull & push', 'false') .addOptionalParam('verifyContract', 'Validate the contract on Etherscan.io', 'false') .setAction(async function (args, env) { // Call function await (0, serveTasks_1.default)('deploy-contract-static', args, env); }); /** * test-deploy-then-upgrade-contract task implementation * @param {HardhatUserArgs} args * @param {HardhatEnv} env */ (0, config_1.task)('test-deploy-then-upgrade-contract', 'Upgrade a proxy contract, save the address, commit, pull and push') .addParam('contractName', 'The name of the contract to deploy', '') .addOptionalParam('initializeArguments', 'The initialize() argument', '') .addOptionalParam('initializeSignature', 'Function signature of the initialize function', '') .addOptionalParam('tag', 'Add a extra tag to this version of the contract', '') .addOptionalParam('extra', 'Extra data to save with this deployment', '') .addOptionalParam('skipGit', 'Skit git commit, pull & push', 'false') .addOptionalParam('verifyContract', 'Validate the contract on Etherscan.io', 'false') .setAction(async function (args, env) { // Call function await (0, serveTasks_1.default)('test-deploy-then-upgrade-contract', args, env); }); //# sourceMappingURL=index.js.map