Skip to content

Commit ff1a5fd

Browse files
zmalatraxunknownunknown1
authored andcommitted
feat(deploy): add deployment for public networks
1 parent 841c73a commit ff1a5fd

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

contracts/deploy/00-home-chain-arbitration.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { BigNumber } from "ethers";
44
import getContractAddress from "./utils/getContractAddress";
55
import { deployUpgradable } from "./utils/deployUpgradable";
66
import { HomeChains, isSkipped, isDevnet } from "./utils";
7-
import { VRFSubscriptionManagerV2Mock, SortitionModule } from "../typechain-types";
7+
import { VRFSubscriptionManagerV2, VRFSubscriptionManagerV2Mock } from "../typechain-types";
88

99
const pnkByChain = new Map<HomeChains, string>([
1010
[HomeChains.ARBITRUM_ONE, "0x330bD769382cFc6d50175903434CCC8D206DCAE5"],
@@ -177,8 +177,8 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
177177
: AddressZero;
178178

179179
// Execute the setup transactions for using VRF and deploy the Consumer contract on Hardhat node
180+
// The Sortition Module rng source is not changed to the VRF Consumer.
180181
if (vrfSubscriptionManager) {
181-
// The Sortition Module is not changed to the VRF Consumer, it must be done in the test.
182182
if (chainId === HomeChains.HARDHAT) {
183183
const vrfSubscriptionManagerContract = (await hre.ethers.getContract(
184184
"VRFSubscriptionManagerV2Mock"
@@ -201,6 +201,26 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
201201
});
202202
await vrfSubscriptionManagerContract.addConsumer(vrfConsumer.address);
203203
}
204+
} else {
205+
const vrfSubscriptionManagerContract = (await hre.ethers.getContract(
206+
"VRFSubscriptionManagerV2"
207+
)) as VRFSubscriptionManagerV2;
208+
const subscriptionId = await vrfSubscriptionManagerContract.subscriptionId();
209+
const vrfConsumer = await deploy("VRFConsumerV2", {
210+
from: deployer,
211+
args: [
212+
deployer,
213+
vrfCoordinator,
214+
sortitionModule.address,
215+
keyHash,
216+
subscriptionId,
217+
requestConfirmations,
218+
callbackGasLimit,
219+
numWords,
220+
],
221+
log: true,
222+
});
223+
await vrfSubscriptionManagerContract.addConsumer(vrfConsumer.address);
204224
}
205225
};
206226

0 commit comments

Comments
 (0)