|
1 | 1 | import { HardhatRuntimeEnvironment } from "hardhat/types"; |
2 | | -import { DeployFunction } from "hardhat-deploy/types"; |
| 2 | +import { DeployFunction, DeployResult } from "hardhat-deploy/types"; |
3 | 3 | import { BigNumber } from "ethers"; |
4 | 4 | import getContractAddress from "../deploy-helpers/getContractAddress"; |
5 | 5 | import { VRFSubscriptionManagerV2, VRFSubscriptionManagerV2Mock } from "../typechain-types"; |
@@ -151,19 +151,23 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) |
151 | 151 | const numWords = 1; |
152 | 152 | const vrfCoordinator = vrfCoordinatorByChain.get(Number(await getChainId())) ?? AddressZero; |
153 | 153 | // Deploy the VRF Subscription Manager contract on Arbitrum, a mock contract on Hardhat node or nothing on other networks. |
154 | | - const vrfSubscriptionManager = vrfCoordinator |
155 | | - ? chainId === HomeChains.HARDHAT |
156 | | - ? await deploy("VRFSubscriptionManagerV2Mock", { |
157 | | - from: deployer, |
158 | | - args: [deployer, vrfCoordinator], |
159 | | - log: true, |
160 | | - }) |
161 | | - : await deploy("VRFSubscriptionManagerV2", { |
162 | | - from: deployer, |
163 | | - args: [deployer, vrfCoordinator, link], |
164 | | - log: true, |
165 | | - }) |
166 | | - : AddressZero; |
| 154 | + let vrfSubscriptionManager: DeployResult | string; |
| 155 | + if (vrfCoordinator) { |
| 156 | + vrfSubscriptionManager = |
| 157 | + chainId === HomeChains.HARDHAT |
| 158 | + ? await deploy("VRFSubscriptionManagerV2Mock", { |
| 159 | + from: deployer, |
| 160 | + args: [deployer, vrfCoordinator], |
| 161 | + log: true, |
| 162 | + }) |
| 163 | + : await deploy("VRFSubscriptionManagerV2", { |
| 164 | + from: deployer, |
| 165 | + args: [deployer, vrfCoordinator, link], |
| 166 | + log: true, |
| 167 | + }); |
| 168 | + } else { |
| 169 | + vrfSubscriptionManager = AddressZero; |
| 170 | + } |
167 | 171 |
|
168 | 172 | // Execute the setup transactions for using VRF and deploy the Consumer contract on Hardhat node |
169 | 173 | // The Sortition Module rng source is not changed to the VRF Consumer. |
|
0 commit comments