@@ -61,8 +61,8 @@ const getContracts = async () => {
6161 default :
6262 throw new Error ( "Invalid core type, must be one of base, neo" ) ;
6363 }
64- const randomizerRng = ( await ethers . getContract ( "RandomizerRNG" ) ) as RandomizerRNG ;
65- const blockHashRNG = ( await ethers . getContract ( "BlockHashRNG" ) ) as BlockHashRNG ;
64+ const randomizerRng = await ethers . getContractOrNull < RandomizerRNG > ( "RandomizerRNG" ) ;
65+ const blockHashRNG = await ethers . getContractOrNull < BlockHashRNG > ( "BlockHashRNG" ) ;
6666 const pnk = ( await ethers . getContract ( "PNK" ) ) as PNK ;
6767 return { core, sortition, randomizerRng, blockHashRNG, disputeKitClassic, pnk } ;
6868} ;
@@ -183,7 +183,7 @@ const handleError = (e: any) => {
183183const isRngReady = async ( ) => {
184184 const { randomizerRng, blockHashRNG, sortition } = await getContracts ( ) ;
185185 const currentRng = await sortition . rng ( ) ;
186- if ( currentRng === randomizerRng . target ) {
186+ if ( currentRng === randomizerRng ? .target ) {
187187 const requesterID = await randomizerRng . requesterToID ( sortition . target ) ;
188188 const n = await randomizerRng . randomNumbers ( requesterID ) ;
189189 if ( Number ( n ) === 0 ) {
@@ -193,7 +193,7 @@ const isRngReady = async () => {
193193 logger . info ( `RandomizerRNG is ready: ${ n . toString ( ) } ` ) ;
194194 return true ;
195195 }
196- } else if ( currentRng === blockHashRNG . target ) {
196+ } else if ( currentRng === blockHashRNG ? .target ) {
197197 const requestBlock = await sortition . randomNumberRequestBlock ( ) ;
198198 const lookahead = await sortition . rngLookahead ( ) ;
199199 const n = await blockHashRNG . receiveRandomness . staticCall ( requestBlock + lookahead ) ;
0 commit comments