File tree Expand file tree Collapse file tree 4 files changed +6
-6
lines changed
Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,6 @@ src = "src"
33out = " out"
44libs = [" 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
Original file line number Diff line number Diff 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 " );
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments