Omniscia Tren Finance Audit
SafetyTransfer Code Style Findings
SafetyTransfer Code Style Findings
STR-01C: Ineffectual Usage of Safe Arithmetics
| Type | Severity | Location |
|---|---|---|
| Language Specific | ![]() | SafetyTransfer.sol:L26, L32 |
Description:
The linked mathematical operations are guaranteed to be performed safely by surrounding conditionals evaluated in either require checks or if-else constructs.
Example:
25if (decimals < 18) {26 uint256 divisor = 10 ** (18 - decimals);Recommendation:
Given that safe arithmetics are toggled on by default in pragma versions of 0.8.X, we advise the linked statements to be wrapped in unchecked code blocks thereby optimizing their execution cost.
Alleviation (f6f1ad0b8f):
While unchecked code blocks have been introduced to both code blocks, we advise the multiplier calculation to be performed using checked arithmetics as the exponent operation itself might cause an overflow for tokens with very large decimals.
Alleviation (73b9546eb9):
The unchecked block has been removed from both the exponent operation and the decimals - 18 operation, rendering the exhibit to recede to a partially addressed state.
