@@ -192,7 +192,7 @@ const passPhase = async () => {
192
192
}
193
193
const before = getNumber ( await sortition . phase ( ) ) ;
194
194
try {
195
- const gas = ( ( await sortition . passPhase . estimateGas ( ) ) * toBigInt ( 150 ) ) / toBigInt ( 100 ) ; // 50% extra gas
195
+ const gas = ( ( await sortition . passPhase . estimateGas ( ) ) * 150n ) / 100n ; // 50% extra gas
196
196
const tx = await ( await sortition . passPhase ( { gasLimit : gas } ) ) . wait ( ) ;
197
197
logger . info ( `passPhase txID: ${ tx ?. hash } ` ) ;
198
198
} catch ( e ) {
@@ -221,7 +221,7 @@ const passPeriod = async (dispute: { id: string }) => {
221
221
}
222
222
const before = ( await core . disputes ( dispute . id ) ) . period ;
223
223
try {
224
- const gas = ( ( await core . passPeriod . estimateGas ( dispute . id ) ) * toBigInt ( 150 ) ) / toBigInt ( 100 ) ; // 50% extra gas
224
+ const gas = ( ( await core . passPeriod . estimateGas ( dispute . id ) ) * 150n ) / 100n ; // 50% extra gas
225
225
const tx = await ( await core . passPeriod ( dispute . id , { gasLimit : gas } ) ) . wait ( ) ;
226
226
logger . info ( `passPeriod txID: ${ tx ?. hash } ` ) ;
227
227
} catch ( e ) {
@@ -285,7 +285,7 @@ const executeRuling = async (dispute: { id: string }) => {
285
285
return success ;
286
286
}
287
287
try {
288
- const gas = ( ( await core . executeRuling . estimateGas ( dispute . id ) ) * toBigInt ( 150 ) ) / toBigInt ( 100 ) ; // 50% extra gas
288
+ const gas = ( ( await core . executeRuling . estimateGas ( dispute . id ) ) * 150n ) / 100n ; // 50% extra gas
289
289
const tx = await ( await core . executeRuling ( dispute . id , { gasLimit : gas } ) ) . wait ( ) ;
290
290
logger . info ( `ExecuteRuling txID: ${ tx ?. hash } ` ) ;
291
291
success = true ;
@@ -302,7 +302,7 @@ const withdrawAppealContribution = async (
302
302
) : Promise < boolean > => {
303
303
const { disputeKitClassic : kit } = await getContracts ( ) ;
304
304
let success = false ;
305
- let amountWithdrawn = toBigInt ( 0 ) ;
305
+ let amountWithdrawn = 0n ;
306
306
try {
307
307
amountWithdrawn = await kit . withdrawFeesAndRewards . staticCall (
308
308
disputeId ,
@@ -316,7 +316,7 @@ const withdrawAppealContribution = async (
316
316
) ;
317
317
return success ;
318
318
}
319
- if ( amountWithdrawn === toBigInt ( 0 ) ) {
319
+ if ( amountWithdrawn === 0n ) {
320
320
logger . debug (
321
321
`WithdrawFeesAndRewards: no fees or rewards to withdraw for dispute #${ disputeId } , round #${ roundId } , choice ${ contribution . choice } and beneficiary ${ contribution . contributor . id } , skipping`
322
322
) ;
@@ -333,8 +333,8 @@ const withdrawAppealContribution = async (
333
333
roundId ,
334
334
contribution . choice
335
335
) ) *
336
- toBigInt ( 150 ) ) /
337
- toBigInt ( 100 ) ; // 50% extra gas
336
+ 150n ) /
337
+ 100n ; // 50% extra gas
338
338
const tx = await (
339
339
await kit . withdrawFeesAndRewards ( disputeId , contribution . contributor . id , roundId , contribution . choice , {
340
340
gasLimit : gas ,
@@ -353,14 +353,14 @@ const executeDelayedStakes = async () => {
353
353
354
354
// delayedStakes = 1 + delayedStakeWriteIndex - delayedStakeReadIndex
355
355
const delayedStakesRemaining =
356
- toBigInt ( 1 ) + ( await sortition . delayedStakeWriteIndex ( ) ) - ( await sortition . delayedStakeReadIndex ( ) ) ;
356
+ 1n + ( await sortition . delayedStakeWriteIndex ( ) ) - ( await sortition . delayedStakeReadIndex ( ) ) ;
357
357
358
358
const delayedStakes =
359
359
delayedStakesRemaining < MAX_DELAYED_STAKES_ITERATIONS
360
360
? delayedStakesRemaining
361
361
: toBigInt ( MAX_DELAYED_STAKES_ITERATIONS ) ;
362
362
363
- if ( delayedStakes === toBigInt ( 0 ) ) {
363
+ if ( delayedStakes === 0n ) {
364
364
logger . info ( "No delayed stakes to execute" ) ;
365
365
return true ;
366
366
}
@@ -373,7 +373,7 @@ const executeDelayedStakes = async () => {
373
373
return success ;
374
374
}
375
375
try {
376
- const gas = ( ( await sortition . executeDelayedStakes . estimateGas ( delayedStakes ) ) * toBigInt ( 150 ) ) / toBigInt ( 100 ) ; // 50% extra gas
376
+ const gas = ( ( await sortition . executeDelayedStakes . estimateGas ( delayedStakes ) ) * 150n ) / 100n ; // 50% extra gas
377
377
const tx = await ( await sortition . executeDelayedStakes ( delayedStakes , { gasLimit : gas } ) ) . wait ( ) ;
378
378
logger . info ( `executeDelayedStakes txID: ${ tx ?. hash } ` ) ;
379
379
} catch ( e ) {
@@ -389,7 +389,7 @@ const getMissingJurors = async (dispute: { id: string; currentRoundIndex: string
389
389
} ;
390
390
391
391
const isDisputeFullyDrawn = async ( dispute : { id : string ; currentRoundIndex : string } ) : Promise < boolean > => {
392
- return ( await getMissingJurors ( dispute ) ) === toBigInt ( 0 ) ;
392
+ return ( await getMissingJurors ( dispute ) ) === 0n ;
393
393
} ;
394
394
395
395
const getNumberOfMissingRepartitions = async (
@@ -398,7 +398,7 @@ const getNumberOfMissingRepartitions = async (
398
398
) => {
399
399
const { core } = await getContracts ( ) ;
400
400
const { repartitions, drawnJurors } = await core . getRoundInfo ( dispute . id , dispute . currentRoundIndex ) ;
401
- return coherentCount === toBigInt ( 0 )
401
+ return coherentCount === 0n
402
402
? drawnJurors . length - getNumber ( repartitions )
403
403
: 2 * drawnJurors . length - getNumber ( repartitions ) ;
404
404
} ;
@@ -545,7 +545,7 @@ async function main() {
545
545
await delay ( ITERATIONS_COOLDOWN_PERIOD ) ; // To avoid spiking the gas price
546
546
maxDrawingTimePassed = await hasMaxDrawingTimePassed ( ) ;
547
547
numberOfMissingJurors = await getMissingJurors ( dispute ) ;
548
- } while ( ! ( numberOfMissingJurors === toBigInt ( 0 ) ) && ! maxDrawingTimePassed ) ;
548
+ } while ( ! ( numberOfMissingJurors === 0n ) && ! maxDrawingTimePassed ) ;
549
549
}
550
550
// At this point, either all disputes are fully drawn or max drawing time has passed
551
551
}
@@ -589,7 +589,7 @@ async function main() {
589
589
590
590
for ( var dispute of unprocessedDisputesInExecution ) {
591
591
const { period } = await core . disputes ( dispute . id ) ;
592
- if ( period !== toBigInt ( 4 ) ) {
592
+ if ( period !== 4n ) {
593
593
logger . info ( `Skipping dispute #${ dispute . id } because it is not in the execution period` ) ;
594
594
continue ;
595
595
}
@@ -642,7 +642,7 @@ async function main() {
642
642
contributions = [ ...new Set ( contributions ) ] ;
643
643
for ( let contribution of contributions ) {
644
644
// Could be improved by pinpointing exactly which round requires a withdrawal, just try all of them for now.
645
- for ( let round = toBigInt ( dispute . currentRoundIndex ) ; round >= 0 ; round = round - toBigInt ( 1 ) ) {
645
+ for ( let round = toBigInt ( dispute . currentRoundIndex ) ; round >= 0 ; round = round - 1n ) {
646
646
await withdrawAppealContribution ( dispute . id , round . toString ( ) , contribution ) ;
647
647
await delay ( ITERATIONS_COOLDOWN_PERIOD ) ; // To avoid spiking the gas price
648
648
}
0 commit comments