Omniscia Seen Haus Audit
SeenHausNFT Code Style Findings
SeenHausNFT Code Style Findings
SHN-01C: Improper Initialization
| Type | Severity | Location |
|---|---|---|
| Standard Conformity | Informational | SeenHausNFT.sol:L42 |
Description:
The ERC1155Upgradeable contract is initialized with its unchained counterpart.
Example:
25contract SeenHausNFT is ISeenHausNFT, MarketClientBase, ERC1155Upgradeable {26
27 address private _owner;28
29 event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);30
31 /// @dev token id => Token struct32 mapping (uint256 => Token) internal tokens;33
34 // Next token number35 uint256 internal nextToken;36
37 /**38 * @notice Initializer39 */40 function initialize(address _initOwner)41 public {42 __ERC1155_init_unchained("");43 _transferOwnership(_initOwner);44 }Recommendation:
We advise the normal counterpart to be initialized instead. While it bears no effect as the dependencies of ERC1155Upgradeable have no logic in their initializers, its still more standardized to do it this way.
Alleviation:
The normal initialize counterpart is now properly invoked in the codebase.
SHN-02C: Non-Standard Storage Declaration
| Type | Severity | Location |
|---|---|---|
| Language Specific | Informational | SeenHausNFT.sol:L27, L32, L35 |
Description:
The SeenHausNFT contract is meant to be an upgrade-able one yet has its storage layout bundled with its logic blocks.
Example:
25contract SeenHausNFT is ISeenHausNFT, MarketClientBase, ERC1155Upgradeable {26
27 address private _owner;28
29 event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);30
31 /// @dev token id => Token struct32 mapping (uint256 => Token) internal tokens;33
34 // Next token number35 uint256 internal nextToken;Recommendation:
We advise the two items to be split into separate contracts to increase the maintainability of the codebase as the order of storage is crucial in upgradeable contracts.
Alleviation:
A dedicated SeenHausNFTStorage contract is now utilized to declare storage variables.
SHN-03C: Redundant import Statement
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | Informational | SeenHausNFT.sol:L5 |
Description:
The linked dependency is not utilized by the codebase.
Example:
1// SPDX-License-Identifier: GPL-3.0-or-later2pragma solidity ^0.8.0;3
4import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";5import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";6import "../../../interfaces/ISeenHausNFT.sol";7import "../../../interfaces/IERC2981.sol";8import "../MarketClientBase.sol";9
10/**11 * @title SeenHausNFT12 * @notice This is the Seen.Haus ERC-1155 NFT contract.13 *14 * Key features:15 * - Supports the ERC-2981 NFT Royalty Standard16 * - Tracks the original creator of each token.17 * - Tracks which tokens have a physical part18 * - Logically capped token supplies; a token's supply cannot be increased after minting.19 * - Only ESCROW_AGENT-roled addresses can mint physical NFTs.20 * - Only MINTER-roled addresses can mint digital NFTs, e.g., Seen.Haus staff, approved artists.21 * - Newly minted NFTs are automatically transferred to the MarketController and consigned22 *23 * @author Cliff Hall <cliff@futurescale.com> (https://twitter.com/seaofarrows)24 */25contract SeenHausNFT is ISeenHausNFT, MarketClientBase, ERC1155Upgradeable {Recommendation:
We advise it to be safely omitted.
Alleviation:
The redundant import statement has been omitted from the codebase.