@@ -135,23 +135,29 @@ function shouldBehaveLikePaymaster({ postOp } = { postOp: false }) {
135135
136136 describe ( 'postOp' , function ( ) {
137137 it ( 'reverts if the caller is not the entrypoint' , async function ( ) {
138- await expect ( this . paymaster . connect ( this . other ) . postOp ( 0 , '0x' , 0 , 0 ) )
138+ await expect ( this . paymaster . connect ( this . other ) . postOp ( 0n , '0x' , 0n , 0n ) )
139139 . to . be . revertedWithCustomError ( this . paymaster , 'PaymasterUnauthorized' )
140140 . withArgs ( this . other ) ;
141141 } ) ;
142142 } ) ;
143143
144144 describe ( 'deposit lifecycle' , function ( ) {
145145 it ( 'deposits and withdraws effectively' , async function ( ) {
146+ await expect ( entrypoint . balanceOf ( this . paymaster ) ) . to . eventually . equal ( 0n ) ;
147+
146148 await expect ( this . paymaster . connect ( this . other ) . deposit ( { value } ) ) . to . changeEtherBalances (
147149 [ this . other , entrypoint ] ,
148150 [ - value , value ] ,
149151 ) ;
150152
151- await expect ( this . paymaster . connect ( this . admin ) . withdraw ( this . receiver , value ) ) . to . changeEtherBalances (
153+ await expect ( entrypoint . balanceOf ( this . paymaster ) ) . to . eventually . equal ( value ) ;
154+
155+ await expect ( this . paymaster . connect ( this . admin ) . withdraw ( this . receiver , 1n ) ) . to . changeEtherBalances (
152156 [ entrypoint , this . receiver ] ,
153- [ - value , value ] ,
157+ [ - 1n , 1n ] ,
154158 ) ;
159+
160+ await expect ( entrypoint . balanceOf ( this . paymaster ) ) . to . eventually . equal ( value - 1n ) ;
155161 } ) ;
156162
157163 it ( 'reverts when an unauthorized caller tries to withdraw' , async function ( ) {
@@ -163,20 +169,37 @@ function shouldBehaveLikePaymaster({ postOp } = { postOp: false }) {
163169
164170 describe ( 'stake lifecycle' , function ( ) {
165171 it ( 'adds and removes stake effectively' , async function ( ) {
172+ await expect ( entrypoint . deposits ( this . paymaster ) ) . to . eventually . deep . equal ( [ 0n , false , 0n , 0n , 0n ] ) ;
173+
166174 // stake
167175 await expect ( this . paymaster . connect ( this . other ) . addStake ( delay , { value } ) ) . to . changeEtherBalances (
168176 [ this . other , entrypoint ] ,
169177 [ - value , value ] ,
170178 ) ;
179+
180+ await expect ( entrypoint . deposits ( this . paymaster ) ) . to . eventually . deep . equal ( [ 0n , true , 42n , delay , 0n ] ) ;
181+
171182 // unlock
172- await this . paymaster . connect ( this . admin ) . unlockStake ( ) ;
183+ const unlockTx = this . paymaster . connect ( this . admin ) . unlockStake ( ) ;
184+
185+ const timestamp = await time . clockFromReceipt . timestamp ( unlockTx ) ;
186+ await expect ( entrypoint . deposits ( this . paymaster ) ) . to . eventually . deep . equal ( [
187+ 0n ,
188+ false ,
189+ 42n ,
190+ delay ,
191+ timestamp + delay ,
192+ ] ) ;
193+
173194 await time . increaseBy . timestamp ( delay ) ;
174195
175196 // withdraw stake
176197 await expect ( this . paymaster . connect ( this . admin ) . withdrawStake ( this . receiver ) ) . to . changeEtherBalances (
177198 [ entrypoint , this . receiver ] ,
178199 [ - value , value ] ,
179200 ) ;
201+
202+ await expect ( entrypoint . deposits ( this . paymaster ) ) . to . eventually . deep . equal ( [ 0n , false , 0n , 0n , 0n ] ) ;
180203 } ) ;
181204
182205 it ( 'reverts when an unauthorized caller tries to unlock stake' , async function ( ) {
0 commit comments