Collar Quest SPARC-E

Smart Contract Audit Report

Audit Summary

Collar Quest SPARC-E Audit Report Collar Quest is building a new platform where whitelisted users can mint NFTs.

For this audit, we reviewed the project team's SPARCECore contract at 0x674900b8fd8ee1b487d162d04c59300222d90466 and SPARCEManagerCustomizable contract at 0x3041680f5494e340bdba3dc982cf1d2f621dc068 on the Ethereum Mainnet.

Audit Findings

Informational findings were identified and the team may want to review them.
Date: September 23rd, 2022.

Finding #1 - SPARCEManagerCustomizable - Informational

Description: The whenSpawningAllowed(), whenRebirthAllowed(), whenRetirementAllowed(), and whenEvolvementAllowed() modifiers in the SPARCECore contract each call into separate functions to check the same boolean value of allowedAll.
function setAllowAll(bool _allowedAll) external onlyOwner {
    allowedAll = _allowedAll;
    }

    function isSpawningAllowed(uint256, address) external override view returns (bool) {
    return allowedAll;
    }

    function isRebirthAllowed(uint256, uint256) external override view returns (bool) {
    return allowedAll;
    }

    function isRetirementAllowed(uint256, bool) external override view returns (bool) {
    return allowedAll;
    }

    function isTransferAllowed(address, address, uint256) external override view returns (bool) {
    return allowedAll;
    }

    function isEvolvementAllowed(uint256, uint256) external override view returns (bool) {
    return allowedAll;
    }
Recommendation: Each function that returns allowedAll could be removed and each modifier could be updated to simply check the boolean value of allowedAll to reduce contract size and deployment costs. Or, The team could add setter functions that toggle separate boolean values for each individual function.

Contracts Overview

  • As the contracts are deployed with Solidity v0.8.4, they are safe from any possible overflows/underflows.
SPARCECore Contract:
  • Upon deployment, 4 SPARC-E NFTs are minted to the deployer's wallet.
  • Whitelisted spawners can spawn a new SPARC-E NFT by specifying a number of genes that will be assigned to the NFT and a receiver address.
  • Whitelisted spawners can spawn up to 30 NFTs per transaction that will be minted to the owner of the contract by specifying a number of genes for each NFT.
  • Whitelisted spawners can rebirth an existing SPARC-E which will update its number of genes and set its born time to the time the transaction occurred.
  • Whitelisted Bye-Sayers can burn any existing SPARC-E by specifying its token ID.
  • Whitelisted Gene scientists can evolve an existing SPARC-E which will update its number of genes to any specified value.
  • Whitelisted Markets can toggle a newly-born SPARC-E NFT to false at any time.
  • The above functionality must be enabled by the team in the SPARCEManagerCustomizable contract in order for each transaction to successfully occur.
  • The deployer will be set as a Whitelist Setter address upon deployment.
  • The Whitelist Setter can update the Spawning Manager, Retirement Manager, and Gene Manager addresses at any time.
  • The Whitelist Setter can add/remove addresses as a Whitelist spawner at any time.
  • The Whitelist Setter can add/remove addresses as a Whitelist Bye-Sayer at any time.
  • The Whitelist Setter can add/remove addresses as a Whitelist Gene Scientist at any time.
  • The Whitelist Setter can add/remove addresses as a Whitelist Market at any time.
  • The owner can update the contract's Base URI at any time.
SPARCEManagerCustomizable Contract:
  • This contract can be used by the team to interact with the SPARCECore contract.
  • The owner can enable/disable all of the spawning, rebirthing, retirement, transfers, and evolvement functionality at any time.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control The team retains the ownership controls listed above. PASS
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

SPARCECore Contract

Smart Contract Audit - Inheritance

Smart Contract Audit - Graph


 ($) = 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

 + [Int] IERC2981 
    - [Ext] royaltyInfo

 + [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 #
    - [Prv] _checkOnERC721Received #
    - [Int] _beforeTokenTransfer #

 + [Int] SPARCESpawningManager 
    - [Ext] isSpawningAllowed
    - [Ext] isRebirthAllowed

 + [Int] SPARCERetirementManager 
    - [Ext] isRetirementAllowed

 + [Int] SPARCEMarketplaceManager 
    - [Ext] isTransferAllowed

 + [Int] SPARCEGeneManager 
    - [Ext] isEvolvementAllowed

 +  SPARCEDependency 
    - [Pub]  #
    - [Ext] setWhitelistSetter #
       - modifiers: onlyWhitelistSetter
    - [Ext] setSpawningManager #
       - modifiers: onlyWhitelistSetter
    - [Ext] setRetirementManager #
       - modifiers: onlyWhitelistSetter
    - [Ext] setGeneManager #
       - modifiers: onlyWhitelistSetter
    - [Ext] setSpawner #
       - modifiers: onlyWhitelistSetter
    - [Ext] setByeSayer #
       - modifiers: onlyWhitelistSetter
    - [Ext] setGeneScientist #
       - modifiers: onlyWhitelistSetter
    - [Ext] setMarkets #
       - modifiers: onlyWhitelistSetter

 +  SPARCECore (ERC721, SPARCEDependency)
    - [Pub]  #
       - modifiers: ERC721
    - [Ext] setBaseURI #
       - modifiers: onlyOwner
    - [Ext] UpdateNewBornSparce #
       - modifiers: onlyMarkets
    - [Ext] getSparce
       - modifiers: mustBeValidToken
    - [Ext] spawnSparce #
       - modifiers: onlySpawner,whenSpawningAllowed
    - [Ext] spawnMultipleSparce #
       - modifiers: onlySpawner
    - [Ext] rebirthSparce #
       - modifiers: onlySpawner,mustBeValidToken,whenRebirthAllowed
    - [Ext] retireSparce #
       - modifiers: onlyByeSayer,whenRetirementAllowed
    - [Ext] evolveSparce #
       - modifiers: onlyGeneScientist,mustBeValidToken,whenEvolvementAllowed
    - [Prv] _spawnSparce #

SPARCEManagerCustomizable Contract

Smart Contract Audit - Inheritance

Smart Contract Audit - Graph


 ($) = 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
    - [Prv] _setOwner #

 + [Int] SPARCESpawningManager 
    - [Ext] isSpawningAllowed
    - [Ext] isRebirthAllowed

 + [Int] SPARCERetirementManager 
    - [Ext] isRetirementAllowed

 + [Int] SPARCEMarketplaceManager 
    - [Ext] isTransferAllowed

 + [Int] SPARCEGeneManager 
    - [Ext] isEvolvementAllowed

 +  SPARCEManagerCustomizable (SPARCESpawningManager, SPARCERetirementManager, SPARCEMarketplaceManager, SPARCEGeneManager, Ownable)
    - [Ext] setAllowAll #
       - modifiers: onlyOwner
    - [Ext] isSpawningAllowed
    - [Ext] isRebirthAllowed
    - [Ext] isRetirementAllowed
    - [Ext] isTransferAllowed
    - [Ext] isEvolvementAllowed

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.