Hash Cows

Smart Contract Audit Report

Audit Summary

Hash Cows Audit Report Hash Cows is building a new protocol that allows users to purchase NFTs.

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

Audit Findings

Please ensure trust in the team prior to investing as they have some control in the ecosystem.
Date: March 18th, 2022.
Updated: March 25th, 2022 to reflect the contract's new Testnet address.

Finding #1 - HCTest - Low (Resolved)

Description: Any excess ETH supplied to the contract during minting is not returned to the user.
Risk/Impact: Users will lose any excess funds sent as payment.
Recommendation: The contract should require the user to supply the exact amount of ETH needed to mint the desired amount of NFTs.
Resolution: The team has implemented the above recommendation.

Finding #2 - HCTest - Informational (Resolved)

Description: Several functions are declared public, but are never called internally.
walletOf, setBaseURI, pause, unpause
Recommendation: These functions should be declared external for additional gas savings on each call.

Finding #3 - HCTest - Informational (Resolved)

Description: Although the SafeMath library is utilized, the contract is implemented with Solidity v0.8.x which has built-in overflow checks.
Recommendation: SafeMath could be safely removed to reduce contract size and deployment costs.

Contract Overview

  • The maximum supply is set to 10,000 NFTs.
  • Upon deployment, minting functionality will be disabled for all users.
  • The owner can enable presale mode at any time which allows whitelisted users to perform one minting transaction of up to 4 NFTs.
  • The owner can enable public sale mode at any time which allows all users to purchase up to 5 NFTs per transaction until the total supply is reached.
  • The price per NFT during both presale mode and public sale mode is 0.08 ether.
  • The contract utilizes a Pauser role and a Default Admin role which will both be granted to the owner upon deployment.
  • The Pauser can pause the contract at any time which disables all minting functionality.
  • The Default Admin can add accounts to the presale whitelist at any time.
  • The Default Admin can set the maximum supply equal to the current total supply which will disable all minting.
  • The Default Admin can disable all minting functionality at any time.
  • The Default Admin can withdraw all of the ETH from the contract at any time.
  • The Default Admin can set the base URI to any value at any time.
  • The Default Admin can set the unrevealed URI to any value at any time; this value is used as a temporary URI before the true base URI has been revealed.
  • As the contract is deployed with Solidity v0.8.11, it is safe from any possible overflows/underflows.
  • The contract complies with the ERC-721 token standard.

Audit Results

Vulnerability CategoryNotesResult
Arbitrary Jump/Storage WriteN/APASS
Centralization of ControlThe team can pause all minting functionality at any time.PASS
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
ReentrancyN/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

 + [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

 + [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

 +  ERC165 (IERC165)
    - [Pub] supportsInterface

 +  ERC721 (Context, ERC165, IERC721, IERC721Metadata)
    - [Pub]  #
    - [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 #
    - [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]  #
    - [Pub] paused
    - [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
    - [Pub] getRoleAdmin
    - [Pub] grantRole #
       - modifiers: onlyRole
    - [Pub] revokeRole #
       - modifiers: onlyRole
    - [Pub] renounceRole #
    - [Int] _setupRole #
    - [Int] _setRoleAdmin #
    - [Int] _grantRole #
    - [Int] _revokeRole #

 + [Lib] Counters 
    - [Int] current
    - [Int] increment #
    - [Int] decrement #
    - [Int] reset #

 + [Lib] SafeMath 
    - [Int] tryAdd
    - [Int] trySub
    - [Int] tryMul
    - [Int] tryDiv
    - [Int] tryMod
    - [Int] add
    - [Int] sub
    - [Int] mul
    - [Int] div
    - [Int] mod
    - [Int] sub
    - [Int] div
    - [Int] mod

 +  HCTest (ERC721, ERC721Enumerable, Pausable, AccessControl)
    - [Pub]  #
       - modifiers: ERC721
    - [Ext] safeMint ($)
       - modifiers: whenNotPaused
    - [Ext] whitelistAddresses #
       - modifiers: onlyRole
    - [Ext] isAddressWhitelisted
    - [Ext] startPreSale #
       - modifiers: onlyRole
    - [Ext] startPublicSale #
       - modifiers: onlyRole
    - [Ext] stopSale #
       - modifiers: onlyRole
    - [Ext] reveal #
       - modifiers: onlyRole
    - [Pub] walletOf
    - [Ext] withdraw #
       - modifiers: onlyRole
    - [Pub] setNotRevealedURI #
       - modifiers: onlyRole
    - [Pub] setBaseURI #
       - modifiers: onlyRole
    - [Int] _baseURI
    - [Pub] tokenURI
    - [Pub] pause #
       - modifiers: onlyRole
    - [Pub] unpause #
       - modifiers: onlyRole
    - [Int] _beforeTokenTransfer #
       - modifiers: whenNotPaused
    - [Pub] supportsInterface

About Solidity Finance

Solidity Finance was founded in 2020 and quickly grew to have one of the most experienced and well-equipped smart contract auditing teams in the industry. Our team has conducted 1000+ 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 Solidity Audit?

Typically, a smart contract audit is a comprehensive review process designed to discover logical errors, security vulnerabilities, and optimization opportunities within code. A Solidity 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.