@@ -94,14 +94,12 @@ contract ERC20PriceOracleReceiptVaultWithdrawTest is ERC20PriceOracleReceiptVaul
9494 assets = bound (assets, 2 , type (uint128 ).max);
9595 vm.assume (assets.fixedPointMul (oraclePrice, Math.Rounding.Down) > 0 );
9696
97- // Ensure Alice has enough balance and allowance
98- vm.mockCall (address (iAsset), abi.encodeWithSelector (IERC20 .balanceOf.selector , alice), abi.encode (assets));
99-
10097 vm.mockCall (
10198 address (iAsset),
10299 abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, vault, assets),
103100 abi.encode (true )
104101 );
102+ vm.expectCall (address (iAsset), abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, vault, assets));
105103
106104 vault.deposit (assets, alice, oraclePrice, bytes ("" ));
107105 uint256 withdrawAssets =
@@ -127,9 +125,6 @@ contract ERC20PriceOracleReceiptVaultWithdrawTest is ERC20PriceOracleReceiptVaul
127125 ERC20PriceOracleReceiptVault vault = createVault (iVaultOracle, assetName, assetName);
128126 ReceiptContract receipt = getReceipt ();
129127
130- // Ensure Alice has enough balance and allowance
131- vm.mockCall (address (iAsset), abi.encodeWithSelector (IERC20 .balanceOf.selector , alice), abi.encode (assets));
132-
133128 assets = bound (assets, 1 , type (uint128 ).max);
134129 vm.assume (assets.fixedPointMul (oraclePrice, Math.Rounding.Down) > 0 );
135130
@@ -138,6 +133,7 @@ contract ERC20PriceOracleReceiptVaultWithdrawTest is ERC20PriceOracleReceiptVaul
138133 abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, vault, assets),
139134 abi.encode (true )
140135 );
136+ vm.expectCall (address (iAsset), abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, vault, assets));
141137
142138 vault.deposit (assets, alice, oraclePrice, bytes ("" ));
143139
@@ -167,14 +163,12 @@ contract ERC20PriceOracleReceiptVaultWithdrawTest is ERC20PriceOracleReceiptVaul
167163 assets = bound (assets, 1 , type (uint128 ).max);
168164 vm.assume (assets.fixedPointMul (oraclePrice, Math.Rounding.Down) > 0 );
169165
170- // Ensure Alice has enough balance and allowance
171- vm.mockCall (address (iAsset), abi.encodeWithSelector (IERC20 .balanceOf.selector , alice), abi.encode (assets));
172-
173166 vm.mockCall (
174167 address (iAsset),
175168 abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, vault, assets),
176169 abi.encode (true )
177170 );
171+ vm.expectCall (address (iAsset), abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, vault, assets));
178172
179173 vault.deposit (assets, alice, oraclePrice, bytes ("" ));
180174 uint256 availableReceiptBalance = receipt.balanceOf (alice, oraclePrice);
@@ -209,9 +203,6 @@ contract ERC20PriceOracleReceiptVaultWithdrawTest is ERC20PriceOracleReceiptVaul
209203 ERC20PriceOracleReceiptVault vault = createVault (iVaultOracle, assetName, assetName);
210204 ReceiptContract receipt = getReceipt ();
211205
212- // Ensure Alice has enough balance and allowance
213- vm.mockCall (address (iAsset), abi.encodeWithSelector (IERC20 .balanceOf.selector , alice), abi.encode (assets));
214-
215206 assets = bound (assets, 1 , type (uint128 ).max);
216207 vm.assume (assets.fixedPointMul (oraclePrice, Math.Rounding.Down) > 0 );
217208
@@ -220,6 +211,7 @@ contract ERC20PriceOracleReceiptVaultWithdrawTest is ERC20PriceOracleReceiptVaul
220211 abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, vault, assets),
221212 abi.encode (true )
222213 );
214+ vm.expectCall (address (iAsset), abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, vault, assets));
223215
224216 vault.deposit (assets, alice, oraclePrice, bytes ("" ));
225217 uint256 availableReceiptBalance = receipt.balanceOf (alice, oraclePrice);
@@ -287,12 +279,12 @@ contract ERC20PriceOracleReceiptVaultWithdrawTest is ERC20PriceOracleReceiptVaul
287279
288280 vm.startPrank (alice);
289281
290- vm.mockCall (address (iAsset), abi.encodeWithSelector (IERC20 .balanceOf.selector , alice), abi.encode (aliceDeposit));
291282 vm.mockCall (
292283 address (iAsset),
293284 abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, vault, aliceDeposit),
294285 abi.encode (true )
295286 );
287+ vm.expectCall (address (iAsset), abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, vault, aliceDeposit));
296288
297289 vault.deposit (aliceDeposit, alice, alicePrice, bytes ("" ));
298290 vm.stopPrank ();
@@ -302,12 +294,12 @@ contract ERC20PriceOracleReceiptVaultWithdrawTest is ERC20PriceOracleReceiptVaul
302294
303295 vm.startPrank (bob);
304296
305- vm.mockCall (address (iAsset), abi.encodeWithSelector (IERC20 .balanceOf.selector , bob), abi.encode (bobDeposit));
306297 vm.mockCall (
307298 address (iAsset),
308299 abi.encodeWithSelector (IERC20 .transferFrom.selector , bob, vault, bobDeposit),
309300 abi.encode (true )
310301 );
302+ vm.expectCall (address (iAsset), abi.encodeWithSelector (IERC20 .transferFrom.selector , bob, vault, bobDeposit));
311303
312304 uint256 bobExpectedSharesAfterActions;
313305 {
@@ -345,12 +337,12 @@ contract ERC20PriceOracleReceiptVaultWithdrawTest is ERC20PriceOracleReceiptVaul
345337 setVaultOraclePrice (alicePrice);
346338
347339 vm.startPrank (bob);
348- vm.mockCall (address (iAsset), abi.encodeWithSelector (IERC20 .balanceOf.selector , bob), abi.encode (bobDeposit));
349340 vm.mockCall (
350341 address (iAsset),
351342 abi.encodeWithSelector (IERC20 .transferFrom.selector , bob, vault, bobDeposit),
352343 abi.encode (true )
353344 );
345+ vm.expectCall (address (iAsset), abi.encodeWithSelector (IERC20 .transferFrom.selector , bob, vault, bobDeposit));
354346
355347 uint256 bobSharesDeposit1 = vault.deposit (bobDeposit, bob, alicePrice, bytes ("" ));
356348 vm.stopPrank ();
@@ -415,9 +407,6 @@ contract ERC20PriceOracleReceiptVaultWithdrawTest is ERC20PriceOracleReceiptVaul
415407 ERC20PriceOracleReceiptVault vault = createVault (iVaultOracle, assetName, assetName);
416408 ReceiptContract receipt = getReceipt ();
417409
418- // Ensure Alice has enough balance and allowance
419- vm.mockCall (address (iAsset), abi.encodeWithSelector (IERC20 .balanceOf.selector , alice), abi.encode (assets));
420-
421410 assets = bound (assets, 1 , type (uint128 ).max - 1 );
422411 vm.assume (assets.fixedPointMul (oraclePrice, Math.Rounding.Down) > 0 );
423412
@@ -426,6 +415,7 @@ contract ERC20PriceOracleReceiptVaultWithdrawTest is ERC20PriceOracleReceiptVaul
426415 abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, vault, assets),
427416 abi.encode (true )
428417 );
418+ vm.expectCall (address (iAsset), abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, vault, assets));
429419
430420 vault.deposit (assets, alice, oraclePrice, bytes ("" ));
431421
@@ -485,12 +475,15 @@ contract ERC20PriceOracleReceiptVaultWithdrawTest is ERC20PriceOracleReceiptVaul
485475 setVaultOraclePrice (priceOne);
486476 vm.startPrank (alice);
487477
488- vm.mockCall (address (iAsset), abi.encodeWithSelector (IERC20 .balanceOf.selector , alice), abi.encode (aliceDeposit));
489478 vm.mockCall (
490479 address (iAsset),
491480 abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, address (vault), aliceDeposit / 2 ),
492481 abi.encode (true )
493482 );
483+ vm.expectCall (
484+ address (iAsset),
485+ abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, address (vault), aliceDeposit / 2 )
486+ );
494487
495488 vault.deposit (aliceDeposit / 2 , alice, priceOne, bytes ("" ));
496489 vm.stopPrank ();
@@ -508,6 +501,10 @@ contract ERC20PriceOracleReceiptVaultWithdrawTest is ERC20PriceOracleReceiptVaul
508501 abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, address (vault), aliceDeposit / 2 ),
509502 abi.encode (true )
510503 );
504+ vm.expectCall (
505+ address (iAsset),
506+ abi.encodeWithSelector (IERC20 .transferFrom.selector , alice, address (vault), aliceDeposit / 2 )
507+ );
511508
512509 vault.deposit (aliceDeposit / 2 , alice, priceTwo, bytes ("" ));
513510 vm.stopPrank ();
0 commit comments