From 57729a2abd9a126b143d25016e77cfd197298140 Mon Sep 17 00:00:00 2001 From: xhad Date: Tue, 22 Oct 2024 23:41:40 +0800 Subject: [PATCH] forge fmt --- src/Vault.sol | 9 ++++----- test/helpers/Etches.sol | 2 -- test/unit/admin.t.sol | 6 +++--- test/unit/deposit.t.sol | 6 +----- test/unit/withdraw.t.sol | 5 +---- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/Vault.sol b/src/Vault.sol index d33ed7f..b5ed130 100644 --- a/src/Vault.sol +++ b/src/Vault.sol @@ -141,7 +141,7 @@ contract Vault is IVault, ERC20PermitUpgradeable, AccessControlUpgradeable, Reen function depositAsset(address asset_, uint256 assets_, address receiver) public returns (uint256) { if (paused()) revert Paused(); if (_getAssetStorage().assets[asset_].index == 0) revert InvalidAsset(); - + uint256 shares = previewDepositAsset(asset_, assets_); _deposit(asset_, _msgSender(), receiver, assets_, shares); @@ -207,13 +207,12 @@ contract Vault is IVault, ERC20PermitUpgradeable, AccessControlUpgradeable, Reen /// @dev Being Multi asset, we need to add the asset param here to deposit the user's asset accordingly. function _deposit(address asset_, address caller, address receiver, uint256 assets, uint256 shares) internal { - _getVaultStorage().totalAssets += assets; - + SafeERC20.safeTransferFrom(IERC20(asset_), caller, address(this), assets); - + _mint(receiver, shares); - + emit Deposit(caller, receiver, assets, shares); } diff --git a/test/helpers/Etches.sol b/test/helpers/Etches.sol index d3fc690..949b51a 100644 --- a/test/helpers/Etches.sol +++ b/test/helpers/Etches.sol @@ -9,7 +9,6 @@ import {MockStETH} from "test/mocks/MockStETH.sol"; import "forge-std/Test.sol"; contract Etches is Test, MainnetContracts { - function mockAllAssets() public { mockWETH9(); mockStETH(); @@ -25,6 +24,5 @@ contract Etches is Test, MainnetContracts { MockStETH steth = new MockStETH(); bytes memory code = address(steth).code; vm.etch(STETH, code); - } } diff --git a/test/unit/admin.t.sol b/test/unit/admin.t.sol index 8b1aa97..50ba38d 100644 --- a/test/unit/admin.t.sol +++ b/test/unit/admin.t.sol @@ -37,14 +37,14 @@ contract VaultAdminUintTest is Test, MainnetContracts, MainnetActors, Etches { function test_Vault_addStrategy() public { address strat = address(42069); vm.startPrank(ADMIN); - vault.addStrategy(strat); + vault.addStrategy(strat); assertEq(vault.getStrategies().length, 1); } function test_Vault_addStrategy_unauthorized() public { address strat = address(42069); vm.expectRevert(); - vault.addStrategy(strat); + vault.addStrategy(strat); } function test_Vault_addAsset() public { @@ -65,5 +65,5 @@ contract VaultAdminUintTest is Test, MainnetContracts, MainnetActors, Etches { vm.startPrank(ADMIN); // vault.addAsset(asset, 18); // assertEq(vault.get[asset].active == true); - } + } } diff --git a/test/unit/deposit.t.sol b/test/unit/deposit.t.sol index 1ce7e9e..16852ec 100644 --- a/test/unit/deposit.t.sol +++ b/test/unit/deposit.t.sol @@ -57,9 +57,7 @@ contract VaultDepositUnitTest is Test, MainnetContracts, Etches { assertEq(vault.totalAssets(), depositAmount, "Total assets did not increase correctly"); } - function test_Vault_depositAsset() public { - - } + function test_Vault_depositAsset() public {} // function testDepositZeroAmount() public { // vm.prank(alice); @@ -67,6 +65,4 @@ contract VaultDepositUnitTest is Test, MainnetContracts, Etches { // assertEq(sharesMinted, 0, "Shares were minted for zero deposit"); // } - - } diff --git a/test/unit/withdraw.t.sol b/test/unit/withdraw.t.sol index 4e9c0a7..2888655 100644 --- a/test/unit/withdraw.t.sol +++ b/test/unit/withdraw.t.sol @@ -41,9 +41,6 @@ contract VaultWithdrawUnitTest is Test, MainnetContracts, Etches { assertEq(amount, assets); - - // fees have to be included with previewWithdraw } - -} \ No newline at end of file +}