mirror of
https://github.com/semaphore-protocol/semaphore.git
synced 2026-04-28 03:00:41 -04:00
22 lines
631 B
TypeScript
22 lines
631 B
TypeScript
import { DefenderHardhatUpgrades } from "@openzeppelin/hardhat-upgrades"
|
|
import { ContractFactory } from "ethers"
|
|
|
|
export async function deployContract(
|
|
defender: DefenderHardhatUpgrades,
|
|
contractFactory: ContractFactory,
|
|
network?: string,
|
|
args: any[] = []
|
|
) {
|
|
let contract
|
|
|
|
if (network !== undefined && network !== "hardhat" && network !== "localhost") {
|
|
contract = await defender.deployContract(contractFactory, args, { salt: process.env.CREATE2_SALT })
|
|
|
|
await contract.waitForDeployment()
|
|
} else {
|
|
contract = await contractFactory.deploy(...args)
|
|
}
|
|
|
|
return contract
|
|
}
|