Smart Contract Audit Report

Audit Summary

MHDC Audit Report Metaseed Labs is building a new NFT collection with a public sale and whitelisted presale format.

For this audit, we reviewed the project team's MetaseedLabsBase contract at 0x1cD0d20D67b7B0f90eEca5e56e3783161a7577B3 on the Rinkeby Testnet.

Audit Findings

Please ensure trust in the team prior to investing as they have substantial control in the ecosystem.
Date: March 31st, 2022.
Updated: April 14th, 2022, to address changes made by the team.

Finding #1 - MetaseedLabsBase - High (Resolved)

Description: The internalMint() function is vulnerable to reentrancy attacks although it is limited to situations in which the owner is a contract address. Reentrancy is made possible via the call to _safeMint(), which requires that the receiver has implemented the onERC721Received() function in the event that the receiver is a contract.
Risk/Impact: The owner can use this function to perform a reentrancy attack in an effort to mint NFTs in excess of the maximum team mint amount and maximum total supply.
Recommendation: The logic in the internalMint() function should be restructured to follow the Checks-Effects-Interactions pattern. The _teamCounter[msg.sender] and currentIndex values should be increased by the appropriate amount prior to minting any NFTs.
Resolution: The team has implemented ReentrancyGuard to prevent any reentrancy exploitation.

Contract Overview

  • The MetaseedLabsBase contract is used to facilitate a presale and public sale for the MetaseedLabsBase NFTs.
  • The maximum total supply of MetaseedLabsBase NFTs is 10,000.
  • While the presale is active, eligible user addresses can purchase up to 3 NFTs, each for a price of 0.035 ETH until the maximum total supply is reached.
  • While the public sale is active, users can each purchase up to an owner-defined amount of NFTs per transaction, each for a price of 0.035 ETH until the maximum total supply is reached.
  • The contract uses an off-chain generated Merkle tree provided by the owner to store and verify addresses that are eligible to mint during the presale.
  • The contract will only accept the exact amount of ETH that is required for the specified amount of NFTs to be purchased.
  • On deployment, the team delegates shares to any amount of addresses that can be used to claim a portion of the total ETH or specified token balance within the contract.
  • The amount of ETH or specified token per share is dependent on the contract's total balance and the total amount of shares.
  • Users delegated shares on deployment can use their shares to claim ETH or specified tokens from the contract at any time.

  • The owner can transfer ownership at any time.
  • The owner can withdraw ETH from the contract at any time.
  • The owner can toggle the public and presale at any time.
  • The owner can mint NFTs until the maximum team mint amount or maximum total supply has been reached.
  • The owner can set the maximum presale wallet amount at any time.
  • The owner can set the presale Merkle tree root values at any time, effectively controlling the presale eligibility.
  • The owner can set the base URI value at any time.
  • The contract utilizes ReentrancyGuard to prevent reentrancy attacks in applicable functions.
  • The contract uses the ERC-721A implementation, which promotes significant gas savings during minting.
  • As the contract is developed with Solidity 0.8.x, it is protected from overflow/underflow attacks.

Audit Results

Vulnerability CategoryNotesResult
Arbitrary Jump/Storage WriteN/APASS
Centralization of Control
  • The owner can withdraw ETH from the contract at any time.
  • The owner can mint NFTs until the team mint amount or the maximum supply is reached.
  • The owner can set the presale Merkle tree root values at any time effectively controlling the presale eligibility.
Compiler IssuesN/APASS
Delegate Call to Untrusted ContractN/APASS
Dependence on Predictable VariablesN/APASS
Ether/Token TheftN/APASS
Flash LoansN/APASS
Front RunningN/APASS
Improper EventsN/APASS
Improper Authorization SchemeN/APASS
Integer Over/UnderflowN/APASS
Logical IssuesN/APASS
Oracle IssuesN/APASS
Outdated Compiler VersionN/APASS
Race ConditionsN/APASS
Signature IssuesN/APASS
Unbounded LoopsN/APASS
Unused CodeN/APASS
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

