UNPKG

@vechain/vebetterdao-contracts

Version:

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

902 lines 87.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.setWhitelistedFunctions = void 0; exports.deployAll = deployAll; const hardhat_1 = require("hardhat"); const setup_1 = require("./setup"); const helpers_1 = require("../helpers"); const libraries_1 = require("../libraries"); const xAllocationVotingLibraries_1 = require("../libraries/xAllocationVotingLibraries"); const navigatorRegistryLibraries_1 = require("../libraries/navigatorRegistryLibraries"); const roles_1 = require("../helpers/roles"); const x2EarnLibraries_1 = require("../libraries/x2EarnLibraries"); const deployStargate_1 = require("./mocks/deployStargate"); const deployNodeManagement_1 = require("./mocks/deployNodeManagement"); const contracts_1 = require("@repo/config/contracts"); const deployLegacyNodes_1 = require("./mocks/deployLegacyNodes"); // GalaxyMember NFT Values const name = "VeBetterDAO Galaxy Member"; const symbol = "GM"; async function deployAll(config) { const start = performance.now(); const networkConfig = hardhat_1.network.config; console.log(`================ Deploying contracts on ${hardhat_1.network.name} (${networkConfig.url}) with ${config.NEXT_PUBLIC_APP_ENV} configurations `); const [deployer, ...allCreators] = await hardhat_1.ethers.getSigners(); const creators = allCreators.slice(0, setup_1.APPS.length); console.log(`================ Address used to deploy: ${deployer.address}`); // We use a temporary admin to deploy and initialize contracts then transfer role to the real admin // Also we have many roles in our contracts but we currently use one wallet for all roles const TEMP_ADMIN = config.NEXT_PUBLIC_APP_ENV === contracts_1.AppEnv.MAINNET ? deployer.address : config.CONTRACTS_ADMIN_ADDRESS; console.log("================================================================================"); console.log("Temporary admin set to ", TEMP_ADMIN); console.log("Final admin will be set to ", config.CONTRACTS_ADMIN_ADDRESS); console.log("================================================================================"); // ---------- Contracts Deployment ---------- // console.log(`================ Contracts Deployment Initiated `); // ---------------------- Deploy Libraries ---------------------- console.log("Deploying Governance Libraries"); const { GovernorClockLogicLibV1, GovernorConfiguratorLibV1, GovernorDepositLogicLibV1, GovernorFunctionRestrictionsLogicLibV1, GovernorProposalLogicLibV1, GovernorQuorumLogicLibV1, GovernorVotesLogicLibV1, GovernorStateLogicLibV1, GovernorClockLogicLib, GovernorConfiguratorLib, GovernorDepositLogicLib, GovernorFunctionRestrictionsLogicLib, GovernorProposalLogicLib, GovernorQuorumLogicLib, GovernorVotesLogicLib, GovernorStateLogicLib, GovernorClockLogicLibV3, GovernorConfiguratorLibV3, GovernorFunctionRestrictionsLogicLibV3, GovernorQuorumLogicLibV3, GovernorProposalLogicLibV3, GovernorVotesLogicLibV3, GovernorDepositLogicLibV3, GovernorStateLogicLibV3, GovernorClockLogicLibV4, GovernorConfiguratorLibV4, GovernorFunctionRestrictionsLogicLibV4, GovernorQuorumLogicLibV4, GovernorProposalLogicLibV4, GovernorVotesLogicLibV4, GovernorDepositLogicLibV4, GovernorStateLogicLibV4, GovernorClockLogicLibV5, GovernorConfiguratorLibV5, GovernorFunctionRestrictionsLogicLibV5, GovernorQuorumLogicLibV5, GovernorProposalLogicLibV5, GovernorVotesLogicLibV5, GovernorDepositLogicLibV5, GovernorStateLogicLibV5, GovernorClockLogicLibV6, GovernorConfiguratorLibV6, GovernorFunctionRestrictionsLogicLibV6, GovernorGovernanceLogicLibV6, GovernorQuorumLogicLibV6, GovernorProposalLogicLibV6, GovernorVotesLogicLibV6, GovernorDepositLogicLibV6, GovernorStateLogicLibV6, GovernorClockLogicLibV7, GovernorConfiguratorLibV7, GovernorDepositLogicLibV7, GovernorFunctionRestrictionsLogicLibV7, GovernorProposalLogicLibV7, GovernorQuorumLogicLibV7, GovernorStateLogicLibV7, GovernorVotesLogicLibV7, GovernorGovernanceLogicLibV7, GovernorClockLogicLibV8, GovernorConfiguratorLibV8, GovernorDepositLogicLibV8, GovernorFunctionRestrictionsLogicLibV8, GovernorProposalLogicLibV8, GovernorQuorumLogicLibV8, GovernorStateLogicLibV8, GovernorVotesLogicLibV8, GovernorGovernanceLogicLibV8, } = await (0, libraries_1.governanceLibraries)({ logOutput: true, latestVersionOnly: false }); console.log("Deploying VeBetter Passport Libraries"); // Deploy Passport Libraries const { // V1 PassportChecksLogicV1, PassportConfiguratorV1, PassportEntityLogicV1, PassportDelegationLogicV1, PassportPersonhoodLogicV1, PassportPoPScoreLogicV1, PassportSignalingLogicV1, PassportWhitelistAndBlacklistLogicV1, // V2 PassportChecksLogicV2, PassportConfiguratorV2, PassportEntityLogicV2, PassportDelegationLogicV2, PassportPersonhoodLogicV2, PassportPoPScoreLogicV2, PassportSignalingLogicV2, PassportWhitelistAndBlacklistLogicV2, // V3 PassportChecksLogicV3, PassportConfiguratorV3, PassportEntityLogicV3, PassportDelegationLogicV3, PassportPersonhoodLogicV3, PassportPoPScoreLogicV3, PassportSignalingLogicV3, PassportWhitelistAndBlacklistLogicV3, // V4 PassportChecksLogicV4, PassportConfiguratorV4, PassportEntityLogicV4, PassportDelegationLogicV4, PassportPersonhoodLogicV4, PassportPoPScoreLogicV4, PassportSignalingLogicV4, PassportWhitelistAndBlacklistLogicV4, // V5 (latest) PassportChecksLogic, PassportConfigurator, PassportEntityLogic, PassportDelegationLogic, PassportPersonhoodLogic, PassportPoPScoreLogic, PassportSignalingLogic, PassportWhitelistAndBlacklistLogic, } = await (0, libraries_1.passportLibraries)({ logOutput: true, latestVersionOnly: false }); if (!PassportChecksLogicV1 || !PassportConfiguratorV1 || !PassportEntityLogicV1 || !PassportDelegationLogicV1 || !PassportPersonhoodLogicV1 || !PassportPoPScoreLogicV1 || !PassportSignalingLogicV1 || !PassportWhitelistAndBlacklistLogicV1) { throw new Error("Failed to deploy VeBetter Passport V1 libraries"); } if (!PassportChecksLogicV2 || !PassportConfiguratorV2 || !PassportEntityLogicV2 || !PassportDelegationLogicV2 || !PassportPersonhoodLogicV2 || !PassportPoPScoreLogicV2 || !PassportSignalingLogicV2 || !PassportWhitelistAndBlacklistLogicV2) { throw new Error("Failed to deploy VeBetter Passport V2 libraries"); } if (!PassportChecksLogicV3 || !PassportConfiguratorV3 || !PassportEntityLogicV3 || !PassportDelegationLogicV3 || !PassportPersonhoodLogicV3 || !PassportPoPScoreLogicV3 || !PassportSignalingLogicV3 || !PassportWhitelistAndBlacklistLogicV3) { throw new Error("Failed to deploy VeBetter Passport V3 libraries"); } if (!PassportChecksLogicV4 || !PassportConfiguratorV4 || !PassportEntityLogicV4 || !PassportDelegationLogicV4 || !PassportPersonhoodLogicV4 || !PassportPoPScoreLogicV4 || !PassportSignalingLogicV4 || !PassportWhitelistAndBlacklistLogicV4) { throw new Error("Failed to deploy VeBetter Passport V4 libraries"); } if (!PassportChecksLogic || !PassportConfigurator || !PassportEntityLogic || !PassportDelegationLogic || !PassportPersonhoodLogic || !PassportPoPScoreLogic || !PassportSignalingLogic || !PassportWhitelistAndBlacklistLogic) { throw new Error("Failed to deploy VeBetter Passport latest libraries"); } console.log("Deploying X2Earn App Libraries"); const { AdministrationUtils, EndorsementUtils, VoteEligibilityUtils, AppStorageUtils, // V2 AdministrationUtilsV2, EndorsementUtilsV2, VoteEligibilityUtilsV2, // V3 AdministrationUtilsV3, EndorsementUtilsV3, VoteEligibilityUtilsV3, // V4 AdministrationUtilsV4, EndorsementUtilsV4, VoteEligibilityUtilsV4, // V5 AdministrationUtilsV5, EndorsementUtilsV5, VoteEligibilityUtilsV5, // V6 AdministrationUtilsV6, EndorsementUtilsV6, VoteEligibilityUtilsV6, // V7 AdministrationUtilsV7, EndorsementUtilsV7, VoteEligibilityUtilsV7, } = await (0, x2EarnLibraries_1.x2EarnLibraries)({ logOutput: true, latestVersionOnly: false }); console.log("Deploying XAllocationVoting Libraries"); const xAllocLibs = await (0, xAllocationVotingLibraries_1.xAllocationVotingLibraries)(true); console.log("Deploying NavigatorRegistry Libraries"); const navLibs = await (0, navigatorRegistryLibraries_1.navigatorRegistryLibraries)(true); const { AutoVotingLogic } = xAllocLibs; console.log("Deploying Challenges Libraries"); const { ChallengeCoreLogic: ChallengeCoreLogicLib, ChallengeSettlementLogic: ChallengeSettlementLogicLib } = await (0, libraries_1.challengesLibraries)({ logOutput: true }); // Verify all required libraries are deployed if (!AdministrationUtilsV3 || !EndorsementUtilsV3 || !VoteEligibilityUtilsV3) { throw new Error("Failed to deploy X2Earn V3 libraries"); } if (!AdministrationUtilsV2 || !EndorsementUtilsV2 || !VoteEligibilityUtilsV2) { throw new Error("Failed to deploy X2Earn V2 libraries"); } if (!AdministrationUtilsV4 || !EndorsementUtilsV4 || !VoteEligibilityUtilsV4) { throw new Error("Failed to deploy X2Earn V4 libraries"); } if (!AdministrationUtilsV5 || !EndorsementUtilsV5 || !VoteEligibilityUtilsV5) { throw new Error("Failed to deploy X2Earn V5 libraries"); } if (!AdministrationUtilsV6 || !EndorsementUtilsV6 || !VoteEligibilityUtilsV6) { throw new Error("Failed to deploy X2Earn V6 libraries"); } if (!AdministrationUtilsV7 || !EndorsementUtilsV7 || !VoteEligibilityUtilsV7) { throw new Error("Failed to deploy X2Earn V7 libraries"); } if (!AdministrationUtils || !EndorsementUtils || !VoteEligibilityUtils || !AppStorageUtils) { throw new Error("Failed to deploy X2Earn latest libraries"); } console.log("Deploying NavigatorRegistry Libraries"); const navigatorLibraryAddresses = { NavigatorStakingUtils: await navLibs.NavigatorStakingUtils.getAddress(), NavigatorDelegationUtils: await navLibs.NavigatorDelegationUtils.getAddress(), NavigatorVotingUtils: await navLibs.NavigatorVotingUtils.getAddress(), NavigatorFeeUtils: await navLibs.NavigatorFeeUtils.getAddress(), NavigatorSlashingUtils: await navLibs.NavigatorSlashingUtils.getAddress(), NavigatorLifecycleUtils: await navLibs.NavigatorLifecycleUtils.getAddress(), }; if (!navigatorLibraryAddresses.NavigatorStakingUtils || !navigatorLibraryAddresses.NavigatorDelegationUtils || !navigatorLibraryAddresses.NavigatorVotingUtils || !navigatorLibraryAddresses.NavigatorFeeUtils || !navigatorLibraryAddresses.NavigatorSlashingUtils || !navigatorLibraryAddresses.NavigatorLifecycleUtils) { throw new Error("Failed to deploy NavigatorRegistry libraries"); } else { console.log("NavigatorRegistry libraries deployed successfully"); } // Deploy NavigatorRegistry proxy only, we need only the address for the cross-contract wiring, we will initialize it later const navigatorRegistryProxyAddress = await (0, helpers_1.deployProxyWithoutInitialization)("NavigatorRegistry", navigatorLibraryAddresses); // Deploy mocks for local and testnet envs; use real external contracts for testnet-staging and mainnet let stargateNftMock; let stargateMock; let nodeManagementMock; let vechainNodesMock; const useMockExternalContracts = config.NEXT_PUBLIC_APP_ENV === contracts_1.AppEnv.LOCAL || config.NEXT_PUBLIC_APP_ENV === contracts_1.AppEnv.TESTNET; if (useMockExternalContracts) { // Deploy Stargate Mock console.log("Deploying Stargate Mock"); const { stargateNFT, stargate } = await (0, deployStargate_1.deployStargateMock)({ logOutput: true }); stargateMock = stargate; stargateNftMock = stargateNFT; // Deploy NodeManagement Mock console.log("Deploying NodeManagement Mock"); nodeManagementMock = await (0, deployNodeManagement_1.deployNodeManagementMock)({ stargateNFTProxyAddress: await stargateNftMock.getAddress(), logOutput: true, }); const { vechainNodesMock: vechainNodesMockDeployed } = await (0, deployLegacyNodes_1.deployLegacyNodesMock)({ logOutput: true }); vechainNodesMock = vechainNodesMockDeployed; } else { stargateMock = (await hardhat_1.ethers.getContractAt("Stargate", config.STARGATE_CONTRACT_ADDRESS)); stargateNftMock = (await hardhat_1.ethers.getContractAt("StargateNFT", config.STARGATE_NFT_CONTRACT_ADDRESS)); nodeManagementMock = (await hardhat_1.ethers.getContractAt("NodeManagementV3", config.NODE_MANAGEMENT_CONTRACT_ADDRESS)); vechainNodesMock = (await hardhat_1.ethers.getContractAt("TokenAuction", config.VECHAIN_NODES_CONTRACT_ADDRESS)); } // ---------------------- Deploy Contracts ---------------------- console.log("Deploying VeBetter DAO contracts"); const b3tr = await deployB3trToken(TEMP_ADMIN, TEMP_ADMIN, // Minter config.CONTRACTS_ADMIN_ADDRESS); let vot3 = (await (0, helpers_1.deployAndUpgrade)(["VOT3V1", "VOT3"], [ [ config.CONTRACTS_ADMIN_ADDRESS, // admin config.CONTRACTS_ADMIN_ADDRESS, // pauser config.CONTRACTS_ADMIN_ADDRESS, // upgrader await b3tr.getAddress(), ], [navigatorRegistryProxyAddress], ], { versions: [undefined, 2], logOutput: true, })); const timelock = (await (0, helpers_1.deployProxy)("TimeLock", [ config.TIMELOCK_MIN_DELAY, [], // proposers [], // executors TEMP_ADMIN, // admin config.CONTRACTS_ADMIN_ADDRESS, // upgrader ], undefined, undefined, true)); const x2EarnCreator = (await (0, helpers_1.deployAndUpgrade)(["X2EarnCreatorV1", "X2EarnCreator"], [[TEMP_ADMIN, TEMP_ADMIN], [config.NEXT_PUBLIC_APP_ENV === contracts_1.AppEnv.TESTNET_STAGING]], { versions: [undefined, 2], logOutput: true, })); const treasury = (await (0, helpers_1.deployProxy)("Treasury", [ await b3tr.getAddress(), await vot3.getAddress(), await timelock.getAddress(), TEMP_ADMIN, // admin config.CONTRACTS_ADMIN_ADDRESS, // upgrader config.CONTRACTS_ADMIN_ADDRESS, //pauser config.TREASURY_TRANSFER_LIMIT_VET, config.TREASURY_TRANSFER_LIMIT_B3TR, config.TREASURY_TRANSFER_LIMIT_VOT3, config.TREASURY_TRANSFER_LIMIT_VTHO, ], undefined, undefined, true)); // Initialization requires the address of the x2EarnRewardsPool, for this reason we will initialize it after const veBetterPassportContractAddress = await (0, helpers_1.deployProxyOnly)("VeBetterPassportV1", { PassportChecksLogicV1: await PassportChecksLogicV1.getAddress(), PassportConfiguratorV1: await PassportConfiguratorV1.getAddress(), PassportEntityLogicV1: await PassportEntityLogicV1.getAddress(), PassportDelegationLogicV1: await PassportDelegationLogicV1.getAddress(), PassportPersonhoodLogicV1: await PassportPersonhoodLogicV1.getAddress(), PassportPoPScoreLogicV1: await PassportPoPScoreLogicV1.getAddress(), PassportSignalingLogicV1: await PassportSignalingLogicV1.getAddress(), PassportWhitelistAndBlacklistLogicV1: await PassportWhitelistAndBlacklistLogicV1.getAddress(), }); // Set XAllocationVoting to temp address const X_ALLOCATION_ADRESS_TEMP = TEMP_ADMIN; const X2EARNREWARDSPOOL_ADDRESS_TEMP = TEMP_ADMIN; const x2EarnAppsV7 = (await (0, helpers_1.deployAndUpgrade)(["X2EarnAppsV1", "X2EarnAppsV2", "X2EarnAppsV3", "X2EarnAppsV4", "X2EarnAppsV5", "X2EarnAppsV6", "X2EarnAppsV7"], [ [ config.XAPP_BASE_URI, [TEMP_ADMIN], //admins deployer.address, // upgrader - use deployer address for initial upgrade TEMP_ADMIN, // governance role ], [ config.XAPP_GRACE_PERIOD, await nodeManagementMock.getAddress(), veBetterPassportContractAddress, await x2EarnCreator.getAddress(), ], [config.X2EARN_NODE_COOLDOWN_PERIOD, X_ALLOCATION_ADRESS_TEMP], [X2EARNREWARDSPOOL_ADDRESS_TEMP], [], [], [await stargateNftMock.getAddress()], ], { versions: [undefined, 2, 3, 4, 5, 6, 7], libraries: [ undefined, { AdministrationUtilsV2: await AdministrationUtilsV2.getAddress(), EndorsementUtilsV2: await EndorsementUtilsV2.getAddress(), VoteEligibilityUtilsV2: await VoteEligibilityUtilsV2.getAddress(), }, { AdministrationUtilsV3: await AdministrationUtilsV3.getAddress(), EndorsementUtilsV3: await EndorsementUtilsV3.getAddress(), VoteEligibilityUtilsV3: await VoteEligibilityUtilsV3.getAddress(), }, { AdministrationUtilsV4: await AdministrationUtilsV4.getAddress(), EndorsementUtilsV4: await EndorsementUtilsV4.getAddress(), VoteEligibilityUtilsV4: await VoteEligibilityUtilsV4.getAddress(), }, { AdministrationUtilsV5: await AdministrationUtilsV5.getAddress(), EndorsementUtilsV5: await EndorsementUtilsV5.getAddress(), VoteEligibilityUtilsV5: await VoteEligibilityUtilsV5.getAddress(), }, { AdministrationUtilsV6: await AdministrationUtilsV6.getAddress(), EndorsementUtilsV6: await EndorsementUtilsV6.getAddress(), VoteEligibilityUtilsV6: await VoteEligibilityUtilsV6.getAddress(), }, { AdministrationUtilsV7: await AdministrationUtilsV7.getAddress(), EndorsementUtilsV7: await EndorsementUtilsV7.getAddress(), VoteEligibilityUtilsV7: await VoteEligibilityUtilsV7.getAddress(), }, ], logOutput: true, })); // IMPORTANT: We will upgrade X2EarnAppsV7 to X2EarnAppsV8 in next steps since // we will first need to initialize it with some contracts addresses (xAllocationVoting, x2EarnRewardsPool) // It cannot be done here because in versions > 7 the setters have been removed. const x2EarnRewardsPool = (await (0, helpers_1.deployAndUpgrade)([ "X2EarnRewardsPoolV1", "X2EarnRewardsPoolV2", "X2EarnRewardsPoolV3", "X2EarnRewardsPoolV4", "X2EarnRewardsPoolV5", "X2EarnRewardsPoolV7", "X2EarnRewardsPool", ], [ [ TEMP_ADMIN, // admin TEMP_ADMIN, // contracts address manager TEMP_ADMIN, // upgrader await b3tr.getAddress(), await x2EarnAppsV7.getAddress(), ], [ config.CONTRACTS_ADMIN_ADDRESS, // impact admin address config.X_2_EARN_INITIAL_IMPACT_KEYS, // impact keys ], [veBetterPassportContractAddress], [], [], [], [], ], { versions: [undefined, 2, 3, 4, 5, 6, 7], logOutput: true, })); const xAllocationPool = (await (0, helpers_1.deployAndUpgrade)([ "XAllocationPoolV1", "XAllocationPoolV2", "XAllocationPoolV3", "XAllocationPoolV4", "XAllocationPoolV5", "XAllocationPoolV6", "XAllocationPool", ], [ [ TEMP_ADMIN, // admin TEMP_ADMIN, // upgrader TEMP_ADMIN, // contractsAddressManager await b3tr.getAddress(), await treasury.getAddress(), await x2EarnAppsV7.getAddress(), await x2EarnRewardsPool.getAddress(), ], [], [], [], [], [], [[], []], // roundIds and amounts for historical unallocated funds ], { versions: [undefined, 2, 3, 4, 5, 6, 7], logOutput: true, })); const galaxyMember = (await (0, helpers_1.deployAndUpgrade)(["GalaxyMemberV1", "GalaxyMemberV2", "GalaxyMemberV3", "GalaxyMemberV4", "GalaxyMemberV5", "GalaxyMember"], [ [ { name: name, symbol: symbol, admin: TEMP_ADMIN, upgrader: deployer.address, pauser: config.CONTRACTS_ADMIN_ADDRESS, minter: config.CONTRACTS_ADMIN_ADDRESS, contractsAddressManager: TEMP_ADMIN, maxLevel: config.GM_NFT_MAX_LEVEL, baseTokenURI: config.GM_NFT_BASE_URI, b3trToUpgradeToLevel: config.GM_NFT_B3TR_REQUIRED_TO_UPGRADE_TO_LEVEL, b3tr: await b3tr.getAddress(), treasury: await treasury.getAddress(), }, ], [ deployer.address, // deprecated, we do not care about the legacy vechain nodes contract anymore await nodeManagementMock.getAddress(), TEMP_ADMIN, config.GM_NFT_NODE_TO_FREE_LEVEL, ], [], [], [], [await stargateNftMock.getAddress()], ], { versions: [undefined, 2, 3, 4, 5, 6], logOutput: true, })); const emissions = (await (0, helpers_1.deployAndUpgrade)(["EmissionsV1", "EmissionsV2", "Emissions"], [ [ { minter: TEMP_ADMIN, admin: TEMP_ADMIN, upgrader: TEMP_ADMIN, contractsAddressManager: TEMP_ADMIN, decaySettingsManager: TEMP_ADMIN, b3trAddress: await b3tr.getAddress(), destinations: [ await xAllocationPool.getAddress(), config.VOTE_2_EARN_POOL_ADDRESS, await treasury.getAddress(), config.MIGRATION_ADDRESS, ], initialXAppAllocation: config.INITIAL_X_ALLOCATION, cycleDuration: config.EMISSIONS_CYCLE_DURATION, decaySettings: [ config.EMISSIONS_X_ALLOCATION_DECAY_PERCENTAGE, config.EMISSIONS_VOTE_2_EARN_DECAY_PERCENTAGE, config.EMISSIONS_X_ALLOCATION_DECAY_PERIOD, config.EMISSIONS_VOTE_2_EARN_ALLOCATION_DECAY_PERIOD, ], treasuryPercentage: config.EMISSIONS_TREASURY_PERCENTAGE, maxVote2EarnDecay: config.EMISSIONS_MAX_VOTE_2_EARN_DECAY_PERCENTAGE, migrationAmount: config.MIGRATION_AMOUNT, }, ], [config.EMISSIONS_IS_NOT_ALIGNED], [config.GM_PERCENTAGE_OF_TREASURY], ], { versions: [undefined, 2, 3], logOutput: true, })); let voterRewards = (await (0, helpers_1.deployAndUpgrade)(["VoterRewardsV1", "VoterRewardsV2", "VoterRewardsV3", "VoterRewardsV4", "VoterRewardsV5"], [ [ TEMP_ADMIN, // admin TEMP_ADMIN, // upgrader // TODO: transferRole config.CONTRACTS_ADMIN_ADDRESS, // contractsAddressManager await emissions.getAddress(), await galaxyMember.getAddress(), await b3tr.getAddress(), config.VOTER_REWARDS_LEVELS_V2, config.GM_MULTIPLIERS_V2, ], [], [], [], [[], []], ], { versions: [undefined, 2, 3, 4, 5], logOutput: true, })); const relayerRewardsPool = (await (0, helpers_1.deployAndUpgrade)(["RelayerRewardsPoolV1", "RelayerRewardsPoolV2", "RelayerRewardsPool"], [ [ TEMP_ADMIN, // admin TEMP_ADMIN, // upgrader await b3tr.getAddress(), // b3trAddress await emissions.getAddress(), // emissionsAddress TEMP_ADMIN, // xAllocationVotingAddress - will be assigned later below ], [], [], ], { versions: [undefined, 2, 3], logOutput: true, })); const xAllocationVoting = (await (0, helpers_1.deployAndUpgrade)([ "XAllocationVotingV1", "XAllocationVotingV2", "XAllocationVotingV3", "XAllocationVotingV4", "XAllocationVotingV5", "XAllocationVotingV6", "XAllocationVotingV7", "XAllocationVotingV8", "XAllocationVotingV9", "XAllocationVoting", ], [ [ { vot3Token: await vot3.getAddress(), quorumPercentage: config.X_ALLOCATION_VOTING_QUORUM_PERCENTAGE, initialVotingPeriod: config.EMISSIONS_CYCLE_DURATION - 1, timeLock: await timelock.getAddress(), voterRewards: await voterRewards.getAddress(), emissions: await emissions.getAddress(), admins: [await timelock.getAddress(), TEMP_ADMIN], upgrader: TEMP_ADMIN, contractsAddressManager: TEMP_ADMIN, x2EarnAppsAddress: await x2EarnAppsV7.getAddress(), baseAllocationPercentage: config.X_ALLOCATION_POOL_BASE_ALLOCATION_PERCENTAGE, appSharesCap: config.X_ALLOCATION_POOL_APP_SHARES_MAX_CAP, votingThreshold: config.X_ALLOCATION_VOTING_VOTING_THRESHOLD, }, ], [], [], [], [], [], [], [], [navigatorRegistryProxyAddress, config.XALLOCATION_CITIZEN_SKIP_WINDOW_BLOCKS], // V9: set NavigatorRegistry + skip window [], // V10: no reinitializer needed ], { versions: [undefined, 2, 3, 4, 5, 6, 7, 8, 9, 10], libraries: [ undefined, undefined, undefined, undefined, undefined, undefined, undefined, { AutoVotingLogicV8: await AutoVotingLogic.getAddress() }, { 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(), }, { 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(), }, ], logOutput: true, })); voterRewards = (await (0, helpers_1.upgradeProxy)("VoterRewardsV5", "VoterRewardsV6", await voterRewards.getAddress(), [await xAllocationVoting.getAddress(), await relayerRewardsPool.getAddress()], { version: 6, })); voterRewards = (await (0, helpers_1.upgradeProxy)("VoterRewardsV6", "VoterRewards", await voterRewards.getAddress(), [ 0, // roundStartTimepoint — no active round during fresh deploy config.VOTER_REWARDS_FRESHNESS_MULTIPLIER_TIER1, config.VOTER_REWARDS_FRESHNESS_MULTIPLIER_TIER2, config.VOTER_REWARDS_FRESHNESS_MULTIPLIER_TIER3, config.VOTER_REWARDS_INTENT_MULTIPLIER_FOR_AGAINST, config.VOTER_REWARDS_INTENT_MULTIPLIER_ABSTAIN, navigatorRegistryProxyAddress, ], { version: 7, })); const veBetterPassportV1 = (await (0, helpers_1.initializeProxy)(veBetterPassportContractAddress, "VeBetterPassportV1", [ { x2EarnApps: await x2EarnAppsV7.getAddress(), xAllocationVoting: await xAllocationVoting.getAddress(), galaxyMember: await galaxyMember.getAddress(), signalingThreshold: config.VEPASSPORT_BOT_SIGNALING_THRESHOLD, //signalingThreshold roundsForCumulativeScore: config.VEPASSPORT_ROUNDS_FOR_CUMULATIVE_PARTICIPATION_SCORE, //roundsForCumulativeScore minimumGalaxyMemberLevel: config.VEPASSPORT_GALAXY_MEMBER_MINIMUM_LEVEL, //galaxyMemberMinimumLevel blacklistThreshold: config.VEPASSPORT_BLACKLIST_THRESHOLD_PERCENTAGE, //blacklistThreshold whitelistThreshold: config.VEPASSPORT_WHITELIST_THRESHOLD_PERCENTAGE, //whitelistThreshold maxEntitiesPerPassport: config.VEPASSPORT_PASSPORT_MAX_ENTITIES, //maxEntitiesPerPassport decayRate: config.VEPASSPORT_DECAY_RATE, //decayRate }, { admin: TEMP_ADMIN, // admins botSignaler: config.CONTRACTS_ADMIN_ADDRESS, // botSignaler upgrader: TEMP_ADMIN, // upgrader settingsManager: TEMP_ADMIN, // settingsManager roleGranter: config.CONTRACTS_ADMIN_ADDRESS, // roleGranter blacklister: config.CONTRACTS_ADMIN_ADDRESS, // blacklister whitelister: config.CONTRACTS_ADMIN_ADDRESS, // whitelistManager actionRegistrar: config.CONTRACTS_ADMIN_ADDRESS, // actionRegistrar actionScoreManager: config.CONTRACTS_ADMIN_ADDRESS, // actionScoreManager resetSignaler: config.CONTRACTS_ADMIN_ADDRESS, // resetSignaler }, ], { PassportChecksLogicV1: await PassportChecksLogicV1.getAddress(), PassportConfiguratorV1: await PassportConfiguratorV1.getAddress(), PassportEntityLogicV1: await PassportEntityLogicV1.getAddress(), PassportDelegationLogicV1: await PassportDelegationLogicV1.getAddress(), PassportPersonhoodLogicV1: await PassportPersonhoodLogicV1.getAddress(), PassportPoPScoreLogicV1: await PassportPoPScoreLogicV1.getAddress(), PassportSignalingLogicV1: await PassportSignalingLogicV1.getAddress(), PassportWhitelistAndBlacklistLogicV1: await PassportWhitelistAndBlacklistLogicV1.getAddress(), })); // @todo: Check if this is still needed const veBetterPassportV2 = (await (0, helpers_1.upgradeProxy)("VeBetterPassportV1", "VeBetterPassportV2", await veBetterPassportV1.getAddress(), [], { version: 2, libraries: { PassportChecksLogicV2: await PassportChecksLogicV2.getAddress(), PassportConfiguratorV2: await PassportConfiguratorV2.getAddress(), PassportEntityLogicV2: await PassportEntityLogicV2.getAddress(), PassportDelegationLogicV2: await PassportDelegationLogicV2.getAddress(), PassportPersonhoodLogicV2: await PassportPersonhoodLogicV2.getAddress(), PassportPoPScoreLogicV2: await PassportPoPScoreLogicV2.getAddress(), PassportSignalingLogicV2: await PassportSignalingLogicV2.getAddress(), PassportWhitelistAndBlacklistLogicV2: await PassportWhitelistAndBlacklistLogicV2.getAddress(), }, logOutput: true, })); // @todo: Check if this is still needed const veBetterPassportV3 = (await (0, helpers_1.upgradeProxy)("VeBetterPassportV2", "VeBetterPassportV3", await veBetterPassportV1.getAddress(), // Proxy address remains unchanged for transparent proxy upgrades [], { version: 3, libraries: { PassportChecksLogicV3: await PassportChecksLogicV3.getAddress(), PassportConfiguratorV3: await PassportConfiguratorV3.getAddress(), PassportEntityLogicV3: await PassportEntityLogicV3.getAddress(), PassportDelegationLogicV3: await PassportDelegationLogicV3.getAddress(), PassportPersonhoodLogicV3: await PassportPersonhoodLogicV3.getAddress(), PassportPoPScoreLogicV3: await PassportPoPScoreLogicV3.getAddress(), PassportSignalingLogicV3: await PassportSignalingLogicV3.getAddress(), PassportWhitelistAndBlacklistLogicV3: await PassportWhitelistAndBlacklistLogicV3.getAddress(), }, logOutput: true, })); // V4 (intermediate) const veBetterPassportV4 = (await (0, helpers_1.upgradeProxy)("VeBetterPassportV3", "VeBetterPassportV4", await veBetterPassportV1.getAddress(), // Proxy address remains unchanged for transparent proxy upgrades [config.CONTRACTS_ADMIN_ADDRESS], // Include as part of v4 initialization upgrade { version: 4, libraries: { PassportChecksLogicV4: await PassportChecksLogicV4.getAddress(), PassportConfiguratorV4: await PassportConfiguratorV4.getAddress(), PassportEntityLogicV4: await PassportEntityLogicV4.getAddress(), PassportDelegationLogicV4: await PassportDelegationLogicV4.getAddress(), PassportPersonhoodLogicV4: await PassportPersonhoodLogicV4.getAddress(), PassportPoPScoreLogicV4: await PassportPoPScoreLogicV4.getAddress(), PassportSignalingLogicV4: await PassportSignalingLogicV4.getAddress(), PassportWhitelistAndBlacklistLogicV4: await PassportWhitelistAndBlacklistLogicV4.getAddress(), }, logOutput: true, })); // V5 (latest) const veBetterPassport = (await (0, helpers_1.upgradeProxy)("VeBetterPassportV4", "VeBetterPassport", await veBetterPassportV1.getAddress(), // Proxy address remains unchanged for transparent proxy upgrades [], { version: 5, libraries: { PassportChecksLogic: await PassportChecksLogic.getAddress(), PassportConfigurator: await PassportConfigurator.getAddress(), PassportEntityLogic: await PassportEntityLogic.getAddress(), PassportDelegationLogic: await PassportDelegationLogic.getAddress(), PassportPersonhoodLogic: await PassportPersonhoodLogic.getAddress(), PassportPoPScoreLogic: await PassportPoPScoreLogic.getAddress(), PassportSignalingLogic: await PassportSignalingLogic.getAddress(), PassportWhitelistAndBlacklistLogic: await PassportWhitelistAndBlacklistLogic.getAddress(), }, logOutput: true, })); const governor = (await (0, helpers_1.deployAndUpgrade)([ "B3TRGovernorV1", "B3TRGovernorV2", "B3TRGovernorV3", "B3TRGovernorV4", "B3TRGovernorV5", "B3TRGovernorV6", "B3TRGovernorV7", "B3TRGovernorV8", "B3TRGovernorV9", "B3TRGovernor", ], [ [ { vot3Token: await vot3.getAddress(), timelock: await timelock.getAddress(), xAllocationVoting: await xAllocationVoting.getAddress(), b3tr: await b3tr.getAddress(), quorumPercentage: config.B3TR_GOVERNOR_QUORUM_PERCENTAGE, initialDepositThreshold: config.B3TR_GOVERNOR_DEPOSIT_THRESHOLD, initialMinVotingDelay: config.B3TR_GOVERNOR_MIN_VOTING_DELAY, initialVotingThreshold: config.B3TR_GOVERNOR_VOTING_THRESHOLD, voterRewards: await voterRewards.getAddress(), isFunctionRestrictionEnabled: true, }, { governorAdmin: TEMP_ADMIN, pauser: config.CONTRACTS_ADMIN_ADDRESS, contractsAddressManager: config.CONTRACTS_ADMIN_ADDRESS, proposalExecutor: config.CONTRACTS_ADMIN_ADDRESS, governorFunctionSettingsRoleAddress: TEMP_ADMIN, }, ], [], [], [veBetterPassportContractAddress], [], [], [ { grantDepositThreshold: config.B3TR_GOVERNOR_GRANT_DEPOSIT_THRESHOLD, //Grant deposit threshold grantVotingThreshold: config.B3TR_GOVERNOR_GRANT_VOTING_THRESHOLD, //Grant voting threshold grantQuorum: config.B3TR_GOVERNOR_GRANT_QUORUM_PERCENTAGE, //Grant quorum percentage grantDepositThresholdCap: config.B3TR_GOVERNOR_GRANT_DEPOSIT_THRESHOLD_CAP, //Grant deposit threshold cap standardDepositThresholdCap: config.B3TR_GOVERNOR_STANDARD_DEPOSIT_THRESHOLD_CAP, //Standard deposit threshold cap standardGMWeight: config.B3TR_GOVERNOR_STANDARD_GM_WEIGHT, //Standard GM weight grantGMWeight: config.B3TR_GOVERNOR_GRANT_GM_WEIGHT, //Grant GM weight galaxyMember: await galaxyMember.getAddress(), //GalaxyMember contract grantsManager: TEMP_ADMIN, //GrantsManager contract }, ], [], [], // v9 [navigatorRegistryProxyAddress, await relayerRewardsPool.getAddress(), config.B3TR_GOVERNOR_SKIP_WINDOW_BLOCKS], // v10 ], { versions: [undefined, 2, 3, 4, 5, 6, 7, 8, 9, 10], libraries: [ { GovernorClockLogicV1: await GovernorClockLogicLibV1.getAddress(), GovernorConfiguratorV1: await GovernorConfiguratorLibV1.getAddress(), GovernorDepositLogicV1: await GovernorDepositLogicLibV1.getAddress(), GovernorFunctionRestrictionsLogicV1: await GovernorFunctionRestrictionsLogicLibV1.getAddress(), GovernorProposalLogicV1: await GovernorProposalLogicLibV1.getAddress(), GovernorQuorumLogicV1: await GovernorQuorumLogicLibV1.getAddress(), GovernorStateLogicV1: await GovernorStateLogicLibV1.getAddress(), GovernorVotesLogicV1: await GovernorVotesLogicLibV1.getAddress(), }, { GovernorClockLogicV1: await GovernorClockLogicLibV1.getAddress(), GovernorConfiguratorV1: await GovernorConfiguratorLibV1.getAddress(), GovernorDepositLogicV1: await GovernorDepositLogicLibV1.getAddress(), GovernorFunctionRestrictionsLogicV1: await GovernorFunctionRestrictionsLogicLibV1.getAddress(), GovernorProposalLogicV1: await GovernorProposalLogicLibV1.getAddress(), GovernorQuorumLogicV1: await GovernorQuorumLogicLibV1.getAddress(), GovernorStateLogicV1: await GovernorStateLogicLibV1.getAddress(), GovernorVotesLogicV1: await GovernorVotesLogicLibV1.getAddress(), }, { GovernorClockLogicV3: await GovernorClockLogicLibV3.getAddress(), GovernorConfiguratorV3: await GovernorConfiguratorLibV3.getAddress(), GovernorDepositLogicV3: await GovernorDepositLogicLibV3.getAddress(), GovernorFunctionRestrictionsLogicV3: await GovernorFunctionRestrictionsLogicLibV3.getAddress(), GovernorProposalLogicV3: await GovernorProposalLogicLibV3.getAddress(), GovernorQuorumLogicV3: await GovernorQuorumLogicLibV3.getAddress(), GovernorStateLogicV3: await GovernorStateLogicLibV3.getAddress(), GovernorVotesLogicV3: await GovernorVotesLogicLibV3.getAddress(), }, { GovernorClockLogicV4: await GovernorClockLogicLibV4.getAddress(), GovernorConfiguratorV4: await GovernorConfiguratorLibV4.getAddress(), GovernorDepositLogicV4: await GovernorDepositLogicLibV4.getAddress(), GovernorFunctionRestrictionsLogicV4: await GovernorFunctionRestrictionsLogicLibV4.getAddress(), GovernorProposalLogicV4: await GovernorProposalLogicLibV4.getAddress(), GovernorQuorumLogicV4: await GovernorQuorumLogicLibV4.getAddress(), GovernorStateLogicV4: await GovernorStateLogicLibV4.getAddress(), GovernorVotesLogicV4: await GovernorVotesLogicLibV4.getAddress(), }, { GovernorClockLogicV5: await GovernorClockLogicLibV5.getAddress(), GovernorConfiguratorV5: await GovernorConfiguratorLibV5.getAddress(), GovernorDepositLogicV5: await GovernorDepositLogicLibV5.getAddress(), GovernorFunctionRestrictionsLogicV5: await GovernorFunctionRestrictionsLogicLibV5.getAddress(), GovernorQuorumLogicV5: await GovernorQuorumLogicLibV5.getAddress(), GovernorProposalLogicV5: await GovernorProposalLogicLibV5.getAddress(), GovernorStateLogicV5: await GovernorStateLogicLibV5.getAddress(), GovernorVotesLogicV5: await GovernorVotesLogicLibV5.getAddress(), }, { GovernorClockLogicV6: await GovernorClockLogicLibV6.getAddress(), GovernorConfiguratorV6: await GovernorConfiguratorLibV6.getAddress(), GovernorDepositLogicV6: await GovernorDepositLogicLibV6.getAddress(), GovernorFunctionRestrictionsLogicV6: await GovernorFunctionRestrictionsLogicLibV6.getAddress(), GovernorProposalLogicV6: await GovernorProposalLogicLibV6.getAddress(), GovernorQuorumLogicV6: await GovernorQuorumLogicLibV6.getAddress(), GovernorStateLogicV6: await GovernorStateLogicLibV6.getAddress(), GovernorVotesLogicV6: await GovernorVotesLogicLibV6.getAddress(), }, { GovernorClockLogicV7: await GovernorClockLogicLibV7.getAddress(), GovernorConfiguratorV7: await GovernorConfiguratorLibV7.getAddress(), GovernorDepositLogicV7: await GovernorDepositLogicLibV7.getAddress(), GovernorFunctionRestrictionsLogicV7: await GovernorFunctionRestrictionsLogicLibV7.getAddress(), GovernorProposalLogicV7: await GovernorProposalLogicLibV7.getAddress(), GovernorQuorumLogicV7: await GovernorQuorumLogicLibV7.getAddress(), GovernorStateLogicV7: await GovernorStateLogicLibV7.getAddress(), GovernorVotesLogicV7: await GovernorVotesLogicLibV7.getAddress(), }, { GovernorClockLogicV8: await GovernorClockLogicLibV8.getAddress(), GovernorConfiguratorV8: await GovernorConfiguratorLibV8.getAddress(), GovernorDepositLogicV8: await GovernorDepositLogicLibV8.getAddress(), GovernorFunctionRestrictionsLogicV8: await GovernorFunctionRestrictionsLogicLibV8.getAddress(), GovernorProposalLogicV8: await GovernorProposalLogicLibV8.getAddress(), GovernorQuorumLogicV8: await GovernorQuorumLogicLibV8.getAddress(), GovernorStateLogicV8: await GovernorStateLogicLibV8.getAddress(), GovernorVotesLogicV8: await GovernorVotesLogicLibV8.getAddress(), }, { GovernorClockLogicV9: await GovernorClockLogicLib.getAddress(), GovernorConfiguratorV9: await GovernorConfiguratorLib.getAddress(), GovernorDepositLogicV9: await GovernorDepositLogicLib.getAddress(), GovernorFunctionRestrictionsLogicV9: await GovernorFunctionRestrictionsLogicLib.getAddress(), GovernorProposalLogicV9: await GovernorProposalLogicLib.getAddress(), GovernorQuorumLogicV9: await GovernorQuorumLogicLib.getAddress(), GovernorStateLogicV9: await GovernorStateLogicLib.getAddress(), GovernorVotesLogicV9: await GovernorVotesLogicLib.getAddress(), }, { GovernorClockLogic: await GovernorClockLogicLib.getAddress(), GovernorConfigurator: await GovernorConfiguratorLib.getAddress(), GovernorDepositLogic: await GovernorDepositLogicLib.getAddress(), GovernorFunctionRestrictionsLogic: await GovernorFunctionRestrictionsLogicLib.getAddress(), GovernorProposalLogic: await GovernorProposalLogicLib.getAddress(), GovernorQuorumLogic: await GovernorQuorumLogicLib.getAddress(), GovernorStateLogic: await GovernorStateLogicLib.getAddress(), GovernorVotesLogic: await GovernorVotesLogicLib.getAddress(), }, ], logOutput: true, })); // Deploy GrantsManager V1 first const grantsManagerV1 = (await (0, helpers_1.deployProxy)("GrantsManagerV1", [ // ← Change to GrantsManagerV1 await governor.getAddress(), // governor address await treasury.getAddress(), // treasury address TEMP_ADMIN, // admin await b3tr.getAddress(), // b3tr address config.MINIMUM_MILESTONE_COUNT, // minimum milestone count ])); // Grant UPGRADER_ROLE to deployer await grantsManagerV1.connect(deployer).grantRole(await grantsManagerV1.UPGRADER_ROLE(), deployer.address); // Upgrade V1 → V2 await (0, helpers_1.upgradeProxy)("GrantsManagerV1", "GrantsManagerV2", await grantsManagerV1.getAddress(), [], { version: 2, libraries: {}, }); // Upgrade V2 → V3 (widens updateMilestoneMetadataURI access to grants receiver + approver role) const grantsManager = (await (0, helpers_1.upgradeProxy)("GrantsManagerV2", "GrantsManager", await grantsManagerV1.getAddress(), [], { version: 3, libraries: {}, })); // DynamicBaseAllocationPool console.log("Deploying DBAPool V1..."); const dbaPoolV1 = (await (0, helpers_1.deployProxy)("DBAPoolV1", [ { admin: TEMP_ADMIN, // admin x2EarnApps: await x2EarnAppsV7.getAddress(), xAllocationPool: await xAllocationPool.getAddress(), x2earnRewardsPool: await x2EarnRewardsPool.getAddress(), b3tr: await b3tr.getAddress(), distributionStartRound: 1, // startRound }, ])); // Grant UPGRADER_ROLE to deployer so we can upgrade const UPGRADER_ROLE_DBA = await dbaPoolV1.UPGRADER_ROLE(); const grantRoleTx = await dbaPoolV1.connect(deployer).grantRole(UPGRADER_ROLE_DBA, deployer.address); await grantRoleTx.wait(); console.log("UPGRADER_ROLE granted to deployer for DBAPool"); // Upgrade to V2 console.log("Upgrading DBAPool to V2..."); const dbaPoolV2 = (await (0, helpers_1.upgradeProxy)("DBAPoolV1", "DBAPoolV2", await dbaPoolV1.getAddress(), [], { version: 2, logOutput: true, })); // Upgrade to V3 console.log("Upgrading DBAPool to V3..."); const dynamicBaseAllocationPool = (await (0, helpers_1.upgradeProxy)("DBAPoolV2", "DBAPool", await dbaPoolV2.getAddress(), [await treasury.getAddress()], { version: 3, logOutput: true, })); console.log("DBAPool deployed and upgraded to V3"); console.log("Setting X2EarnApps addresses and upgrading to X2EarnAppsV8..."); // Setup X2EarnApps addresses await x2EarnAppsV7 .connect(deployer) .setXAllocationVotingGovernor(await xAllocationVoting.getAddress()) .then(async (tx) => await tx.wait()); await x2EarnAppsV7 .connect(deployer) .setX2EarnRewardsPoolContract(await x2EarnRewardsPool.getAddress()) .then(async (tx) => await tx.wait()); await x2EarnAppsV7 .connect(deployer) .setVeBetterPassportContract(await veBetterPassport.getAddress()) .then(async (tx) => await tx.wait()); // This is done here because in versions > 7 the setters have been removed. // V8 flexible endorsement caps: 49 per node per app, 110 total per app const x2EarnApps = (await (0, helpers_1.upgradeProxy)("X2EarnAppsV7", "X2EarnApps", await x2EarnAppsV7.getAddress(), [49, 110], { version: 8, libraries: { AdministrationUtils: await AdministrationUtils.getAddress(), EndorsementUtils: await EndorsementUtils.getAddress(), VoteEligibilityUtils: await VoteEligibilityUtils.getAddress(), AppStorageUtils: await AppStorageUtils.getAddress(), }, })); console.log("X2EarnApps addresses set and upgraded to X2EarnAppsV8"); console.log("Initialize NavigatorRegistry Proxy and Implementation"); const navigatorRegistry = (await (0, helpers_1.initializeProxy)(navigatorRegistryProxyAddress, "NavigatorRegistry", [ { admin: config.CONTRACTS_ADMIN_ADDRESS, upgrader: config.CONTRACTS_ADMIN_ADDRESS, governance: config.CONTRACTS_ADMIN_ADDRESS, b3trToken: await b3tr.getAddress(), vot3Token: await vot3.getAddress(), treasury: await treasury.getAddress(), minStake: config.NAVIGATOR_MIN_STAKE, maxStakePercentage: config.NAVIGATOR_MAX_STAKE_PERCENTAGE, feeLockPeriod: config.NAVIGATOR_FEE_LOCK_PERIOD, feePercentage: config.NAVIGATOR_FEE_PERCENTAGE, exitNoticePeriod: config.NAVIGATOR_EXIT_NOTICE_PERIOD, reportInterval: config.NAVIGATOR_REPORT_INTERVAL, minorSlashPercentage: config.NAVIGATOR_MINOR_SLASH_PERCENTAGE, preferenceCutoffPeriod: config.NAVIGATOR_PREFERENCE_CUTOFF_PERIOD, voterRewards: await voterRewards.getAddress(), xAllo