EndersgateNFT

Smart Contract Audit Report

Audit Summary

Endersgate Audit Report Endersgate is a new NFT collection where users use can claim and exchange NFTs.

For this audit, we reviewed the following contracts on the team's GitHub repository:

Audit Findings

Please ensure trust in the team prior to investing as they have some control in the ecosystem.
Date: March 22nd, 2022.
Updated: April 1st, 2022 to address changes made to the EndersPack contract as well as add the ExchangeERC1155 and EndersGate contracts to the audit scope.
Updated April 6th, 2022 to address changes made to the EndersPack contract.

Finding #1 - EndersPack - High (Resolved)

Description: Contracts are permitted to call the unpack() function.
Risk/Impact: A malicious contract can be used to revert any Endersgate NFT unpacking that does not result in a favorable bonus NFT type, negating any intended randomness functionality. The contract could use this to extract more valuable or preferred bonus NFT types from NFT unpacking and leave other users with the less valuable or unpreferred rewards.
Recommendation: The team should disallow contracts from calling the unpack() function or alternatively, redesign the unpacking mechanism to leverage chainlink for a secure source of randomness.
Resolution: The team has implemented logic so that contracts cannot call the unpack() function.

Finding #2 - EndersPack - Informational (Partially Resolved)

Description: Several functions are declared public, but are never called internally.
EndersPack.setState, EndersPack.setOptionSettings, EndersPack.setTokensForTypes, EndersPack.mint, EndersPack.mintBatch, EndersPack.setURI, EndersPack.setContractURI, EndersPack.setIpfsHashBatch, EndersGate.set, URIEndersGate.setContract, URIEndersGate.mint, EndersGate.mintBatch, EndersGate.totalSupplyBatch, EndersGate.setIpfsHashBatch, ExchangeERC1155.exchangeAllERC1155, ExchangeERC1155.safeWithdrawal, ExchangeERC1155.updateNftsToId, 
Recommendation: We recommend declaring these functions external for additional gas savings on each call.
Resolution: The team has declared some functions external.

Contract Overview

  • As the contract is developed with Solidity 0.8.x, it is protected from overflow/underflow attacks.
EndersPack Contract:
  • This contract enables the team to distribute EndersPack NFTs to users, which are used to claim reward NFTs from the _factoryAddress contract. The _factoryAddress contract is not within the scope of this audit, so we are unable to provide an assessment of the contract with regards to security.
  • All EndersPack NFTs belong to an NFT option group; each NFT option group contains specified NFT option types.
  • Users can unpack their Endersgate NFTs in order to be minted the base amount of each NFT option type within their EndersPack NFT option group; EndersPack NFTs are burned once used to claim a reward NFT.
  • Additionally, users are minted a pseudo-randomly selected bonus reward NFT as long as the EndersPack NFT's option group mint limit and the bonus NFT's option type limit have not been reached.
  • The previous block number, caller address, and seed value are used to determine the pseudo-randomly selected bonus NFT.

  • The owner can transfer ownership at any time.
  • The owner can mint EndersPack NFTs at any time.
  • The owner can change the _factoryAddress address, the number of NFT option groups, NFT option types within each option group, and seed value at any time.
  • The owner can change the NFT option group's mint limit, base amount, and NFT option type limit at any time.
  • The owner can change the token ID values corresponding to the NFT option types that are passed to the _factoryAddress contract.
  • The owner can set the contract URI and token URI prefix at any time
  • The owner can change all tokens' IPFS URL values at any time.
  • In the event that the address receiving an EndersPack NFT is a contract, the contract must have implemented the onERC1155Received() function in order to successfully receive the NFT.
  • ReentrancyGuard is utilized within the unpack() function to prevent re-entrancy attacks.
  • The contract complies with the ERC-1155 Multi-token standard.
EndersGate Contract:
  • This contract enables the team to distribute EndersGate NFTs to users.
  • On deployment, the owner is granted the Default Admin role, URI Setter role, and Minter role.
  • A mint function is present in the contract and can be utilized only by the Minter role to mint any amount of any token ID to specified addresses, increasing the total supply at any time.
  • Any user can burn their own tokens to reduce the total supply.
  • Additionally, users can burn tokens from other addresses up to the amount of allowance they've been granted, also reducing the total supply.

  • The URI Setter role can set the contracts token URI prefix and contract URI at any time.
  • The URI Setter role can change all tokens' IPFS URL value at any time.
  • The owner can grant and revoke each role to any address at any time.
  • The contract complies with the ERC-1155 Multi-token standard.
ExchangeERC1155 Contract:
  • This contract enables users to exchange NFTs from approved NFT collections for an equivalent amount of reward NFTs from an owner-defined contract address; the team should use caution as the approved NFT collection addresses and reward contract address are set on deployment and cannot be added to or changed.
  • The EndersGate contract is intended to be the reward contract address.
  • The collection address and ID of the NFT traded into the contract determines the NFT that the user receives from the reward contract address.
  • The owner can change which reward NFTs users receive for exchanged NFTs.
  • The owner can withdraw all NFTs within the contract at any time.
  • The owner can transfer ownership at any time.

