UNPKG

@vechain/vebetterdao-contracts

Version:

Open-source repository that houses the smart contracts powering the decentralized VeBetterDAO on the VeChain Thor blockchain.

39 lines (38 loc) 2.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const config_1 = require("@repo/config"); const helpers_1 = require("../../helpers"); const contracts_1 = require("@repo/config/contracts"); const hardhat_1 = require("hardhat"); async function main() { if (!process.env.NEXT_PUBLIC_APP_ENV) { throw new Error("Missing NEXT_PUBLIC_APP_ENV"); } const config = (0, config_1.getConfig)(process.env.NEXT_PUBLIC_APP_ENV); const contractsConfig = (0, contracts_1.getContractsConfig)(process.env.NEXT_PUBLIC_APP_ENV); const deployer = (await hardhat_1.ethers.getSigners())[0]; console.log(`================ Deploying contracts on ${config.network.name} (${config.nodeUrl}) with ${config.environment} configurations `); console.log(`================ Address used to deploy: ${deployer.address}`); console.log(`Deploying B3TRMultiSig contract`); // Deploy B3TRMultiSig const B3TRMultiSig = await hardhat_1.ethers.getContractFactory("B3TRMultiSig"); const b3TRMultiSig = await B3TRMultiSig.deploy(contractsConfig.MULTI_SIG_SIGNERS, 2); console.log(`B3TRMultiSig deployed at: ${await b3TRMultiSig.getAddress()}`); // check that upgrade was successful console.log("================================================================================"); console.log(`Updating the config file with the new B3TRMultiSig contract address`); try { Object.assign(config, { b3TRMultiSig: await b3TRMultiSig.getAddress() }); await (0, helpers_1.updateConfig)(config, "b3TRMultiSig"); console.log("Config file updated successfully"); } catch (e) { console.error("Failed to update config file, update it manually"); } console.log(`Update .../deploy_output/contracts.txt file with new B3TRMultiSig contract address`); console.log("================================================================================"); console.log("Execution completed"); process.exit(0); } // Execute the main function main();