Use of Constants Improves Readability and Gas Performance
In the checkWhitelist function of the FiatTokenV2.sol file, the following function can be found:
modifier checkWhitelist(address _account, uint256 _value) {
if (_value > 100000 * 10 ** 18) {//@audit Gas Optimization This should be moved to constant or 1e18
require(
whitelisted[_account],
"Whitelistable: account is not whitelisted"
);
}
_;
}
Inside the if statement we have two things: a constant 100000 which is unexplained, and a 10**18 expression. Moving the 10**18 function to 1e18 or a constant would save on gas and be more readable.
Additionally, the use of 10000 instead of a constant like WHITELIST_LOWERBOUND or a similar constant would be more readable.
Use of Constants Improves Readability and Gas Performance
In the
checkWhitelist
function of theFiatTokenV2.sol
file, the following function can be found:Inside the
if
statement we have two things: a constant100000
which is unexplained, and a10**18
expression. Moving the10**18
function to1e18
or a constant would save on gas and be more readable.Additionally, the use of
10000
instead of a constant likeWHITELIST_LOWERBOUND
or a similar constant would be more readable.