@vechain/vebetterdao-contracts
Version:
Open-source repository that houses the smart contracts powering the decentralized VeBetterDAO on the VeChain Thor blockchain.
59 lines (58 loc) • 2.96 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.main = main;
const helpers_1 = require("../../helpers");
const config_1 = require("@repo/config");
const hardhat_1 = require("hardhat");
/**
* This script deploys the RelayerRewardsPool contract required for auto-voting functionality.
* This must be deployed BEFORE upgrading XAllocationVoting to v8 and VoterRewards to v6.
*/
async function main() {
const envConfig = (0, config_1.getConfig)(process.env.NEXT_PUBLIC_APP_ENV);
const deployer = (await hardhat_1.ethers.getSigners())[0];
console.log(`================ Deploying RelayerRewardsPool on ${envConfig.network.name} (${envConfig.nodeUrl}) with ${envConfig.environment} configurations `);
console.log(`================ Address used to deploy: ${deployer.address}`);
// Validate required contract addresses exist
if (!envConfig.b3trContractAddress) {
throw new Error("B3TR contract address not found in config");
}
if (!envConfig.emissionsContractAddress) {
throw new Error("Emissions contract address not found in config");
}
if (!envConfig.xAllocationVotingContractAddress) {
throw new Error("XAllocationVoting contract address not found in config");
}
const relayerRewardsPool = (await (0, helpers_1.deployAndInitializeLatest)("RelayerRewardsPool", [
{
name: "initialize",
args: [
deployer.address, // admin
deployer.address, // upgrader
envConfig.b3trContractAddress, // b3trAddress
envConfig.emissionsContractAddress, // emissionsAddress
envConfig.xAllocationVotingContractAddress, // xAllocationVotingAddress
],
},
], {}, true));
await relayerRewardsPool.waitForDeployment();
const relayerRewardsPoolAddress = await relayerRewardsPool.getAddress();
console.log("RelayerRewardsPool deployed at address: ", relayerRewardsPoolAddress);
// Verify deployment
const version = await relayerRewardsPool.version();
console.log(`RelayerRewardsPool version: ${version}`);
// Register a relayer
console.log("Registering a relayer...");
const RELAYER_ADDRESS = "0xd15C50eC31d8a4FEe3d168b447efe7BEdA8AE750";
await relayerRewardsPool.connect(deployer).registerRelayer(RELAYER_ADDRESS);
// Verify the relayer is registered
const isRegistered = await relayerRewardsPool.isRegisteredRelayer(RELAYER_ADDRESS);
console.log(`${RELAYER_ADDRESS} is now registered: ${isRegistered}`);
console.log("================ RelayerRewardsPool deployment completed");
console.log("================ Next steps:");
console.log("================ 1. Update config with RelayerRewardsPool address");
console.log("================ 2. Run XAllocationVoting v8 upgrade");
console.log("================ 3. Run VoterRewards v6 upgrade");
process.exit(0);
}
main();