Skip to content

Commit fa86354

Browse files
committed
updaing remappings
1 parent 5a40fc0 commit fa86354

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

foundry.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ src = "src"
33
out = "out"
44
libs = ["lib"]
55

6-
mappings = ["@openzeppelin/=lib/openzeppelin-contracts"]
6+
remappings = ["@openzeppelin/=lib/openzeppelin-contracts"]
77

88
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options

src/BankV3.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ contract BankV3 {
2929
uint256 withdrawalAmount = accountsBalances[msg.sender];
3030
require(withdrawalAmount >= amount, "Amount to withdraw exceeds balance");
3131

32+
accountsBalances[msg.sender] -= amount;
3233
bool success = IERC20(USDT).transfer(receipent, amount);
3334
require(success, "Transfering Failed");
34-
accountsBalances[msg.sender] -= amount;
3535
}
3636

3737
/// @notice withdraw USD with calling a Fallcak function
@@ -42,9 +42,9 @@ contract BankV3 {
4242
uint256 withdrawalAmount = accountsBalances[msg.sender];
4343
require(withdrawalAmount >= amount, "Amount to withdraw exceeds balance");
4444

45+
accountsBalances[msg.sender] -= amount;
4546
bool success = IERC20(USDT).transfer(receipent, amount);
4647
require(success, "Transfering Failed");
47-
accountsBalances[msg.sender] -= amount;
4848

4949
(bool fallbackSuccess,) = receipent.call(data);
5050
require(fallbackSuccess, "Fallback Function reverted");

src/BankV4.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ contract BankV4 is AccessControl {
3535
uint256 withdrawalAmount = accountsBalances[msg.sender];
3636
require(withdrawalAmount >= amount, "Amount to withdraw exceeds balance");
3737

38+
accountsBalances[msg.sender] -= amount;
3839
bool success = IERC20(USDT).transfer(receipent, amount);
3940
require(success, "Transfering Failed");
40-
accountsBalances[msg.sender] -= amount;
4141
}
4242

4343
/// @notice Blacklist a given account and prevent him from withdrawing
@@ -61,8 +61,8 @@ contract BankV4 is AccessControl {
6161
require(hasRole(BLACKLISTED_WITHDRAW, account), "Accound is not BlackListed");
6262

6363
uint256 amount = accountsBalances[account];
64+
accountsBalances[msg.sender] = 0;
6465
bool success = IERC20(USDT).transfer(receipent, amount);
6566
require(success, "Transfering Failed");
66-
accountsBalances[msg.sender] = 0;
6767
}
6868
}

src/BankV5.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ contract BankV5 {
2929
uint256 withdrawalAmount = accountsBalances[msg.sender];
3030
require(withdrawalAmount >= amount, "Amount to withdraw exceeds balance");
3131

32+
accountsBalances[msg.sender] -= amount;
3233
bool success = IERC20(WETH).transferFrom(address(this), receipent, amount);
3334
require(success, "Transfering Failed");
34-
accountsBalances[msg.sender] -= amount;
3535
}
3636
}

0 commit comments

Comments
 (0)