Skip to content

Commit

Permalink
optimize _removeAllPlugins
Browse files Browse the repository at this point in the history
  • Loading branch information
ZumZoom committed Aug 15, 2023
1 parent fba54a0 commit 29a241a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions contracts/ERC20Plugins.sol
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,11 @@ abstract contract ERC20Plugins is ERC20, IERC20Plugins, ReentrancyGuardExt {
uint256 balance = balanceOf(account);
unchecked {
for (uint256 i = items.length; i > 0; i--) {
_plugins[account].remove(items[i - 1]);
emit PluginRemoved(account, items[i - 1]);
address item = items[i-1];
_plugins[account].remove(item);
emit PluginRemoved(account, item);
if (balance > 0) {
_updateBalances(items[i - 1], account, address(0), balance);
_updateBalances(item, account, address(0), balance);
}
}
}
Expand Down

0 comments on commit 29a241a

Please sign in to comment.