@@ -431,7 +431,6 @@ describe("Staking", async () => {
431431 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 0 ) ;
432432 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
433433 await pnk . approve ( core . target , PNK ( 1000 ) ) ;
434- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
435434 await expect ( core . setStake ( 2 , PNK ( 3000 ) ) )
436435 . to . emit ( sortition , "StakeDelayed" )
437436 . withArgs ( deployer , 2 , PNK ( 3000 ) ) ;
@@ -443,10 +442,9 @@ describe("Staking", async () => {
443442 } ) ;
444443
445444 it ( "Should store the delayed stake for later" , async ( ) => {
446- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
447445 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 1 ) ;
448446 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
449- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 3000 ) , false ] ) ;
447+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 3000 ) ] ) ;
450448 } ) ;
451449 } ) ;
452450
@@ -469,9 +467,8 @@ describe("Staking", async () => {
469467 ] ) ; // stake unchanged, delayed
470468 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 1 ) ;
471469 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 2 ) ;
472- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 1st delayed stake got deleted
473- expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 2nd delayed stake got deleted
474- expect ( await sortition . latestDelayedStakeIndex ( deployer , 1 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
470+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 1st delayed stake got deleted
471+ expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 2nd delayed stake got deleted
475472 } ) ;
476473
477474 it ( "Should transfer PNK after delayed stake execution" , async ( ) => {
@@ -497,7 +494,6 @@ describe("Staking", async () => {
497494 it ( "Should delay the stake decrease" , async ( ) => {
498495 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 0 ) ;
499496 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
500- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
501497 await expect ( core . setStake ( 2 , PNK ( 1000 ) ) )
502498 . to . emit ( sortition , "StakeDelayed" )
503499 . withArgs ( deployer , 2 , PNK ( 1000 ) ) ;
@@ -509,10 +505,9 @@ describe("Staking", async () => {
509505 } ) ;
510506
511507 it ( "Should store the delayed stake for later" , async ( ) => {
512- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
513508 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 1 ) ;
514509 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
515- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 1000 ) , false ] ) ;
510+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 1000 ) ] ) ;
516511 } ) ;
517512 } ) ;
518513
@@ -534,9 +529,8 @@ describe("Staking", async () => {
534529 ] ) ; // stake unchanged, delayed
535530 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 1 ) ;
536531 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 2 ) ;
537- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 1st delayed stake got deleted
538- expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 2nd delayed stake got deleted
539- expect ( await sortition . latestDelayedStakeIndex ( deployer , 1 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
532+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 1st delayed stake got deleted
533+ expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 2nd delayed stake got deleted
540534 } ) ;
541535
542536 it ( "Should withdraw some PNK" , async ( ) => {
@@ -562,7 +556,6 @@ describe("Staking", async () => {
562556 it ( "Should delay the stake decrease" , async ( ) => {
563557 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 0 ) ;
564558 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
565- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
566559 await expect ( core . setStake ( 2 , PNK ( 1000 ) ) )
567560 . to . emit ( sortition , "StakeDelayed" )
568561 . withArgs ( deployer , 2 , PNK ( 1000 ) ) ;
@@ -574,17 +567,15 @@ describe("Staking", async () => {
574567 } ) ;
575568
576569 it ( "Should store the delayed stake for later" , async ( ) => {
577- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
578570 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 1 ) ;
579571 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
580- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 1000 ) , false ] ) ;
572+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 1000 ) ] ) ;
581573 } ) ;
582574 } ) ;
583575
584576 describe ( "When stake is increased back to the previous amount" , ( ) => {
585577 it ( "Should delay the stake increase" , async ( ) => {
586578 balanceBefore = await pnk . balanceOf ( deployer ) ;
587- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
588579 await expect ( core . setStake ( 2 , PNK ( 2000 ) ) )
589580 . to . emit ( sortition , "StakeDelayed" )
590581 . withArgs ( deployer , 2 , PNK ( 2000 ) ) ;
@@ -596,11 +587,10 @@ describe("Staking", async () => {
596587 } ) ;
597588
598589 it ( "Should store the delayed stake for later" , async ( ) => {
599- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
600590 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 2 ) ;
601591 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
602- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 1000 ) , false ] ) ;
603- expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 2000 ) , false ] ) ;
592+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 1000 ) ] ) ;
593+ expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 2000 ) ] ) ;
604594 } ) ;
605595 } ) ;
606596
@@ -625,9 +615,8 @@ describe("Staking", async () => {
625615 ] ) ; // stake unchanged, delayed
626616 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 2 ) ;
627617 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 3 ) ;
628- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 1st delayed stake got deleted
629- expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 2nd delayed stake got deleted
630- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
618+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 1st delayed stake got deleted
619+ expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 2nd delayed stake got deleted
631620 } ) ;
632621
633622 it ( "Should not transfer any PNK" , async ( ) => {
@@ -654,7 +643,6 @@ describe("Staking", async () => {
654643 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 0 ) ;
655644 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
656645 await pnk . approve ( core . target , PNK ( 1000 ) ) ;
657- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
658646 await expect ( core . setStake ( 2 , PNK ( 3000 ) ) )
659647 . to . emit ( sortition , "StakeDelayed" )
660648 . withArgs ( deployer , 2 , PNK ( 3000 ) ) ;
@@ -666,17 +654,15 @@ describe("Staking", async () => {
666654 } ) ;
667655
668656 it ( "Should store the delayed stake for later" , async ( ) => {
669- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
670657 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 1 ) ;
671658 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
672- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 3000 ) , false ] ) ;
659+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 3000 ) ] ) ;
673660 } ) ;
674661 } ) ;
675662
676663 describe ( "When stake is decreased back to the previous amount" , ( ) => {
677664 it ( "Should cancel out the stake decrease back" , async ( ) => {
678665 balanceBefore = await pnk . balanceOf ( deployer ) ;
679- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
680666 await expect ( core . setStake ( 2 , PNK ( 2000 ) ) )
681667 . to . emit ( sortition , "StakeDelayed" )
682668 . withArgs ( deployer , 2 , PNK ( 2000 ) ) ;
@@ -688,11 +674,10 @@ describe("Staking", async () => {
688674 } ) ;
689675
690676 it ( "Should store the delayed stake for later" , async ( ) => {
691- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
692677 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 2 ) ;
693678 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
694- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 3000 ) , false ] ) ;
695- expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 2000 ) , false ] ) ;
679+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 3000 ) ] ) ;
680+ expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 2000 ) ] ) ;
696681 } ) ;
697682 } ) ;
698683
@@ -715,9 +700,8 @@ describe("Staking", async () => {
715700 ] ) ; // stake unchanged, delayed
716701 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 2 ) ;
717702 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 3 ) ;
718- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 1st delayed stake got deleted
719- expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 2nd delayed stake got deleted
720- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
703+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 1st delayed stake got deleted
704+ expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 2nd delayed stake got deleted
721705 } ) ;
722706
723707 it ( "Should not transfer any PNK" , async ( ) => {
0 commit comments