The _updateTokenWhiteListed
function in the smart contract emits an event every time it's called, regardless of whether the whitelist status of a token has actually changed.
When _updateTokenWhitelist function is called, event is emitted for every token processed, even if its whitelist status remains the same.
The function should only emit an event when the whitelist status of a token actually changes.
Steps to Reproduce:
Call updateTokenWhiteListed
with a token address that is already in the desired whitelist state.
Observe that an event is emitted even though no state change occurred.
Increased gas costs and unnecessary event emissions.
Modify the _updateTokenWhiteListed
function to check if the new status is different from the current status before updating and emitting the event. For example:
function _updateTokenWhiteListed(address _token, bool _isWhiteListed) internal {
if (tokenWhiteListed[_token] != _isWhiteListed) {
tokenWhiteListed[_token] = _isWhiteListed;
emit UpdateTokenWhiteListed(_token, _isWhiteListed);
}
}
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.