Skip to content

Commit

Permalink
fix: apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Grimal committed Sep 14, 2023
1 parent 95344b4 commit d78c6c7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/forge/EVMBundlerLocalTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -196,44 +196,44 @@ contract EVMBundlerLocalTest is LocalTest {
bundler.multicall(block.timestamp, redeemData);
}

function testMintVault(uint256 shares, address onBehalf) public {
vm.assume(onBehalf != address(0));
function testMintVault(uint256 shares, address owner) public {
vm.assume(owner != address(0));
shares = bound(shares, MIN_AMOUNT, MAX_AMOUNT);

uint256 expectedAmount = vault.previewMint(shares);
vm.assume(expectedAmount != 0);

bytes[] memory data = new bytes[](2);
data[0] = abi.encodeCall(Permit2Bundler.transferFrom2, (address(borrowableToken), expectedAmount));
data[1] = abi.encodeCall(ERC4626Bundler.mint, (address(vault), shares, onBehalf));
data[1] = abi.encodeCall(ERC4626Bundler.mint, (address(vault), shares, owner));

borrowableToken.setBalance(USER, expectedAmount);
vm.prank(USER);
bundler.multicall(block.timestamp, data);

assertEq(borrowableToken.balanceOf(address(vault)), expectedAmount, "vault's balance");
assertEq(borrowableToken.balanceOf(address(bundler)), 0, "bundler's balance");
assertEq(vault.balanceOf(onBehalf), shares, "onBehalf's shares");
assertEq(vault.balanceOf(owner), shares, "owner's shares");
}

function testDepositVault(uint256 amount, address onBehalf) public {
vm.assume(onBehalf != address(0));
function testDepositVault(uint256 amount, address owner) public {
vm.assume(owner != address(0));
amount = bound(amount, MIN_AMOUNT, MAX_AMOUNT);

uint256 expectedShares = vault.previewDeposit(amount);
vm.assume(expectedShares != 0);

bytes[] memory data = new bytes[](2);
data[0] = abi.encodeCall(Permit2Bundler.transferFrom2, (address(borrowableToken), amount));
data[1] = abi.encodeCall(ERC4626Bundler.deposit, (address(vault), amount, onBehalf));
data[1] = abi.encodeCall(ERC4626Bundler.deposit, (address(vault), amount, owner));

borrowableToken.setBalance(USER, amount);
vm.prank(USER);
bundler.multicall(block.timestamp, data);

assertEq(borrowableToken.balanceOf(address(vault)), amount, "vault's balance");
assertEq(borrowableToken.balanceOf(address(bundler)), 0, "bundler's balance");
assertEq(vault.balanceOf(onBehalf), expectedShares, "onBehalf's shares");
assertEq(vault.balanceOf(owner), expectedShares, "owner's shares");
}

function testWithdrawVault(uint256 depositedAmount, uint256 withdrawnAmount) public {
Expand Down

0 comments on commit d78c6c7

Please sign in to comment.