Omniscia Optimex Audit
TokenUtils Code Style Findings
TokenUtils Code Style Findings
TUS-01C: Ineffectual Usage of Safe Arithmetics
| Type | Severity | Location |
|---|---|---|
| Language Specific | ![]() | TokenUtils.sol: • I-1: L24 • I-2: L26 |
Description:
The linked mathematical operation is guaranteed to be performed safely by logical inference, such as surrounding conditionals evaluated in require checks or if-else constructs.
Example:
contracts/libraries/TokenUtils.sol
23if (oldAllowance > amount) {24 token.safeDecreaseAllowance(spender, oldAllowance - amount);25} else if (oldAllowance < amount) {26 token.safeIncreaseAllowance(spender, amount - oldAllowance);27}Recommendation:
Given that safe arithmetics are toggled on by default in pragma versions of 0.8.X, we advise the linked statement to be wrapped in an unchecked code block thereby optimizing its execution cost.
Alleviation (c11bae0aacaeb7f4e4b53c864f96917ca574182f):
The Optimex team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
