@@ -61,8 +61,8 @@ const getContracts = async () => {
61
61
default :
62
62
throw new Error ( "Invalid core type, must be one of base, neo" ) ;
63
63
}
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" ) ;
66
66
const pnk = ( await ethers . getContract ( "PNK" ) ) as PNK ;
67
67
return { core, sortition, randomizerRng, blockHashRNG, disputeKitClassic, pnk } ;
68
68
} ;
@@ -183,7 +183,7 @@ const handleError = (e: any) => {
183
183
const isRngReady = async ( ) => {
184
184
const { randomizerRng, blockHashRNG, sortition } = await getContracts ( ) ;
185
185
const currentRng = await sortition . rng ( ) ;
186
- if ( currentRng === randomizerRng . target ) {
186
+ if ( currentRng === randomizerRng ? .target ) {
187
187
const requesterID = await randomizerRng . requesterToID ( sortition . target ) ;
188
188
const n = await randomizerRng . randomNumbers ( requesterID ) ;
189
189
if ( Number ( n ) === 0 ) {
@@ -193,7 +193,7 @@ const isRngReady = async () => {
193
193
logger . info ( `RandomizerRNG is ready: ${ n . toString ( ) } ` ) ;
194
194
return true ;
195
195
}
196
- } else if ( currentRng === blockHashRNG . target ) {
196
+ } else if ( currentRng === blockHashRNG ? .target ) {
197
197
const requestBlock = await sortition . randomNumberRequestBlock ( ) ;
198
198
const lookahead = await sortition . rngLookahead ( ) ;
199
199
const n = await blockHashRNG . receiveRandomness . staticCall ( requestBlock + lookahead ) ;
0 commit comments