Omniscia Tangible Audit

TangibleNFTV2 Static Analysis Findings

TangibleNFTV2 Static Analysis Findings

TNT-01S: Illegible Numeric Value Representations

Description:

The linked representations of numeric literals are sub-optimally represented decreasing the legibility of the codebase.

Example:

contracts/TangibleNFTV2.sol
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

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:

contracts/TangibleNFTV2.sol
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.