Skip to content

Commit

Permalink
fix: minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivam78288 committed Dec 23, 2023
1 parent dd36d31 commit 838be05
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions contracts/BatchTransaction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -252,21 +252,18 @@ contract BatchTransaction is Basic, NitroMessageHandler, ReentrancyGuard {
}

function processRefunds(address user) internal {
uint256 len = tokensToRefund[user].tokens.length;
address[] memory tokens = tokensToRefund[user].tokens;
delete tokensToRefund[user].tokens;

uint256 len = tokens.length;

for (uint256 i = 0; i < len; ) {
withdrawTokens(
tokensToRefund[user].tokens[i],
user,
type(uint256).max
);
withdrawTokens(tokens[i], user, type(uint256).max);

unchecked {
++i;
}
}

delete tokensToRefund[user];
}

/**
Expand Down

0 comments on commit 838be05

Please sign in to comment.