HXPE Presale

Smart Contract Audit Report

Audit Summary

HXPE Presale Audit Report Hollywood X PEPE is building a new Presale platform for their HXPE token.

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

Audit Findings

An Informational finding was identified and the team may want to review them.
Date: May 26th, 2023.

Finding #1 - HXPEPresale - Informational

Description: Although the SafeMath library is utilized, the contract is implemented with Solidity v0.8.x which has built-in overflow/underflow checks.
Recommendation: SafeMath could be safely removed to reduce contract size, deployment costs, and gas costs on all transactions that utilize it.

Contract Overview

  • This contract is used to facilitate a presale for the HXPE token.
  • The owner can initially set the sale token address, total number of tokens for sale, rate, and status of the presale at any time.
  • The specified total number of tokens for sale are transferred from the owner to the contract.
  • The owner can add tokens that can be used as payment in the presale, specifying their respective price rates at any time.
  • Any user can initiate a purchase while the presale is active by either specifying an amount of an approved payment token or providing an amount of ETH.
  • If the payment is with an approved token, a number of HXPE tokens are calculated based on the price rate associated with the token.
  • 40% of the provided payment tokens are transferred from the caller to the LP address set by the team.
  • The remaining 60% of the tokens are transferred from the caller to the owner.
  • The caller must grant this contract a sufficient allowance in order for the transfers to successfully occur.
  • If the payment is with ETH, a number of HXPE tokens are calculated based on the contract's price rate.
  • 40% of the provided ETH is transferred from the contract to the LP address set by the team.
  • The remaining 60% of the ETH is transferred from the contract to the owner.
  • The total number of purchased tokens must not exceed the total number of tokens allocated to the presale by the team.
  • Users can manually claim the full number of tokens due to them at any time when the presale has been set to inactive by the team.
  • The owner can elect to unlock all tokens while the presale is inactive, which will send the full number of purchased tokens to each user that initiated a purchase. A 'for loop' is used to transfer tokens to each buyer that has not yet claimed their tokens. If the number of buyers is currently too large, the transaction risks failure due to exceeding the block gas limit.
  • The owner can withdraw all of the sale tokens from the contract at any time while the presale is inactive.
  • The owner can set the presale to active/inactive at any time.
  • The owner can add/remove addresses that can be used as payment in the presale at any time.
  • The owner can update the contract's rate and the price rate associated with a payment token at any time.
  • The owner can update the LP address at any time.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control The owner can withdraw all of the sale tokens from the contract at any time while the presale is inactive. WARNING
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



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

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

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

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

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

 + [Int] IERC20Metadata (IERC20)
    - [Ext] name
    - [Ext] symbol
    - [Ext] decimals

 +  HXPEPresale (Ownable)
    - [Pub]  #
    - [Ext] setLPAddress #
       - modifiers: onlyOwner
    - [Ext] setSaleToken #
       - modifiers: onlyOwner
    - [Ext] stopSale #
       - modifiers: onlyOwner
    - [Ext] resumeSale #
       - modifiers: onlyOwner
    - [Ext] addPayableTokens #
       - modifiers: onlyOwner
    - [Ext] payableTokenStatus #
       - modifiers: onlyOwner
    - [Ext] updateTokenRate #
       - modifiers: onlyOwner
    - [Pub] getTokenAmount
    - [Prv] transferETH #
    - [Prv] transferToken #
    - [Ext] buyHXPE ($)
       - modifiers: saleEnabled
    - [Ext] withdrawHXPE #
       - modifiers: saleStoped
    - [Ext] unlockAllTokens #
       - modifiers: onlyOwner,saleStoped
    - [Ext] withdrawAllSaleTokens #
       - modifiers: onlyOwner,saleStoped

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 1300+ 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 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.