-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deploy: Add BondingVotes target deployment script
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |