@@ -469,7 +469,6 @@ describe("Staking", async () => {
469469 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 0 ) ;
470470 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
471471 await pnk . approve ( core . target , PNK ( 1000 ) ) ;
472- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
473472 await expect ( core . setStake ( 2 , PNK ( 3000 ) ) )
474473 . to . emit ( sortition , "StakeDelayed" )
475474 . withArgs ( deployer , 2 , PNK ( 3000 ) ) ;
@@ -481,10 +480,9 @@ describe("Staking", async () => {
481480 } ) ;
482481
483482 it ( "Should store the delayed stake for later" , async ( ) => {
484- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
485483 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 1 ) ;
486484 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
487- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 3000 ) , false ] ) ;
485+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 3000 ) ] ) ;
488486 } ) ;
489487 } ) ;
490488
@@ -507,9 +505,8 @@ describe("Staking", async () => {
507505 ] ) ; // stake unchanged, delayed
508506 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 1 ) ;
509507 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 2 ) ;
510- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 1st delayed stake got deleted
511- expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 2nd delayed stake got deleted
512- expect ( await sortition . latestDelayedStakeIndex ( deployer , 1 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
508+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 1st delayed stake got deleted
509+ expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 2nd delayed stake got deleted
513510 } ) ;
514511
515512 it ( "Should transfer PNK after delayed stake execution" , async ( ) => {
@@ -535,7 +532,6 @@ describe("Staking", async () => {
535532 it ( "Should delay the stake decrease" , async ( ) => {
536533 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 0 ) ;
537534 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
538- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
539535 await expect ( core . setStake ( 2 , PNK ( 1000 ) ) )
540536 . to . emit ( sortition , "StakeDelayed" )
541537 . withArgs ( deployer , 2 , PNK ( 1000 ) ) ;
@@ -547,10 +543,9 @@ describe("Staking", async () => {
547543 } ) ;
548544
549545 it ( "Should store the delayed stake for later" , async ( ) => {
550- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
551546 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 1 ) ;
552547 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
553- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 1000 ) , false ] ) ;
548+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 1000 ) ] ) ;
554549 } ) ;
555550 } ) ;
556551
@@ -572,9 +567,8 @@ describe("Staking", async () => {
572567 ] ) ; // stake unchanged, delayed
573568 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 1 ) ;
574569 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 2 ) ;
575- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 1st delayed stake got deleted
576- expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 2nd delayed stake got deleted
577- expect ( await sortition . latestDelayedStakeIndex ( deployer , 1 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
570+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 1st delayed stake got deleted
571+ expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 2nd delayed stake got deleted
578572 } ) ;
579573
580574 it ( "Should withdraw some PNK" , async ( ) => {
@@ -600,7 +594,6 @@ describe("Staking", async () => {
600594 it ( "Should delay the stake decrease" , async ( ) => {
601595 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 0 ) ;
602596 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
603- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
604597 await expect ( core . setStake ( 2 , PNK ( 1000 ) ) )
605598 . to . emit ( sortition , "StakeDelayed" )
606599 . withArgs ( deployer , 2 , PNK ( 1000 ) ) ;
@@ -612,17 +605,15 @@ describe("Staking", async () => {
612605 } ) ;
613606
614607 it ( "Should store the delayed stake for later" , async ( ) => {
615- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
616608 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 1 ) ;
617609 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
618- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 1000 ) , false ] ) ;
610+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 1000 ) ] ) ;
619611 } ) ;
620612 } ) ;
621613
622614 describe ( "When stake is increased back to the previous amount" , ( ) => {
623615 it ( "Should delay the stake increase" , async ( ) => {
624616 balanceBefore = await pnk . balanceOf ( deployer ) ;
625- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
626617 await expect ( core . setStake ( 2 , PNK ( 2000 ) ) )
627618 . to . emit ( sortition , "StakeDelayed" )
628619 . withArgs ( deployer , 2 , PNK ( 2000 ) ) ;
@@ -634,11 +625,10 @@ describe("Staking", async () => {
634625 } ) ;
635626
636627 it ( "Should store the delayed stake for later" , async ( ) => {
637- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
638628 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 2 ) ;
639629 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
640- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 1000 ) , false ] ) ;
641- expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 2000 ) , false ] ) ;
630+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 1000 ) ] ) ;
631+ expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 2000 ) ] ) ;
642632 } ) ;
643633 } ) ;
644634
@@ -663,9 +653,8 @@ describe("Staking", async () => {
663653 ] ) ; // stake unchanged, delayed
664654 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 2 ) ;
665655 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 3 ) ;
666- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 1st delayed stake got deleted
667- expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 2nd delayed stake got deleted
668- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
656+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 1st delayed stake got deleted
657+ expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 2nd delayed stake got deleted
669658 } ) ;
670659
671660 it ( "Should not transfer any PNK" , async ( ) => {
@@ -692,7 +681,6 @@ describe("Staking", async () => {
692681 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 0 ) ;
693682 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
694683 await pnk . approve ( core . target , PNK ( 1000 ) ) ;
695- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
696684 await expect ( core . setStake ( 2 , PNK ( 3000 ) ) )
697685 . to . emit ( sortition , "StakeDelayed" )
698686 . withArgs ( deployer , 2 , PNK ( 3000 ) ) ;
@@ -704,17 +692,15 @@ describe("Staking", async () => {
704692 } ) ;
705693
706694 it ( "Should store the delayed stake for later" , async ( ) => {
707- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
708695 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 1 ) ;
709696 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
710- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 3000 ) , false ] ) ;
697+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 3000 ) ] ) ;
711698 } ) ;
712699 } ) ;
713700
714701 describe ( "When stake is decreased back to the previous amount" , ( ) => {
715702 it ( "Should cancel out the stake decrease back" , async ( ) => {
716703 balanceBefore = await pnk . balanceOf ( deployer ) ;
717- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
718704 await expect ( core . setStake ( 2 , PNK ( 2000 ) ) )
719705 . to . emit ( sortition , "StakeDelayed" )
720706 . withArgs ( deployer , 2 , PNK ( 2000 ) ) ;
@@ -726,11 +712,10 @@ describe("Staking", async () => {
726712 } ) ;
727713
728714 it ( "Should store the delayed stake for later" , async ( ) => {
729- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
730715 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 2 ) ;
731716 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 1 ) ;
732- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 3000 ) , false ] ) ;
733- expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 2000 ) , false ] ) ;
717+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 3000 ) ] ) ;
718+ expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ deployer , 2 , PNK ( 2000 ) ] ) ;
734719 } ) ;
735720 } ) ;
736721
@@ -753,9 +738,8 @@ describe("Staking", async () => {
753738 ] ) ; // stake unchanged, delayed
754739 expect ( await sortition . delayedStakeWriteIndex ( ) ) . to . be . equal ( 2 ) ;
755740 expect ( await sortition . delayedStakeReadIndex ( ) ) . to . be . equal ( 3 ) ;
756- expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 1st delayed stake got deleted
757- expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 , false ] ) ; // the 2nd delayed stake got deleted
758- expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ; // Deprecated. Always 0
741+ expect ( await sortition . delayedStakes ( 1 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 1st delayed stake got deleted
742+ expect ( await sortition . delayedStakes ( 2 ) ) . to . be . deep . equal ( [ ethers . ZeroAddress , 0 , 0 ] ) ; // the 2nd delayed stake got deleted
759743 } ) ;
760744
761745 it ( "Should not transfer any PNK" , async ( ) => {
0 commit comments