Grapes Presale

Smart Contract Audit Report

Audit Summary

Grapes Presale Audit Report Grapes is building a new Presale platform where users can initiate purchases.

For this audit, we reviewed the project team's GrapePreSale contract at 0x9dbd0ffd43a3d440cec5eb76c3dc02b9eea56912 on the Ethereum Mainnet.

Audit Findings

No findings were identified.
Date: November 20th, 2023.
Updated: November 28th, 2023 to reflect the changes made to the contract from commit 0b40f37da5acbc160530f5bc383c0d70ab17737e to commit 887ae31927483787f59a29c4238b39d5f85ff65a.
Updated: January 8th, 2024 to reflect the contract's mainnet address.

Contract Overview

  • The team will set the Grape NFT address, merkle root, and details of the presale upon deployment.
  • Any user can initiate a referral purchase while the referral sale is active by specifying a referral code hash and providing an amount of ETH for the purchase.
  • The specified amount of ETH must exceed the minimum amount set by the team upon deployment.
  • The contract uses an off-chain generated Merkle tree provided by the owner to store and verify referral codes that are valid for use. Referral codes are permitted to be reused.
  • The total amount of ETH used for referral purchases per user must not exceed the individual referral cap set by the team upon deployment.
  • The ETH provided by the caller is transferred to the team's Receiver wallet.
  • Any user can initiate a purchase while the NFT sale is active by specifying a list of NFT IDs and providing an amount of ETH for the purchase.
  • Each specified NFT is verified to ensure that the caller either owns the NFT or is an authorized delegate. The contract calls into V1 and V2 Delegate Registry contracts to retrieve the delegate status. These contracts are out of scope for this audit so our team are unable to provide an assessment with regard to their security.
  • The specified amount of ETH must exceed the minimum value set by the team upon deployment.
  • The total amount of ETH raised through NFT purchases must not exceed the NFT sale cap set by the team upon deployment.
  • The contract's ETH cap per NFT is enforced for each NFT ID. There must be a sufficient capacity for the specified NFTs to support the full amount of ETH provided by the caller.
  • The ETH provided by the caller is transferred to the team's Receiver wallet.
  • The functionality for claiming tokens in return for initiating purchases does not take place within this contract.
  • The owner can pause/unpause the contract at any time which prevents all purchases from being able to occur.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control The functionality for claiming tokens in return for initiating purchases does not take place within this contract. 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
Sybil Attack 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

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

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

 + [Lib] MerkleProof 
    - [Int] verify
    - [Int] verifyCalldata
    - [Int] processProof
    - [Int] processProofCalldata
    - [Int] multiProofVerify
    - [Int] multiProofVerifyCalldata
    - [Int] processMultiProof
    - [Int] processMultiProofCalldata
    - [Prv] _hashPair
    - [Prv] _efficientHash

 + [Lib] Math 
    - [Int] tryAdd
    - [Int] trySub
    - [Int] tryMul
    - [Int] tryDiv
    - [Int] tryMod
    - [Int] max
    - [Int] min
    - [Int] average
    - [Int] ceilDiv
    - [Int] mulDiv
    - [Int] mulDiv
    - [Int] sqrt
    - [Int] sqrt
    - [Int] log2
    - [Int] log2
    - [Int] log10
    - [Int] log10
    - [Int] log256
    - [Int] log256
    - [Int] unsignedRoundsUp

 +  Pausable (Context)
    - [Pub]  #
    - [Pub] paused
    - [Int] _requireNotPaused
    - [Int] _requirePaused
    - [Int] _pause #
       - modifiers: whenNotPaused
    - [Int] _unpause #
       - modifiers: whenPaused

 + [Int] IDelegateRegistry 
    - [Ext] multicall ($)
    - [Ext] delegateAll ($)
    - [Ext] delegateContract ($)
    - [Ext] delegateERC721 ($)
    - [Ext] delegateERC20 ($)
    - [Ext] delegateERC1155 ($)
    - [Ext] checkDelegateForAll
    - [Ext] checkDelegateForContract
    - [Ext] checkDelegateForERC721
    - [Ext] checkDelegateForERC20
    - [Ext] checkDelegateForERC1155
    - [Ext] getIncomingDelegations
    - [Ext] getOutgoingDelegations
    - [Ext] getIncomingDelegationHashes
    - [Ext] getOutgoingDelegationHashes
    - [Ext] getDelegationsFromHashes
    - [Ext] readSlot
    - [Ext] readSlots

 + [Int] IDelegationRegistry 
    - [Ext] delegateForAll #
    - [Ext] delegateForContract #
    - [Ext] delegateForToken #
    - [Ext] revokeAllDelegates #
    - [Ext] revokeDelegate #
    - [Ext] revokeSelf #
    - [Ext] getDelegationsByDelegate
    - [Ext] getDelegatesForAll
    - [Ext] getDelegatesForContract
    - [Ext] getDelegatesForToken
    - [Ext] getContractLevelDelegations
    - [Ext] getTokenLevelDelegations
    - [Ext] checkDelegateForAll
    - [Ext] checkDelegateForContract
    - [Ext] checkDelegateForToken

 +  GrapePreSale (Ownable, Pausable)
    - [Pub]  #
       - modifiers: Ownable
    - [Ext] buyWithNFTs ($)
       - modifiers: whenNotPaused,whenSaleOpened,checkMinimumSpend
    - [Ext] buyWithReferralCode ($)
       - modifiers: whenNotPaused,whenSaleOpened,checkMinimumSpend
    - [Pub] verifyReferralCode
    - [Ext] soldSupply
    - [Ext] pause #
       - modifiers: onlyOwner
    - [Ext] unpause #
       - modifiers: onlyOwner
    - [Int] _verifyTokenOwner

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.