@@ -192,7 +192,7 @@ const passPhase = async () => {
192192 }
193193 const before = getNumber ( await sortition . phase ( ) ) ;
194194 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
196196 const tx = await ( await sortition . passPhase ( { gasLimit : gas } ) ) . wait ( ) ;
197197 logger . info ( `passPhase txID: ${ tx ?. hash } ` ) ;
198198 } catch ( e ) {
@@ -221,7 +221,7 @@ const passPeriod = async (dispute: { id: string }) => {
221221 }
222222 const before = ( await core . disputes ( dispute . id ) ) . period ;
223223 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
225225 const tx = await ( await core . passPeriod ( dispute . id , { gasLimit : gas } ) ) . wait ( ) ;
226226 logger . info ( `passPeriod txID: ${ tx ?. hash } ` ) ;
227227 } catch ( e ) {
@@ -285,7 +285,7 @@ const executeRuling = async (dispute: { id: string }) => {
285285 return success ;
286286 }
287287 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
289289 const tx = await ( await core . executeRuling ( dispute . id , { gasLimit : gas } ) ) . wait ( ) ;
290290 logger . info ( `ExecuteRuling txID: ${ tx ?. hash } ` ) ;
291291 success = true ;
@@ -302,7 +302,7 @@ const withdrawAppealContribution = async (
302302) : Promise < boolean > => {
303303 const { disputeKitClassic : kit } = await getContracts ( ) ;
304304 let success = false ;
305- let amountWithdrawn = toBigInt ( 0 ) ;
305+ let amountWithdrawn = 0n ;
306306 try {
307307 amountWithdrawn = await kit . withdrawFeesAndRewards . staticCall (
308308 disputeId ,
@@ -316,7 +316,7 @@ const withdrawAppealContribution = async (
316316 ) ;
317317 return success ;
318318 }
319- if ( amountWithdrawn === toBigInt ( 0 ) ) {
319+ if ( amountWithdrawn === 0n ) {
320320 logger . debug (
321321 `WithdrawFeesAndRewards: no fees or rewards to withdraw for dispute #${ disputeId } , round #${ roundId } , choice ${ contribution . choice } and beneficiary ${ contribution . contributor . id } , skipping`
322322 ) ;
@@ -333,8 +333,8 @@ const withdrawAppealContribution = async (
333333 roundId ,
334334 contribution . choice
335335 ) ) *
336- toBigInt ( 150 ) ) /
337- toBigInt ( 100 ) ; // 50% extra gas
336+ 150n ) /
337+ 100n ; // 50% extra gas
338338 const tx = await (
339339 await kit . withdrawFeesAndRewards ( disputeId , contribution . contributor . id , roundId , contribution . choice , {
340340 gasLimit : gas ,
@@ -353,14 +353,14 @@ const executeDelayedStakes = async () => {
353353
354354 // delayedStakes = 1 + delayedStakeWriteIndex - delayedStakeReadIndex
355355 const delayedStakesRemaining =
356- toBigInt ( 1 ) + ( await sortition . delayedStakeWriteIndex ( ) ) - ( await sortition . delayedStakeReadIndex ( ) ) ;
356+ 1n + ( await sortition . delayedStakeWriteIndex ( ) ) - ( await sortition . delayedStakeReadIndex ( ) ) ;
357357
358358 const delayedStakes =
359359 delayedStakesRemaining < MAX_DELAYED_STAKES_ITERATIONS
360360 ? delayedStakesRemaining
361361 : toBigInt ( MAX_DELAYED_STAKES_ITERATIONS ) ;
362362
363- if ( delayedStakes === toBigInt ( 0 ) ) {
363+ if ( delayedStakes === 0n ) {
364364 logger . info ( "No delayed stakes to execute" ) ;
365365 return true ;
366366 }
@@ -373,7 +373,7 @@ const executeDelayedStakes = async () => {
373373 return success ;
374374 }
375375 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
377377 const tx = await ( await sortition . executeDelayedStakes ( delayedStakes , { gasLimit : gas } ) ) . wait ( ) ;
378378 logger . info ( `executeDelayedStakes txID: ${ tx ?. hash } ` ) ;
379379 } catch ( e ) {
@@ -389,7 +389,7 @@ const getMissingJurors = async (dispute: { id: string; currentRoundIndex: string
389389} ;
390390
391391const isDisputeFullyDrawn = async ( dispute : { id : string ; currentRoundIndex : string } ) : Promise < boolean > => {
392- return ( await getMissingJurors ( dispute ) ) === toBigInt ( 0 ) ;
392+ return ( await getMissingJurors ( dispute ) ) === 0n ;
393393} ;
394394
395395const getNumberOfMissingRepartitions = async (
@@ -398,7 +398,7 @@ const getNumberOfMissingRepartitions = async (
398398) => {
399399 const { core } = await getContracts ( ) ;
400400 const { repartitions, drawnJurors } = await core . getRoundInfo ( dispute . id , dispute . currentRoundIndex ) ;
401- return coherentCount === toBigInt ( 0 )
401+ return coherentCount === 0n
402402 ? drawnJurors . length - getNumber ( repartitions )
403403 : 2 * drawnJurors . length - getNumber ( repartitions ) ;
404404} ;
@@ -545,7 +545,7 @@ async function main() {
545545 await delay ( ITERATIONS_COOLDOWN_PERIOD ) ; // To avoid spiking the gas price
546546 maxDrawingTimePassed = await hasMaxDrawingTimePassed ( ) ;
547547 numberOfMissingJurors = await getMissingJurors ( dispute ) ;
548- } while ( ! ( numberOfMissingJurors === toBigInt ( 0 ) ) && ! maxDrawingTimePassed ) ;
548+ } while ( ! ( numberOfMissingJurors === 0n ) && ! maxDrawingTimePassed ) ;
549549 }
550550 // At this point, either all disputes are fully drawn or max drawing time has passed
551551 }
@@ -589,7 +589,7 @@ async function main() {
589589
590590 for ( var dispute of unprocessedDisputesInExecution ) {
591591 const { period } = await core . disputes ( dispute . id ) ;
592- if ( period !== toBigInt ( 4 ) ) {
592+ if ( period !== 4n ) {
593593 logger . info ( `Skipping dispute #${ dispute . id } because it is not in the execution period` ) ;
594594 continue ;
595595 }
@@ -642,7 +642,7 @@ async function main() {
642642 contributions = [ ...new Set ( contributions ) ] ;
643643 for ( let contribution of contributions ) {
644644 // 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 ) {
646646 await withdrawAppealContribution ( dispute . id , round . toString ( ) , contribution ) ;
647647 await delay ( ITERATIONS_COOLDOWN_PERIOD ) ; // To avoid spiking the gas price
648648 }
0 commit comments