Audit Results

Vulnerability CategoryNotesResult
Arbitrary Jump/Storage WriteN/APASS
Centralization of ControlThe team can mint EndersPack and EndersGate NFTs at any time.WARNING
Compiler IssuesN/APASS
Delegate Call to Untrusted ContractN/APASS
Dependence on Predictable VariablesA bonus reward NFT can be predicted as it is reliant on only the previous block.number, msg.sender, and the seed value; however, the likelihood of this along with its use for exploitation is very low.WARNING
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

EndersPack Contract

Smart Contract Audit - Inheritance

Smart Contract Audit - Graph


 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public
 
 +  ReentrancyGuard 
    - [Pub]  #

 + [Int] IERC165 
    - [Ext] supportsInterface

 + [Int] IERC1155 (IERC165)
    - [Ext] balanceOf
    - [Ext] balanceOfBatch
    - [Ext] setApprovalForAll #
    - [Ext] isApprovedForAll
    - [Ext] safeTransferFrom #
    - [Ext] safeBatchTransferFrom #

 + [Int] IERC1155Receiver (IERC165)
    - [Ext] onERC1155Received #
    - [Ext] onERC1155BatchReceived #

 + [Int] IERC1155MetadataURI (IERC1155)
    - [Ext] uri

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

 +  ERC165 (IERC165)
    - [Pub] supportsInterface

 +  ERC1155 (Context, ERC165, IERC1155, IERC1155MetadataURI)
    - [Pub]  #
    - [Pub] supportsInterface
    - [Pub] uri
    - [Pub] balanceOf
    - [Pub] balanceOfBatch
    - [Pub] setApprovalForAll #
    - [Pub] isApprovedForAll
    - [Pub] safeTransferFrom #
    - [Pub] safeBatchTransferFrom #
    - [Int] _safeTransferFrom #
    - [Int] _safeBatchTransferFrom #
    - [Int] _setURI #
    - [Int] _mint #
    - [Int] _mintBatch #
    - [Int] _burn #
    - [Int] _burnBatch #
    - [Int] _setApprovalForAll #
    - [Int] _beforeTokenTransfer #
    - [Prv] _doSafeTransferAcceptanceCheck #
    - [Prv] _doSafeBatchTransferAcceptanceCheck #
    - [Prv] _asSingletonArray

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

 +  ERC1155Receiver (ERC165, IERC1155Receiver)
    - [Pub] supportsInterface

 +  Factory 
    - [Ext] mint #
    - [Pub] balanceOf

 + [Lib] LootBoxRandomness 
    - [Pub] initState #
    - [Pub] setTokensForTypes #
    - [Pub] resetOption #
    - [Pub] setOptionSettings #
    - [Pub] setSeed #
    - [Int] _mint #
    - [Int] _sendTokensWithType #
    - [Int] _random #

 +  EndersPack (ERC1155, ReentrancyGuard, Ownable, ERC1155Receiver)
    - [Pub]  #
       - modifiers: ERC1155
    - [Pub] setState #
       - modifiers: onlyOwner
    - [Pub] setOptionSettings #
       - modifiers: onlyOwner
    - [Pub] setTokensForTypes #
       - modifiers: onlyOwner
    - [Ext] unpack #
       - modifiers: nonReentrant
    - [Pub] mint #
       - modifiers: onlyOwner
    - [Pub] mintBatch #
       - modifiers: onlyOwner
    - [Int] _mint #
    - [Ext] onERC1155Received #
    - [Ext] onERC1155BatchReceived #
    - [Pub] supportsInterface
    - [Pub] uri
    - [Pub] setURI #
       - modifiers: onlyOwner
    - [Pub] setContractURI #
       - modifiers: onlyOwner
    - [Pub] setIpfsHashBatch #
       - modifiers: onlyOwner
    - [Int] _setIpfsHashBatch #
    - [Ext]  #

