@vechain/vebetterdao-contracts
Version:
Open-source repository that houses the smart contracts powering the decentralized VeBetterDAO on the VeChain Thor blockchain.
66 lines (65 loc) • 3.57 kB
JavaScript
import { deployAndInitializeLatest } from "../../helpers";
import { getConfig } from "@repo/config";
import { getContractsConfig } from "@repo/config/contracts";
import { ethers } from "hardhat";
import { xAllocationVotingLibraries } from "../../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.
*/
export async function main() {
const config = getContractsConfig(process.env.NEXT_PUBLIC_APP_ENV);
const envConfig = getConfig(process.env.NEXT_PUBLIC_APP_ENV);
const deployer = (await 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 = ethers.ZeroAddress;
const timelockAddress = ethers.ZeroAddress;
const voterRewardsAddress = ethers.ZeroAddress;
const emissionsAddress = ethers.ZeroAddress;
const x2EarnAppsAddress = ethers.ZeroAddress;
const veBetterPassportAddress = ethers.ZeroAddress;
const xAllocLibs = await xAllocationVotingLibraries(true);
const xAllocationVoting = (await 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();