@@ -4,7 +4,7 @@ import { BigNumber } from "ethers";
44import getContractAddress from "./utils/getContractAddress" ;
55import { deployUpgradable } from "./utils/deployUpgradable" ;
66import { HomeChains , isSkipped , isDevnet } from "./utils" ;
7- import { VRFSubscriptionManagerV2Mock , SortitionModule } from "../typechain-types" ;
7+ import { VRFSubscriptionManagerV2 , VRFSubscriptionManagerV2Mock } from "../typechain-types" ;
88
99const 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