@vechain/vebetterdao-contracts
Version:
Open-source repository that houses the smart contracts powering the decentralized VeBetterDAO on the VeChain Thor blockchain.
26 lines (25 loc) • 1.01 kB
JavaScript
;
// We recommend this pattern to be able to use async/await everywhere
Object.defineProperty(exports, "__esModule", { value: true });
const config_1 = require("@repo/config");
const deployAll_1 = require("./deployAll");
const contracts_1 = require("@repo/config/contracts");
const devStack_1 = require("../helpers/devStack");
// and properly handle errors.
const execute = async () => {
if (!process.env.NEXT_PUBLIC_APP_ENV) {
throw new Error("Missing NEXT_PUBLIC_APP_ENV");
}
const newContracts = await (0, deployAll_1.deployAll)((0, config_1.getContractsConfig)(process.env.NEXT_PUBLIC_APP_ENV));
const newConfig = await (0, devStack_1.overrideLocalConfigWithNewContracts)(newContracts);
if (process.env.NEXT_PUBLIC_APP_ENV === contracts_1.AppEnv.LOCAL) {
await (0, devStack_1.registerWithDevStack)(newConfig);
}
return newContracts;
};
execute()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});