Omniscia Tren Finance Audit
CommunityIssuance Code Style Findings
CommunityIssuance Code Style Findings
CIE-01C: Ineffectual Usage of Safe Arithmetics
Type | Severity | Location |
---|---|---|
Language Specific | CommunityIssuance.sol:L125 |
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/TREN/CommunityIssuance.sol
119if (totalTRENIssued >= maxPoolSupply) return 0;120
121uint256 issuance = _getLastUpdateTokenDistribution();122uint256 totalIssuance = issuance + totalTRENIssued;123
124if (totalIssuance > maxPoolSupply) {125 issuance = maxPoolSupply - totalTRENIssued;126 totalIssuance = maxPoolSupply;127}
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 (f6f1ad0b8f24a96ade345db1dd05a1878eb0f761):
The referenced arithmetic operation has been safely wrapped in an unchecked
code block, optimizing its gas cost.