Omniscia Tangible Audit
TangibleNFTV2 Static Analysis Findings
TangibleNFTV2 Static Analysis Findings
TNT-01S: Illegible Numeric Value Representations
Type | Severity | Location |
---|---|---|
Code Style | TangibleNFTV2.sol:L196, L197 |
Description:
The linked representations of numeric literals are sub-optimally represented decreasing the legibility of the codebase.
Example:
196storagePricePerYear = 2000; // 20$ in 2 decimals
Recommendation:
To properly illustrate each value's purpose, we advise the following guidelines to be followed.
For values meant to depict fractions with a base of 1e18
, we advise fractions to be utilized directly (i.e. 1e17
becomes 0.1e18
) as they are supported.
For values meant to represent a percentage base, we advise each value to utilize the underscore (_
) separator to discern the percentage decimal (i.e. 10000
becomes 100_00
, 300
becomes 3_00
and so on).
Finally, for large numeric values we simply advise the underscore character to be utilized again to represent them (i.e. 1000000
becomes 1_000_000
).
Alleviation (2ad448279d):
The underscore separator has been properly introduced in the first of the two referenced instances, addressing this exhibit partially.
Alleviation (2135afa89e):
The second numeral meant to represent 10%
is now correctly depicted as 0.1e2
, addressing this exhibit in full.
TNT-02S: Redundant Variable Assignment
Type | Severity | Location |
---|---|---|
Gas Optimization | TangibleNFTV2.sol:L204 |
Description:
The linked variable is assigned to redundantly to the default value of the relevant data type (i.e. uint256
assigned to 0
, address
assigned to address(0)
etc.).
Example:
204lastTokenId = 0;
Recommendation:
We advise the assignment to be safely omitted optimizing the codebase.
Alleviation (2ad448279d9e8e4b6edd94bcd2eb22129b6f7357):
The redundant variable assignment of the lastTokenId
entry has been safely omitted.