@vechain/vebetterdao-contracts
Version:
Open-source repository that houses the smart contracts powering the decentralized VeBetterDAO on the VeChain Thor blockchain.
69 lines (68 loc) • 3.79 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.main = main;
const helpers_1 = require("../../helpers");
const config_1 = require("@repo/config");
const contracts_1 = require("@repo/config/contracts");
const hardhat_1 = require("hardhat");
const xAllocationVotingLibraries_1 = require("../../libraries/xAllocationVotingLibraries");
/**
* This script is used to deploy the XAllocationVoting contract that is not associated with contracts.
* This is for those who only cares about testing the XAllocationVoting specific storage or features.
*/
async function main() {
const config = (0, contracts_1.getContractsConfig)(process.env.NEXT_PUBLIC_APP_ENV);
const envConfig = (0, config_1.getConfig)(process.env.NEXT_PUBLIC_APP_ENV);
const deployer = (await hardhat_1.ethers.getSigners())[0];
const TEMP_ADMIN = envConfig.network.name === "solo" ? config.CONTRACTS_ADMIN_ADDRESS : deployer.address;
console.log(`================ Deploying contracts on ${envConfig.network.name} (${envConfig.nodeUrl}) with ${envConfig.environment} configurations `);
console.log(`================ Address used to deploy: ${deployer.address}`);
const vot3TokenAddress = hardhat_1.ethers.ZeroAddress;
const timelockAddress = hardhat_1.ethers.ZeroAddress;
const voterRewardsAddress = hardhat_1.ethers.ZeroAddress;
const emissionsAddress = hardhat_1.ethers.ZeroAddress;
const x2EarnAppsAddress = hardhat_1.ethers.ZeroAddress;
const veBetterPassportAddress = hardhat_1.ethers.ZeroAddress;
const xAllocLibs = await (0, xAllocationVotingLibraries_1.xAllocationVotingLibraries)(true);
const xAllocationVoting = (await (0, helpers_1.deployAndInitializeLatest)("XAllocationVoting", [
{
name: "initialize",
args: [
{
vot3Token: vot3TokenAddress,
quorumPercentage: config.X_ALLOCATION_VOTING_QUORUM_PERCENTAGE,
initialVotingPeriod: config.EMISSIONS_CYCLE_DURATION - 1,
timeLock: timelockAddress,
voterRewards: voterRewardsAddress,
emissions: emissionsAddress,
admins: [timelockAddress, TEMP_ADMIN],
upgrader: TEMP_ADMIN,
contractsAddressManager: TEMP_ADMIN,
x2EarnAppsAddress: x2EarnAppsAddress,
baseAllocationPercentage: config.X_ALLOCATION_POOL_BASE_ALLOCATION_PERCENTAGE,
appSharesCap: config.X_ALLOCATION_POOL_APP_SHARES_MAX_CAP,
votingThreshold: config.X_ALLOCATION_VOTING_VOTING_THRESHOLD,
},
],
},
{
name: "initializeV2",
args: [veBetterPassportAddress],
},
], {
AutoVotingLogic: await xAllocLibs.AutoVotingLogic.getAddress(),
ExternalContractsUtils: await xAllocLibs.ExternalContractsUtils.getAddress(),
VotingSettingsUtils: await xAllocLibs.VotingSettingsUtils.getAddress(),
VotesUtils: await xAllocLibs.VotesUtils.getAddress(),
VotesQuorumFractionUtils: await xAllocLibs.VotesQuorumFractionUtils.getAddress(),
RoundEarningsSettingsUtils: await xAllocLibs.RoundEarningsSettingsUtils.getAddress(),
RoundFinalizationUtils: await xAllocLibs.RoundFinalizationUtils.getAddress(),
RoundsStorageUtils: await xAllocLibs.RoundsStorageUtils.getAddress(),
RoundVotesCountingUtils: await xAllocLibs.RoundVotesCountingUtils.getAddress(),
}, true));
await xAllocationVoting.waitForDeployment();
console.log("XAllocationVoting address: ", await xAllocationVoting.getAddress());
console.log("================ Execution completed");
process.exit(0);
}
main();