Apple PYE

Smart Contract Audit Report

Audit Summary

Apple PYE is a new BEP-20 token on the Binance Smart Chain.

For this audit, we reviewed the project team's Apple contract at 0x390deb8148397F04f59d99a224Da0e9365D5CB19 on the Binance Smart Chain Mainnet.

Audit Findings

Please ensure trust in the team prior to investing as they have substantial control in the ecosystem.
Date: March 14th, 2022.

Finding #1 - Apple - High

Description: Token transfers do not transfer delegates along with the token.
Risk/Impact: Delegatees will retain their votes even if a transfer occurs. This can result in additional votes being created through the use of transfers.
Recommendation: The _transfer() function should add the appropriate _moveDelegates() call.
Resolution: The team has not yet addressed this issue.

Finding #2 - Apple - Informational

Description: Several functions are declared public, but are never called internally.
transfer, transferFrom, setMarketingFee, setMarketingAddress, mint, burn
Recommendation: These functions should be declared external for additional gas savings on each call.

Contract Overview

  • The total supply of the token is currently ~10.1 million $APPLEPYE [10,099,367].
  • The contract utilizes a Burner role. The assigned addresses can burn any user's tokens without an approval to reduce the total supply.
  • The contract utilizes a Minter role. The assigned addresses can mint any number of tokens to any account at any time.
  • At the time of writing this report, there are 696 total token holders. The token allocation is as follows:
    • 80.79% of the total supply belongs to the CherryChefV2 contract. This contract was out of scope for the purpose of this audit.
    • 4.74% of the total supply belongs to the PYEChefV2 contract. This contract was out of scope for the purpose of this audit.
    • 3.95% of the total supply is in PYESwap liquidity.
    • Of that liquidity, 99.99% of the LP tokens belong to the PYEChefV2 contract.
    • 2.42% of the total supply belongs to the SmartChef contract. This contract was out of scope for the purpose of this audit.

  • The $APPLEPYE token is designed to be a governance token where one token represents one vote.
  • Users may delegate their votes to another address allowing them to vote on behalf of the user.
  • Once votes are delegated, the user must explicitly delegate back to themselves to regain their votes.
  • Users also have the option to delegate through the use of a signed message, allowing for a gasless delegation for the user.

  • There is a transfer fee charged on all token transfers. The tokens collected from the transfer fee are allocated to the team's Marketing wallet.
  • The contract utilizes a Fee Setter role. The assigned addresses can set the transfer fee to any percentage at any time.
  • The Fee Setter addresses can also update the team's Marketing wallet to any address at any time.
  • The contract utilizes the SafeMath library to protect from overflows/underflows.
  • The contract complies with the BEP-20 token standard.

Audit Results

Vulnerability CategoryNotesResult
Arbitrary Jump/Storage WriteN/APASS
Centralization of Control
  • The assigned Burner role addresses can burn any user's tokens without an approval.
  • The assigned Minter role addresses can mint any number of tokens at any time.
  • The team can set the transfer fee up to 100%.
  • FAIL
    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 IssuesToken transfers do not transfer delegates along with the token.FAIL
    Oracle IssuesN/APASS
    Outdated Compiler VersionN/APASS
    Race ConditionsN/APASS
    Signature IssuesN/APASS
    Unbounded LoopsN/APASS
    Unused CodeN/APASS
    Overall Contract Safety FAIL

    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] IBEP20 
        - [Ext] totalSupply
        - [Ext] decimals
        - [Ext] symbol
        - [Ext] name
        - [Ext] getOwner
        - [Ext] balanceOf
        - [Ext] transfer #
        - [Ext] allowance
        - [Ext] approve #
        - [Ext] transferFrom #
     + [Lib] EnumerableSet 
        - [Prv] _add #
        - [Prv] _remove #
        - [Prv] _contains
        - [Prv] _length
        - [Prv] _at
        - [Int] add #
        - [Int] remove #
        - [Int] contains
        - [Int] length
        - [Int] at
        - [Int] add #
        - [Int] remove #
        - [Int] contains
        - [Int] length
        - [Int] at
        - [Int] add #
        - [Int] remove #
        - [Int] contains
        - [Int] length
        - [Int] at
     + [Lib] Address 
        - [Int] isContract
        - [Int] sendValue #
        - [Int] functionCall #
        - [Int] functionCall #
        - [Int] functionCallWithValue #
        - [Int] functionCallWithValue #
        - [Int] functionStaticCall
        - [Int] functionStaticCall
        - [Int] functionDelegateCall #
        - [Int] functionDelegateCall #
        - [Prv] _verifyCallResult
     + [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
     +  Context 
        - [Int] _msgSender
        - [Int] _msgData
     +  AccessControl (Context)
        - [Pub] hasRole
        - [Pub] getRoleMemberCount
        - [Pub] getRoleMember
        - [Pub] getRoleAdmin
        - [Pub] grantRole #
        - [Pub] revokeRole #
        - [Pub] renounceRole #
        - [Int] _setupRole #
        - [Int] _setRoleAdmin #
        - [Prv] _grantRole #
        - [Prv] _revokeRole #
     +  Ownable (Context)
        - [Int]  #
        - [Pub] owner
        - [Pub] renounceOwnership #
           - modifiers: onlyOwner
        - [Pub] transferOwnership #
           - modifiers: onlyOwner
     +  BEP20 (Context, IBEP20, Ownable, AccessControl)
        - [Pub]  #
        - [Ext] getOwner
        - [Pub] name
        - [Pub] decimals
        - [Pub] symbol
        - [Pub] totalSupply
        - [Pub] balanceOf
        - [Pub] transfer #
        - [Pub] allowance
        - [Pub] approve #
        - [Pub] transferFrom #
        - [Pub] increaseAllowance #
        - [Pub] decreaseAllowance #
        - [Pub] mint #
        - [Int] _transfer #
        - [Int] _mint #
        - [Int] _burn #
        - [Int] _approve #
        - [Int] _burnFrom #
     +  Apple (BEP20)
        - [Pub]  #
           - modifiers: BEP20
        - [Pub] setMarketingFee #
        - [Pub] setMarketingAddress #
        - [Pub] transfer #
        - [Pub] transferFrom #
        - [Pub] mint #
        - [Pub] burn #
        - [Ext] delegates
        - [Ext] delegate #
        - [Ext] delegateBySig #
        - [Ext] getCurrentVotes
        - [Ext] getPriorVotes
        - [Int] _delegate #
        - [Int] _moveDelegates #
        - [Int] _writeCheckpoint #
        - [Int] safe32
        - [Int] getChainId

    About SourceHat

    SourceHat (formerly Solidity Finance - founded in 2020) has quickly grown to have one of the most experienced and well-equipped smart contract auditing teams in the industry. Our team has conducted 1700+ 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.