Closed usgeeus closed 2 months ago
Describe the bug We can save gas by reordering the if statements
Lines of Codes https://github.com/tokamak-network/Tms-contract/blob/31a33830d7840ef742a24d1be3b299d6a1a05c07/contracts/MultiSender.sol#L54-L61
Configuration
Impact When amounts[i] is zero and _recipients[i] is address(0), This results in an unnecessary plus-zero operation _failedAmount += 0
amounts[i]
_recipients[i]
_failedAmount += 0
Recommendation Reverse the order.
Solved
Describe the bug We can save gas by reordering the if statements
Lines of Codes https://github.com/tokamak-network/Tms-contract/blob/31a33830d7840ef742a24d1be3b299d6a1a05c07/contracts/MultiSender.sol#L54-L61
Configuration
Impact When
amounts[i]
is zero and_recipients[i]
is address(0), This results in an unnecessary plus-zero operation_failedAmount += 0
Recommendation Reverse the order.