Skip to content

Commit

Permalink
feat: withdraw with tokenAddresses as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoMelo00 committed Sep 19, 2024
1 parent f489d77 commit 50305ff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contracts/ERC20Splitter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ contract ERC20Splitter is ReentrancyGuard {

/// @notice Withdraw all tokens that the caller is entitled to.
/// Tokens are automatically determined based on previous deposits.
function withdraw(address[] calldata tokenAddresses) external nonReentrant {
function withdraw(address[] calldata tokenAddresses) external nonReentrant {
uint256 tokenCount = tokenAddresses.length;
require(tokenCount > 0, 'ERC20Splitter: No tokens specified');

Expand All @@ -68,10 +68,10 @@ contract ERC20Splitter is ReentrancyGuard {
uint256 amount = balances[tokenAddress][msg.sender];

if (amount == 0) {
continue; // Skip if no balance
continue;
}

balances[tokenAddress][msg.sender] = 0;
delete balances[tokenAddress][msg.sender];

if (tokenAddress == address(0)) {
payable(msg.sender).transfer(amount);
Expand Down

0 comments on commit 50305ff

Please sign in to comment.