Wonder Zone

Smart Contract Audit Report

Audit Summary

Wonder Zone Audit Report Wonder Zone is releasing a new series of ERC721 NFTs that are compatible with their Wondermine crafting game.

For this audit, we reviewed the project team's WzTokenCollection contract at commit 8415ab81be6ca3d32828963a9b949f7f84422913 on the team's private GitHub repository.

Audit Findings

All findings have been resolved, though some centralized aspects are present.
Date: July 19th, 2022.
Updated: July 22nd, 2022 with updates from commit debf6ccfb52755b151c1f15135704444bb311345 to commit 8415ab81be6ca3d32828963a9b949f7f84422913.

Finding #1 - WzTokenCollection - Low (Resolved)

Description: The _mint() function checks that the number of issued NFTs for a Product is less than or equal to the maximum issuable amount before the number of NFTs minted is incremented.
Risk/Impact: One more than the maximum issuable NFTs can be minted for each Product.
Recommendation: The team should change the require statement to a strictly less than operator.
Resolution: The team has implemented the recommendation above.

Finding #2 - WzTokenCollection - Informational (Resolved)

Description: The getAttributes() function is access control restricted to just the Operator role with the apparent intention to restrict users from reading their NFT's attributes. However, this access control is ineffective for that purpose.
Risk/Impact: Users may use the blockchain transactions to determine the attributes of an NFT as a workaround to the access control restriction on the getAttributes() function.
Resolution: The team has removed the access control restriction from the getAttributes() function.