+  Context 
    - [Int] _msgSender
    - [Int] _msgData

 +  Ownable (Context)
    - [Pub]  #
    - [Pub] owner
    - [Pub] renounceOwnership #
       - modifiers: onlyOwner
    - [Pub] transferOwnership #
       - modifiers: onlyOwner
    - [Int] _transferOwnership #

 +  ReentrancyGuard 
    - [Pub]  #

 + [Lib] Strings 
    - [Int] toString
    - [Int] toHexString
    - [Int] toHexString

 + [Int] IERC20 
    - [Ext] totalSupply
    - [Ext] balanceOf
    - [Ext] transfer #
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transferFrom #

 + [Lib] Address 
    - [Int] isContract
    - [Int] sendValue #
    - [Int] functionCall #
    - [Int] functionCall #
    - [Int] functionCallWithValue #
    - [Int] functionCallWithValue #
    - [Int] functionStaticCall
    - [Int] functionStaticCall
    - [Int] functionDelegateCall #
    - [Int] functionDelegateCall #
    - [Int] verifyCallResult

 + [Lib] SafeERC20 
    - [Int] safeTransfer #
    - [Int] safeTransferFrom #
    - [Int] safeApprove #
    - [Int] safeIncreaseAllowance #
    - [Int] safeDecreaseAllowance #
    - [Prv] _callOptionalReturn #

 +  PaymentSplitter (Context)
    - [Pub]  ($)
    - [Ext]  ($)
    - [Pub] totalShares
    - [Pub] totalReleased
    - [Pub] totalReleased
    - [Pub] shares
    - [Pub] released
    - [Pub] released
    - [Pub] payee
    - [Pub] release #
    - [Pub] release #
    - [Prv] _pendingPayment
    - [Prv] _addPayee #

 + [Lib] MerkleProof 
    - [Int] verify
    - [Int] processProof
    - [Prv] _efficientHash

 + [Int] IERC165 
    - [Ext] supportsInterface

 + [Int] IERC721 (IERC165)
    - [Ext] balanceOf
    - [Ext] ownerOf
    - [Ext] safeTransferFrom #
    - [Ext] transferFrom #
    - [Ext] approve #
    - [Ext] getApproved
    - [Ext] setApprovalForAll #
    - [Ext] isApprovedForAll
    - [Ext] safeTransferFrom #

 + [Int] IERC721Receiver 
    - [Ext] onERC721Received #

 + [Int] IERC721Metadata (IERC721)
    - [Ext] name
    - [Ext] symbol
    - [Ext] tokenURI

 + [Int] IERC721Enumerable (IERC721)
    - [Ext] totalSupply
    - [Ext] tokenOfOwnerByIndex
    - [Ext] tokenByIndex

 +  ERC165 (IERC165)
    - [Pub] supportsInterface

 +  ERC721A (Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable)
    - [Pub]  #
    - [Pub] totalSupply
    - [Pub] tokenByIndex
    - [Pub] tokenOfOwnerByIndex
    - [Pub] supportsInterface
    - [Pub] balanceOf
    - [Int] _numberMinted
    - [Int] ownershipOf
    - [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] _exists
    - [Int] _safeMint #
    - [Int] _safeMint #
    - [Prv] _transfer #
    - [Prv] _approve #
    - [Int] _setOwnersExplicit #
    - [Prv] _checkOnERC721Received #
    - [Int] _beforeTokenTransfers #
    - [Int] _afterTokenTransfers #

 +  MetaseedLabsBase (Ownable, PaymentSplitter, ERC721A, ReentrancyGuard)
    - [Pub]  #
       - modifiers: ERC721A,PaymentSplitter
    - [Ext] setActive #
       - modifiers: onlyOwner
    - [Ext] presaleActive #
       - modifiers: onlyOwner
    - [Ext] setMaxPresale #
       - modifiers: onlyOwner
    - [Ext] setPreSaleRoot #
       - modifiers: onlyOwner
    - [Ext] setPublicRoot #
       - modifiers: onlyOwner
    - [Ext] internalMint #
       - modifiers: onlyOwner
    - [Ext] setBaseURI #
       - modifiers: onlyOwner
    - [Int] _baseURI
    - [Ext] mintPreSaleTokens ($)
       - modifiers: callerIsUser,nonReentrant
    - [Ext] withdraw #
       - modifiers: onlyOwner
    - [Ext] publicSaleMint ($)
       - modifiers: nonReentrant,callerIsUser

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 1800+ 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!
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.