@@ -183,7 +183,7 @@ describe("Staking", async () => {
183
183
await pnk . connect ( juror ) . approve ( core . target , PNK ( 1000 ) ) ;
184
184
await expect ( await core . connect ( juror ) . setStake ( 1 , PNK ( 1000 ) ) )
185
185
. to . emit ( sortition , "StakeSet" )
186
- . withArgs ( juror . address , 1 , PNK ( 1000 ) ) ;
186
+ . withArgs ( juror . address , 1 , PNK ( 1000 ) , PNK ( 1000 ) ) ;
187
187
expect ( await sortition . totalStaked ( ) ) . to . be . equal ( PNK ( 1000 ) ) ;
188
188
} ) ;
189
189
} ) ;
@@ -201,17 +201,17 @@ describe("Staking", async () => {
201
201
it ( "Should be able to unstake" , async ( ) => {
202
202
expect ( await core . connect ( juror ) . setStake ( 1 , PNK ( 500 ) ) )
203
203
. to . emit ( sortition , "StakeSet" )
204
- . withArgs ( juror . address , 1 , PNK ( 500 ) ) ;
204
+ . withArgs ( juror . address , 1 , PNK ( 500 ) , PNK ( 500 ) ) ;
205
205
expect ( await sortition . totalStaked ( ) ) . to . be . equal ( PNK ( 500 ) ) ;
206
206
207
207
expect ( await core . connect ( juror ) . setStake ( 1 , PNK ( 1001 ) ) )
208
208
. to . emit ( sortition , "StakeSet" )
209
- . withArgs ( juror . address , 1 , PNK ( 1001 ) ) ;
209
+ . withArgs ( juror . address , 1 , PNK ( 1001 ) , PNK ( 1001 ) ) ;
210
210
expect ( await sortition . totalStaked ( ) ) . to . be . equal ( PNK ( 1001 ) ) ;
211
211
212
212
expect ( await core . connect ( juror ) . setStake ( 1 , PNK ( 0 ) ) )
213
213
. to . emit ( sortition , "StakeSet" )
214
- . withArgs ( juror . address , 1 , PNK ( 0 ) ) ;
214
+ . withArgs ( juror . address , 1 , PNK ( 0 ) , PNK ( 0 ) ) ;
215
215
expect ( await sortition . totalStaked ( ) ) . to . be . equal ( PNK ( 0 ) ) ;
216
216
} ) ;
217
217
} ) ;
@@ -230,7 +230,7 @@ describe("Staking", async () => {
230
230
await drawAndReachStakingPhaseFromGenerating ( ) ;
231
231
expect ( await sortition . executeDelayedStakes ( 10 ) )
232
232
. to . emit ( sortition , "StakeSet" )
233
- . withArgs ( juror . address , 1 , PNK ( 0 ) ) ;
233
+ . withArgs ( juror . address , 1 , PNK ( 0 ) , PNK ( 0 ) ) ;
234
234
} ) ;
235
235
} ) ;
236
236
} ) ;
@@ -272,14 +272,14 @@ describe("Staking", async () => {
272
272
await core . connect ( juror ) . setStake ( 1 , PNK ( 1000 ) ) ;
273
273
await createDisputeAndReachGeneratingPhaseFromStaking ( ) ;
274
274
expect ( await core . connect ( juror ) . setStake ( 1 , PNK ( 2000 ) ) )
275
- . to . emit ( sortition , "StakeDelayedAlreadyTransferred " )
275
+ . to . emit ( sortition , "StakeDelayedAlreadyTransferredDeposited " )
276
276
. withArgs ( juror . address , 1 , PNK ( 2000 ) )
277
277
. to . not . emit ( sortition , "StakeSet" ) ;
278
278
expect ( await sortition . totalStaked ( ) ) . to . be . equal ( PNK ( 1000 ) ) ;
279
279
await drawAndReachStakingPhaseFromGenerating ( ) ;
280
280
expect ( await sortition . executeDelayedStakes ( 10 ) )
281
281
. to . emit ( sortition , "StakeSet" )
282
- . withArgs ( juror . address , 1 , PNK ( 2000 ) ) ;
282
+ . withArgs ( juror . address , 1 , PNK ( 2000 ) , PNK ( 2000 ) ) ;
283
283
expect ( await sortition . totalStaked ( ) ) . to . be . equal ( PNK ( 2000 ) ) ;
284
284
} ) ;
285
285
} ) ;
@@ -309,7 +309,7 @@ describe("Staking", async () => {
309
309
await pnk . connect ( juror ) . approve ( core . target , PNK ( 1000 ) ) ;
310
310
await expect ( await core . connect ( juror ) . setStake ( 1 , PNK ( 1000 ) ) )
311
311
. to . emit ( sortition , "StakeSet" )
312
- . withArgs ( juror . address , 1 , PNK ( 1000 ) ) ;
312
+ . withArgs ( juror . address , 1 , PNK ( 1000 ) , PNK ( 1000 ) ) ;
313
313
expect ( await sortition . totalStaked ( ) ) . to . be . equal ( PNK ( 3000 ) ) ;
314
314
} ) ;
315
315
} ) ;
@@ -334,13 +334,13 @@ describe("Staking", async () => {
334
334
it ( "Should be able to stake exactly maxTotalStaked" , async ( ) => {
335
335
await pnk . connect ( juror ) . approve ( core . target , PNK ( 1000 ) ) ;
336
336
await expect ( await core . connect ( juror ) . setStake ( 1 , PNK ( 1000 ) ) )
337
- . to . emit ( sortition , "StakeDelayedAlreadyTransferred " )
337
+ . to . emit ( sortition , "StakeDelayedAlreadyTransferredDeposited " )
338
338
. withArgs ( juror . address , 1 , PNK ( 1000 ) ) ;
339
339
expect ( await sortition . totalStaked ( ) ) . to . be . equal ( PNK ( 2000 ) ) ; // Not updated until the delayed stake is executed
340
340
await drawAndReachStakingPhaseFromGenerating ( ) ;
341
341
await expect ( await sortition . executeDelayedStakes ( 10 ) )
342
342
. to . emit ( sortition , "StakeSet" )
343
- . withArgs ( juror . address , 1 , PNK ( 1000 ) ) ;
343
+ . withArgs ( juror . address , 1 , PNK ( 1000 ) , PNK ( 1000 ) ) ;
344
344
expect ( await sortition . totalStaked ( ) ) . to . be . equal ( PNK ( 3000 ) ) ;
345
345
} ) ;
346
346
} ) ;
@@ -430,7 +430,7 @@ describe("Staking", async () => {
430
430
await pnk . approve ( core . target , PNK ( 1000 ) ) ;
431
431
expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ;
432
432
await expect ( core . setStake ( 2 , PNK ( 3000 ) ) )
433
- . to . emit ( sortition , "StakeDelayedAlreadyTransferred " )
433
+ . to . emit ( sortition , "StakeDelayedAlreadyTransferredDeposited " )
434
434
. withArgs ( deployer , 2 , PNK ( 3000 ) ) ;
435
435
expect ( await sortition . getJurorBalance ( deployer , 2 ) ) . to . be . deep . equal ( [ PNK ( 5000 ) , 0 , PNK ( 2000 ) , 2 ] ) ; // stake does not change
436
436
} ) ;
@@ -456,9 +456,9 @@ describe("Staking", async () => {
456
456
it ( "Should execute the delayed stakes" , async ( ) => {
457
457
await expect ( await sortition . executeDelayedStakes ( 10 ) )
458
458
. to . emit ( sortition , "StakeSet" )
459
- . withArgs ( deployer , 2 , PNK ( 3000 ) )
459
+ . withArgs ( deployer , 2 , PNK ( 3000 ) , PNK ( 5000 ) )
460
460
. to . not . emit ( sortition , "StakeDelayedNotTransferred" )
461
- . to . not . emit ( sortition , "StakeDelayedAlreadyTransferred " )
461
+ . to . not . emit ( sortition , "StakeDelayedAlreadyTransferredDeposited " )
462
462
. to . not . emit ( sortition , "StakeDelayedAlreadyTransferredWithdrawn" ) ;
463
463
expect ( await sortition . getJurorBalance ( deployer , 2 ) ) . to . be . deep . equal ( [
464
464
PNK ( 5000 ) ,
@@ -524,7 +524,7 @@ describe("Staking", async () => {
524
524
it ( "Should execute the delayed stakes by withdrawing PNK and reducing the stakes" , async ( ) => {
525
525
await expect ( await sortition . executeDelayedStakes ( 10 ) )
526
526
. to . emit ( sortition , "StakeSet" )
527
- . withArgs ( deployer , 2 , PNK ( 1000 ) ) ;
527
+ . withArgs ( deployer , 2 , PNK ( 1000 ) , PNK ( 3000 ) ) ;
528
528
expect ( await sortition . getJurorBalance ( deployer , 2 ) ) . to . be . deep . equal ( [
529
529
PNK ( 3000 ) ,
530
530
PNK ( 300 ) , // we're the only juror so we are drawn 3 times
@@ -613,7 +613,7 @@ describe("Staking", async () => {
613
613
it ( "Should execute the delayed stakes but the stakes should remain the same" , async ( ) => {
614
614
await expect ( await sortition . executeDelayedStakes ( 10 ) )
615
615
. to . emit ( sortition , "StakeSet" )
616
- . withArgs ( deployer , 2 , PNK ( 2000 ) ) ;
616
+ . withArgs ( deployer , 2 , PNK ( 2000 ) , PNK ( 4000 ) ) ;
617
617
expect ( await sortition . getJurorBalance ( deployer , 2 ) ) . to . be . deep . equal ( [
618
618
PNK ( 4000 ) ,
619
619
PNK ( 300 ) , // we're the only juror so we are drawn 3 times
@@ -653,7 +653,7 @@ describe("Staking", async () => {
653
653
await pnk . approve ( core . target , PNK ( 1000 ) ) ;
654
654
expect ( await sortition . latestDelayedStakeIndex ( deployer , 2 ) ) . to . be . equal ( 0 ) ;
655
655
await expect ( core . setStake ( 2 , PNK ( 3000 ) ) )
656
- . to . emit ( sortition , "StakeDelayedAlreadyTransferred " )
656
+ . to . emit ( sortition , "StakeDelayedAlreadyTransferredDeposited " )
657
657
. withArgs ( deployer , 2 , PNK ( 3000 ) ) ;
658
658
expect ( await sortition . getJurorBalance ( deployer , 2 ) ) . to . be . deep . equal ( [ PNK ( 5000 ) , 0 , PNK ( 2000 ) , 2 ] ) ; // stake does not change
659
659
} ) ;
@@ -704,9 +704,9 @@ describe("Staking", async () => {
704
704
it ( "Should execute the delayed stakes but the stakes should remain the same" , async ( ) => {
705
705
await expect ( sortition . executeDelayedStakes ( 10 ) )
706
706
. to . emit ( await sortition , "StakeSet" )
707
- . withArgs ( deployer , 2 , PNK ( 2000 ) )
707
+ . withArgs ( deployer , 2 , PNK ( 2000 ) , PNK ( 4000 ) )
708
708
. to . not . emit ( sortition , "StakeDelayedNotTransferred" )
709
- . to . not . emit ( sortition , "StakeDelayedAlreadyTransferred " )
709
+ . to . not . emit ( sortition , "StakeDelayedAlreadyTransferredDeposited " )
710
710
. to . not . emit ( sortition , "StakeDelayedAlreadyTransferredWithdrawn" ) ;
711
711
expect ( await sortition . getJurorBalance ( deployer , 2 ) ) . to . be . deep . equal ( [
712
712
PNK ( 4000 ) ,
0 commit comments