Omniscia LOC Game Audit

LOCOZExtension Code Style Findings

LOCOZExtension Code Style Findings

LOO-01C: Redundant Logical Branch

TypeSeverityLocation
Gas OptimizationInformationalLOCOZExtension.sol:L35-L37

Description:

The logical branch of tokenCount being equal to 0 results in the same output in tokensOfOwner regardless of whether the linked code block exists or not as the loop never executes in case of 0.

Example:

contracts/LOCOZExtension.sol
28function tokensOfOwner(address owner)
29 external
30 view
31 returns (uint256[] memory)
32{
33 uint256 tokenCount = balanceOf(owner);
34
35 if (tokenCount == 0) {
36 return new uint256[](0);
37 }
38
39 uint256[] memory result = new uint256[](tokenCount);
40 for (uint256 i = 0; i < tokenCount; i++) {
41 result[i] = tokenOfOwnerByIndex(owner, i);
42 }
43
44 return result;
45}

Recommendation:

We advise the linked statements to be omitted as they increase the bytecode size of the contract redundantly.

Alleviation:

The redundant logical branch was safely omitted from the codebase.

LOO-02C: Redundant Usage of SafeMath

TypeSeverityLocation
Language SpecificInformationalLOCOZExtension.sol:L5, L9

Description:

As the contract system at hand is locked at the 0.8.9 compiler version, safe arithmetic is toggled on by default rendering the usage of wrapper libraries redundant.

Example:

contracts/LOCOZExtension.sol
1// SPDX-License-Identifier: MIT
2pragma solidity 0.8.9;
3
4import "openzeppelin-solidity/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
5import "openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
6import "./LOCAccess.sol";
7
8abstract contract LOCOZExtension is LOCAccess, ERC721Enumerable {
9 using SafeMath for uint256;

Recommendation:

We advise the SafeMath library to be omitted from the codebase safely.

Alleviation:

The SafeMath library was safely removed from the codebase.