EndersGate 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] IERC1155 (IERC165)
    - [Ext] balanceOf
    - [Ext] balanceOfBatch
    - [Ext] setApprovalForAll #
    - [Ext] isApprovedForAll
    - [Ext] safeTransferFrom #
    - [Ext] safeBatchTransferFrom #

 + [Int] IERC1155Receiver (IERC165)
    - [Ext] onERC1155Received #
    - [Ext] onERC1155BatchReceived #

 + [Int] IERC1155MetadataURI (IERC1155)
    - [Ext] uri

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

 +  ERC165 (IERC165)
    - [Pub] supportsInterface

 +  ERC1155 (Context, ERC165, IERC1155, IERC1155MetadataURI)
    - [Pub]  #
    - [Pub] supportsInterface
    - [Pub] uri
    - [Pub] balanceOf
    - [Pub] balanceOfBatch
    - [Pub] setApprovalForAll #
    - [Pub] isApprovedForAll
    - [Pub] safeTransferFrom #
    - [Pub] safeBatchTransferFrom #
    - [Int] _safeTransferFrom #
    - [Int] _safeBatchTransferFrom #
    - [Int] _setURI #
    - [Int] _mint #
    - [Int] _mintBatch #
    - [Int] _burn #
    - [Int] _burnBatch #
    - [Int] _setApprovalForAll #
    - [Int] _beforeTokenTransfer #
    - [Prv] _doSafeTransferAcceptanceCheck #
    - [Prv] _doSafeBatchTransferAcceptanceCheck #
    - [Prv] _asSingletonArray

 + [Int] IAccessControl 
    - [Ext] hasRole
    - [Ext] getRoleAdmin
    - [Ext] grantRole #
    - [Ext] revokeRole #
    - [Ext] renounceRole #

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

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

 +  ERC1155Burnable (ERC1155)
    - [Pub] burn #
    - [Pub] burnBatch #

 +  EndersGate (ERC1155, AccessControl, ERC1155Burnable)
    - [Pub]  #
       - modifiers: ERC1155
    - [Pub] setURI #
       - modifiers: onlyRole
    - [Pub] setContractURI #
       - modifiers: onlyRole
    - [Pub] mint #
       - modifiers: onlyRole
    - [Pub] mintBatch #
       - modifiers: onlyRole
    - [Pub] totalSupplyBatch
    - [Pub] supportsInterface
    - [Pub] uri
    - [Pub] setIpfsHashBatch #
       - modifiers: onlyRole
    - [Int] _setIpfsHashBatch #

ExchangeERC1155 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] IERC1155 (IERC165)
    - [Ext] balanceOf
    - [Ext] balanceOfBatch
    - [Ext] setApprovalForAll #
    - [Ext] isApprovedForAll
    - [Ext] safeTransferFrom #
    - [Ext] safeBatchTransferFrom #

 + [Int] IERC1155Receiver (IERC165)
    - [Ext] onERC1155Received #
    - [Ext] onERC1155BatchReceived #

 +  ERC165 (IERC165)
    - [Pub] supportsInterface

 +  ERC1155Receiver (ERC165, IERC1155Receiver)
    - [Pub] supportsInterface

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

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

 + [Int] IERC1155MetadataURI (IERC1155)
    - [Ext] uri

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

 +  ERC1155 (Context, ERC165, IERC1155, IERC1155MetadataURI)
    - [Pub]  #
    - [Pub] supportsInterface
    - [Pub] uri
    - [Pub] balanceOf
    - [Pub] balanceOfBatch
    - [Pub] setApprovalForAll #
    - [Pub] isApprovedForAll
    - [Pub] safeTransferFrom #
    - [Pub] safeBatchTransferFrom #
    - [Int] _safeTransferFrom #
    - [Int] _safeBatchTransferFrom #
    - [Int] _setURI #
    - [Int] _mint #
    - [Int] _mintBatch #
    - [Int] _burn #
    - [Int] _burnBatch #
    - [Int] _setApprovalForAll #
    - [Int] _beforeTokenTransfer #
    - [Prv] _doSafeTransferAcceptanceCheck #
    - [Prv] _doSafeBatchTransferAcceptanceCheck #
    - [Prv] _asSingletonArray

 + [Int] IAccessControl 
    - [Ext] hasRole
    - [Ext] getRoleAdmin
    - [Ext] grantRole #
    - [Ext] revokeRole #
    - [Ext] renounceRole #

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

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

 +  ERC1155Burnable (ERC1155)
    - [Pub] burn #
    - [Pub] burnBatch #

 +  EndersGate (ERC1155, AccessControl, ERC1155Burnable)
    - [Pub]  #
       - modifiers: ERC1155
    - [Pub] setURI #
       - modifiers: onlyRole
    - [Pub] setContractURI #
       - modifiers: onlyRole
    - [Pub] mint #
       - modifiers: onlyRole
    - [Pub] mintBatch #
       - modifiers: onlyRole
    - [Pub] totalSupplyBatch
    - [Pub] supportsInterface
    - [Pub] uri
    - [Pub] setIpfsHashBatch #
       - modifiers: onlyRole
    - [Int] _setIpfsHashBatch #

 +  ExchangeERC1155 (Ownable, ERC1155Receiver)
    - [Pub]  #
    - [Pub] exchangeAllERC1155 #
    - [Pub] safeWithdrawal #
       - modifiers: onlyOwner
    - [Pub] updateNftsToId #
       - modifiers: onlyOwner
    - [Int] _mintEquivalent #
    - [Ext] onERC1155Received #
       - modifiers: onlyExchange
    - [Ext] onERC1155BatchReceived #
       - modifiers: onlyExchange
    - [Ext]  #

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.