From 2c3260949a7ce30fb316c2ff2adc9f3f0beeabb8 Mon Sep 17 00:00:00 2001 From: Victor Elias Date: Fri, 13 Oct 2023 17:32:22 -0300 Subject: [PATCH] deploy: Add BondingVotes target deployment script --- deploy/deploy_bonding_votes.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 deploy/deploy_bonding_votes.ts diff --git a/deploy/deploy_bonding_votes.ts b/deploy/deploy_bonding_votes.ts new file mode 100644 index 00000000..b108b478 --- /dev/null +++ b/deploy/deploy_bonding_votes.ts @@ -0,0 +1,33 @@ +import {HardhatRuntimeEnvironment} from "hardhat/types" +import {DeployFunction} from "hardhat-deploy/types" + +import ContractDeployer from "../utils/deployer" + +const PROD_NETWORKS = ["mainnet", "arbitrumMainnet"] + +const isProdNetwork = (name: string): boolean => { + return PROD_NETWORKS.indexOf(name) > -1 +} + +const func: DeployFunction = async function(hre: HardhatRuntimeEnvironment) { + const {deployments, getNamedAccounts} = hre // Get the deployments and getNamedAccounts which are provided by hardhat-deploy + + const {deployer} = await getNamedAccounts() // Fetch named accounts from hardhat.config.ts + + const contractDeployer = new ContractDeployer(deployer, deployments) + const controller = await contractDeployer.fetchDeployedController() + + const deploy = isProdNetwork(hre.network.name) ? + contractDeployer.deploy.bind(contractDeployer) : + contractDeployer.deployAndRegister.bind(contractDeployer) + + await deploy({ + contract: "BondingVotes", + name: "BondingVotesTarget", + args: [controller.address], + proxy: false // deploying only the target + }) +} + +func.tags = ["BONDING_VOTES"] +export default func