@@ -76,7 +76,9 @@ describe("stake", function () {
7676 roles . user1 . address ,
7777 user1Stake . div ( 2 ) ,
7878 user1Stake . div ( 2 ) ,
79+ 0 ,
7980 user1Stake ,
81+ user1Stake . add ( 1 ) ,
8082 user1Stake . add ( 1 )
8183 ) ;
8284 expect ( await api3Pool . userStake ( roles . user1 . address ) ) . to . equal (
@@ -111,7 +113,9 @@ describe("stake", function () {
111113 roles . user1 . address ,
112114 user1Stake ,
113115 user1Stake ,
116+ 0 ,
114117 user1Stake ,
118+ user1Stake . add ( 1 ) ,
115119 user1Stake . add ( 1 )
116120 ) ;
117121 expect ( await api3Pool . userStake ( roles . user1 . address ) ) . to . equal (
@@ -147,7 +151,9 @@ describe("depositAndStake", function () {
147151 roles . user1 . address ,
148152 user1Stake ,
149153 user1Stake ,
154+ 0 ,
150155 user1Stake ,
156+ user1Stake . add ( 1 ) ,
151157 user1Stake . add ( 1 )
152158 ) ;
153159 } ) ;
@@ -334,11 +340,18 @@ describe("unstake", function () {
334340 ] ) ;
335341 // Unstake
336342 await api3Pool . mintReward ( ) ;
343+ const totalStake = await api3Pool . totalStake ( ) ;
337344 await expect (
338345 api3Pool . connect ( roles . randomPerson ) . unstake ( roles . user1 . address )
339346 )
340347 . to . emit ( api3Pool , "Unstaked" )
341- . withArgs ( roles . user1 . address , user1Stake , 1 ) ;
348+ . withArgs (
349+ roles . user1 . address ,
350+ user1Stake ,
351+ user1Stake ,
352+ 1 ,
353+ totalStake . sub ( user1Stake )
354+ ) ;
342355 const user = await api3Pool . users ( roles . user1 . address ) ;
343356 expect ( user . unstaked ) . to . equal ( user1Stake ) ;
344357 } ) ;
@@ -395,14 +408,17 @@ describe("unstake", function () {
395408 const actualUnstakeAmount = unstakeShares
396409 . mul ( await api3Pool . totalStake ( ) )
397410 . div ( await api3Pool . totalShares ( ) ) ;
411+ const totalStake = await api3Pool . totalStake ( ) ;
398412 await expect (
399413 api3Pool . connect ( roles . randomPerson ) . unstake ( roles . user1 . address )
400414 )
401415 . to . emit ( api3Pool , "Unstaked" )
402416 . withArgs (
403417 roles . user1 . address ,
404418 actualUnstakeAmount ,
405- user1Stake . div ( 2 ) . add ( 1 )
419+ actualUnstakeAmount ,
420+ user1Stake . div ( 2 ) . add ( 1 ) ,
421+ totalStake . sub ( actualUnstakeAmount )
406422 ) ;
407423 } ) ;
408424 } ) ;
0 commit comments