Contract Overview

  • This contract is used to mint NFTs associated with a Product.
  • The deployer is initially given the Default Admin, Minter, and Operator roles.
  • Any address with the Default Admin role may add a new Product.
  • Each Product has a name, maximum number of associated NFTs, a default set of attributes, and whether they are "issuable".
  • Any address with the Minter role may issue an NFT to a specified address.
  • The Minter must provide the associated Product for the NFT.
  • The Product must be issuable and the current number of minted NFTs below the maximum allowed for the Product.
  • The Minter may provide a set of attributes for the NFT. The NFT will receive the Product's default attributes if none are provided.
  • Any address with the Minter role may mint an NFT that is not associated with a Product to any address at any time.
  • Any address with the Operator role may update an NFT's attributes at any time.
  • Any address with the Default Admin role may toggle whether a Product is issuable.
  • Any address with the Default Admin role may update a Product's name and default attributes.
  • Any address with the Default Admin role may update the base URI at any time.
  • Any address with the Default Admin role may pause the contract, preventing minting and transferring NFTs, at any time.
  • The contract complies with the ERC721 standard.
  • As the contract is implemented with Solidity v0.8.0, it is safe from any possible overflows/underflows.
  • Audit Results

    Vulnerability Category Notes Result
    Arbitrary Jump/Storage Write N/A PASS
    Centralization of Control
    • The Default Admin may pause the contract preventing minting and transfers.
    • The Operator may change the attributes of any NFT.
    • The Minter may mint any amount of NFTs associated with Products, up to the Product's limit, to any address.
    WARNING
    Compiler Issues N/A PASS
    Delegate Call to Untrusted Contract N/A PASS
    Dependence on Predictable Variables N/A PASS
    Ether/Token Theft N/A PASS
    Flash Loans N/A PASS
    Front Running N/A PASS
    Improper Events N/A PASS
    Improper Authorization Scheme N/A PASS
    Integer Over/Underflow N/A PASS
    Logical Issues N/A PASS
    Oracle Issues N/A PASS
    Outdated Compiler Version N/A PASS
    Race Conditions N/A PASS
    Reentrancy N/A PASS
    Signature Issues N/A PASS
    Unbounded Loops N/A PASS
    Unused Code N/A PASS
    Overall Contract Safety   PASS

    Inheritance Chart

    Smart Contract Audit - Inheritance

    Function Graph

    Smart Contract Audit - Graph

    Functions Overview

    
     ($) = payable function
     # = non-constant function
     
     Int = Internal
     Ext = External
     Pub = Public
    
     + [Int] IERC165 
        - [Ext] supportsInterface
    
     + [Int] IERC721 (IERC165)
        - [Ext] balanceOf
        - [Ext] ownerOf
        - [Ext] safeTransferFrom #
        - [Ext] safeTransferFrom #
        - [Ext] transferFrom #
        - [Ext] approve #
        - [Ext] setApprovalForAll #
        - [Ext] getApproved
        - [Ext] isApprovedForAll
    
     + [Int] IERC721Receiver 
        - [Ext] onERC721Received #
    
     + [Int] IERC721Metadata (IERC721)
        - [Ext] name
        - [Ext] symbol
        - [Ext] tokenURI
    
     + [Lib] Address 
        - [Int] isContract
        - [Int] sendValue #
        - [Int] functionCall #
        - [Int] functionCall #
        - [Int] functionCallWithValue #
        - [Int] functionCallWithValue #
        - [Int] functionStaticCall
        - [Int] functionStaticCall
        - [Int] functionDelegateCall #
        - [Int] functionDelegateCall #
        - [Int] verifyCallResult
    
     +  Context 
        - [Int] _msgSender
        - [Int] _msgData
    
     + [Lib] Strings 
        - [Int] toString
        - [Int] toHexString
        - [Int] toHexString
        - [Int] toHexString
    
     +  ERC165 (IERC165)
        - [Pub] supportsInterface
    
     +  ERC721 (Context, ERC165, IERC721, IERC721Metadata)
        - [Pub] Constructor #
        - [Pub] supportsInterface
        - [Pub] balanceOf
        - [Pub] ownerOf
        - [Pub] name
        - [Pub] symbol
        - [Pub] tokenURI
        - [Int] _baseURI
        - [Pub] approve #
        - [Pub] getApproved
        - [Pub] setApprovalForAll #
        - [Pub] isApprovedForAll
        - [Pub] transferFrom #
        - [Pub] safeTransferFrom #
        - [Pub] safeTransferFrom #
        - [Int] _safeTransfer #
        - [Int] _exists
        - [Int] _isApprovedOrOwner
        - [Int] _safeMint #
        - [Int] _safeMint #
        - [Int] _mint #
        - [Int] _burn #
        - [Int] _transfer #
        - [Int] _approve #
        - [Int] _setApprovalForAll #
        - [Int] _requireMinted
        - [Prv] _checkOnERC721Received #
        - [Int] _beforeTokenTransfer #
        - [Int] _afterTokenTransfer #
    
     + [Int] IERC721Enumerable (IERC721)
        - [Ext] totalSupply
        - [Ext] tokenOfOwnerByIndex
        - [Ext] tokenByIndex
    
     +  ERC721Enumerable (ERC721, IERC721Enumerable)
        - [Pub] supportsInterface
        - [Pub] tokenOfOwnerByIndex
        - [Pub] totalSupply
        - [Pub] tokenByIndex
        - [Int] _beforeTokenTransfer #
        - [Prv] _addTokenToOwnerEnumeration #
        - [Prv] _addTokenToAllTokensEnumeration #
        - [Prv] _removeTokenFromOwnerEnumeration #
        - [Prv] _removeTokenFromAllTokensEnumeration #
    
     +  Pausable (Context)
        - [Pub] Constructor #
        - [Pub] paused
        - [Int] _requireNotPaused
        - [Int] _requirePaused
        - [Int] _pause #
           - modifiers: whenNotPaused
        - [Int] _unpause #
           - modifiers: whenPaused
    
     + [Int] IAccessControl 
        - [Ext] hasRole
        - [Ext] getRoleAdmin
        - [Ext] grantRole #
        - [Ext] revokeRole #
        - [Ext] renounceRole #
    
     +  AccessControl (Context, IAccessControl, ERC165)
        - [Pub] supportsInterface
        - [Pub] hasRole
        - [Int] _checkRole
        - [Int] _checkRole
        - [Pub] getRoleAdmin
        - [Pub] grantRole #
           - modifiers: onlyRole
        - [Pub] revokeRole #
           - modifiers: onlyRole
        - [Pub] renounceRole #
        - [Int] _setupRole #
        - [Int] _setRoleAdmin #
        - [Int] _grantRole #
        - [Int] _revokeRole #
    
     +  WzBaseCollection (ERC721, ERC721Enumerable, Pausable, AccessControl)
        - [Pub] Constructor #
           - modifiers: ERC721
        - [Pub] setBaseURI #
        - [Int] _baseURI
        - [Pub] pause #
        - [Pub] unpause #
        - [Pub] addProduct #
        - [Pub] activateProduct #
        - [Pub] changeProduct #
        - [Ext] getProduct
        - [Ext] productCount
        - [Ext] remainingSupply
        - [Int] _mint #
           - modifiers: whenNotPaused
        - [Int] _beforeTokenTransfer #
           - modifiers: whenNotPaused
        - [Pub] supportsInterface
    
     +  WzTokenCollection (WzBaseCollection)
        - [Pub] Constructor #
           - modifiers: WzBaseCollection
        - [Ext] issueToken #
        - [Ext] issueTokens #
        - [Int] _issueToken #
        - [Pub] tokenURI
        - [Pub] getAttributes
        - [Pub] changeAttributes #
    

    About SourceHat

    SourceHat has quickly grown to have one of the most experienced and well-equipped smart contract auditing teams in the industry. Our team has conducted 1300+ solidity smart contract audits covering all major project types and protocols, securing a total of over $50 billion U.S. dollars in on-chain value across 1500 projects!.
    Our firm is well-reputed in the community and is trusted as a top smart contract auditing company for the review of solidity code, no matter how complex. Our team of experienced solidity smart contract auditors performs audits for tokens, NFTs, crowdsales, marketplaces, gambling games, financial protocols, and more!

    Contact us today to get a free quote for a smart contract audit of your project!

    What is a SourceHat Audit?

    Typically, a smart contract audit is a comprehensive review process designed to discover logical errors, security vulnerabilities, and optimization opportunities within code. A SourceHat Audit takes this a step further by verifying economic logic to ensure the stability of smart contracts and highlighting privileged functionality to create a report that is easy to understand for developers and community members alike.

    How Do I Interpret the Findings?

    Each of our Findings will be labeled with a Severity level. We always recommend the team resolve High, Medium, and Low severity findings prior to deploying the code to the mainnet. Here is a breakdown on what each Severity level means for the project:

    • High severity indicates that the issue puts a large number of users' funds at risk and has a high probability of exploitation, or the smart contract contains serious logical issues which can prevent the code from operating as intended.
    • Medium severity issues are those which place at least some users' funds at risk and has a medium to high probability of exploitation.
    • Low severity issues have a relatively minor risk association; these issues have a low probability of occurring or may have a minimal impact.
    • Informational issues pose no immediate risk, but inform the project team of opportunities for gas optimizations and following smart contract security best practices.