Pong Heroes
Smart Contract Audit Report
Audit Summary
Pong Heroes is a new series of NFTs with an additional staking contract.
For this audit, we reviewed the project team's PongHeroNFTV1 and PongHeroPetsV1 contracts at commit ce69073e1f90fe14f6c22d78d902d877791e32f7 and Staking contract at commit 79ca0eb76c43b2dbac5c8de9fc1f36fa5b6b22ab on the team's GitHub repositories.
Audit Findings
All findings have been resolved, though some centralized aspects are present.
Date: September 14th, 2022.
Updated: November 3nd, 2022 to resolve the findings, include revisions on the PongHeroNFTV1 and PongHeroPetsV1 contracts from commit a9a1a2bfb77fccf39995932d69a3a1652a5a167f to commit ce69073e1f90fe14f6c22d78d902d877791e32f7, and include revisions on the Staking contract from commit 9ca8fcec2a649e4f2289b0ab1a4eb7116333b8c4 to commit 79ca0eb76c43b2dbac5c8de9fc1f36fa5b6b22ab.Finding #1 - Staking - High (Resolved)
Description: The owner may withdraw all of the specified staking tokens.
Risk/Impact: The owner has the ability to withdraw users' staked tokens without their approval.
Recommendation: The team should remove this functionality. Users have the ability to migrate their own funds if needed.
Resolution: The team has removed the function to withdraw users' staked tokens.
Finding #2 - PongHeroNFTV1 & PongHeroPetsV1 - Low (Resolved)
Description: The mint fee is not set in the constructor.
Risk/Impact: It is possible for a mint to occur before the call to updateMintFee() is made, allowing for a zero cost mint.
Recommendation: The team should consider setting this value in the constructor so an explicit call to updateMintFee() is not needed after deployment.
Resolution: The team has implemented the above recommendation.
Contracts Overview
PongHeroPetsV1 & PongHeroNFTV1 Contracts:
- As the contracts are implemented with Solidity v0.8.0, they are safe from any possible overflows/underflows.
- The team must exercise caution when assigning the staking token to avoid using fee-on-transfer tokens.
Staking Contract:
- These contracts are ERC721A implementations of NFTs.
- The max supply of PongHeroPets NFTs is capped at 10,000 and the max supply of PongHeroNFTV1 NFTs is capped at 3,999.
- Users must pay the "mint fee" in the blockchain's native token to mint an NFT.
- Users may only mint 1 NFT at a time.
- Users have the option to bulk transfer up to 400 NFTs to a single address or a number of specified addresses.
- The owner may set the mint fee to any value at any time.
- The owner may pause the contract, preventing minting, at any time.
- The owner may update the Treasury address and URI at any time.
- The owner may withdraw the contract balance to the Treasury address at any time.
- The contract complies with the ERC721 standard and ERC2981 Royalties standard.
- This contract is used to distribute a specified rewards coin to users who stake the same coin into various pools.
- Users will receive a reward amount on each block based on the amount staked and the pool's APY.
- Users may claim their rewards once the pool's "lock time" has passed from their last deposit.
- Each pool has its own lock time and may vary between pools.
- The owner must supply rewards to the contract through the "fund" functionality or they will not be properly counted as rewards.
- The contract properly maintains a separate balance from rewards and users funds to prevent a rewards claim from taking another user's funds.
- Users may elect to compound their rewards rather than claim them.
- Compounding will add a user's pending rewards to their deposited balance.
- Users may emergency withdraw given that the pool's lock time has not passed.
- An emergency withdraw will transfer the users their deposited coins without rewards after taking a fee that is stored in the contract.
- Each pool has its own fee and may vary between pools.
- The owner may add a new pool at any time.
- The owner may update a pool's lock time, APY, and withdraw fee to any values at any time.
- The owner may add all collected fees to the reward amount at any time.
- The owner may withdraw all collected fees at any time.
- The owner may withdraw all of the specified coin from the contract at any time.
Audit Results
Vulnerability Category | Notes | Result |
---|---|---|
Arbitrary Jump/Storage Write | N/A | PASS |
Centralization of Control |
|
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 |
Unbounded Loops | N/A | PASS |
Unused Code | N/A | PASS |
Overall Contract Safety | WARNING |
PongHeroNFTV1 Contract
($) = payable function
# = non-constant function
Int = Internal
Ext = External
Pub = Public
+ [Int] IERC165Upgradeable
- [Ext] supportsInterface
+ [Int] IERC721Upgradeable (IERC165Upgradeable)
- [Ext] balanceOf
- [Ext] ownerOf
- [Ext] safeTransferFrom #
- [Ext] safeTransferFrom #
- [Ext] transferFrom #
- [Ext] approve #
- [Ext] setApprovalForAll #
- [Ext] getApproved
- [Ext] isApprovedForAll
+ [Int] IERC721Receiver
- [Ext] onERC721Received #
+ [Int] IERC721MetadataUpgradeable (IERC721Upgradeable)
- [Ext] name
- [Ext] symbol
- [Ext] tokenURI
+ [Lib] AddressUpgradeable
- [Int] isContract
- [Int] sendValue #
- [Int] functionCall #
- [Int] functionCall #
- [Int] functionCallWithValue #
- [Int] functionCallWithValue #
- [Int] functionStaticCall
- [Int] functionStaticCall
- [Int] verifyCallResult
+ Initializable
- [Int] _disableInitializers #
+ ContextUpgradeable (Initializable)
- [Int] __Context_init #
- modifiers: onlyInitializing
- [Int] __Context_init_unchained #
- modifiers: onlyInitializing
- [Int] _msgSender
- [Int] _msgData
+ [Lib] StringsUpgradeable
- [Int] toString
- [Int] toHexString
- [Int] toHexString
- [Int] toHexString
+ ERC165Upgradeable (Initializable, IERC165Upgradeable)
- [Int] __ERC165_init #
- modifiers: onlyInitializing
- [Int] __ERC165_init_unchained #
- modifiers: onlyInitializing
- [Pub] supportsInterface
+ [Int] IERC2981Royalties
- [Ext] royaltyInfo
+ ERC2981PerTokenRoyalties (ERC165Upgradeable, IERC2981Royalties)
- [Int] _setTokenRoyalty #
- [Ext] royaltyInfo
+ ERC721A (Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable, ERC2981PerTokenRoyalties)
- [Pub] _init #
- modifiers: initializer
- [Int] _startTokenId
- [Pub] totalSupply
- [Int] _totalMinted
- [Pub] supportsInterface
- [Pub] balanceOf
- [Int] _numberMinted
- [Int] _numberBurned
- [Int] _getAux
- [Int] _setAux #
- [Int] _ownershipOf
- [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] _exists
- [Int] _safeMint #
- [Int] _safeMint #
- [Int] _mint #
- [Prv] _transfer #
- [Int] _burn #
- [Int] _burn #
- [Prv] _approve #
- [Prv] _checkContractOnERC721Received #
- [Int] _beforeTokenTransfers #
- [Int] _afterTokenTransfers #
+ PongHeroNFTV1 (Initializable, ERC721A)
- [Pub] Constructor #
- [Ext] togglePause #
- modifiers: onlyOwner
- [Ext] updateMintFee #
- modifiers: onlyOwner
- [Ext] transferOwnership #
- modifiers: onlyOwner
- [Ext] updateTreasury #
- modifiers: onlyOwner
- [Ext] updateMainURI #
- modifiers: onlyOwner
- [Pub] mint ($)
- [Ext] withdrawTreasury #
- modifiers: onlyOwner
- [Pub] bulkTransfer #
- [Pub] multiSendTokens #
- [Ext] baseURI
- [Ext] pause
- [Ext] mintFee
- [Ext] treasuryWallet
- [Ext] maxSupply
- [Pub] tokenURI
PongHeroPetsV1 Contract
($) = payable function
# = non-constant function
Int = Internal
Ext = External
Pub = Public
+ [Int] IERC165Upgradeable
- [Ext] supportsInterface
+ [Int] IERC721Upgradeable (IERC165Upgradeable)
- [Ext] balanceOf
- [Ext] ownerOf
- [Ext] safeTransferFrom #
- [Ext] safeTransferFrom #
- [Ext] transferFrom #
- [Ext] approve #
- [Ext] setApprovalForAll #
- [Ext] getApproved
- [Ext] isApprovedForAll
+ [Int] IERC721Receiver
- [Ext] onERC721Received #
+ [Int] IERC721MetadataUpgradeable (IERC721Upgradeable)
- [Ext] name
- [Ext] symbol
- [Ext] tokenURI
+ [Lib] AddressUpgradeable
- [Int] isContract
- [Int] sendValue #
- [Int] functionCall #
- [Int] functionCall #
- [Int] functionCallWithValue #
- [Int] functionCallWithValue #
- [Int] functionStaticCall
- [Int] functionStaticCall
- [Int] verifyCallResult
+ Initializable
- [Int] _disableInitializers #
+ ContextUpgradeable (Initializable)
- [Int] __Context_init #
- modifiers: onlyInitializing
- [Int] __Context_init_unchained #
- modifiers: onlyInitializing
- [Int] _msgSender
- [Int] _msgData
+ [Lib] StringsUpgradeable
- [Int] toString
- [Int] toHexString
- [Int] toHexString
- [Int] toHexString
+ ERC165Upgradeable (Initializable, IERC165Upgradeable)
- [Int] __ERC165_init #
- modifiers: onlyInitializing
- [Int] __ERC165_init_unchained #
- modifiers: onlyInitializing
- [Pub] supportsInterface
+ [Int] IERC2981Royalties
- [Ext] royaltyInfo
+ ERC2981PerTokenRoyalties (ERC165Upgradeable, IERC2981Royalties)
- [Int] _setTokenRoyalty #
- [Ext] royaltyInfo
+ ERC721A (Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable, ERC2981PerTokenRoyalties)
- [Pub] _init #
- modifiers: initializer
- [Int] _startTokenId
- [Pub] totalSupply
- [Int] _totalMinted
- [Pub] supportsInterface
- [Pub] balanceOf
- [Int] _numberMinted
- [Int] _numberBurned
- [Int] _getAux
- [Int] _setAux #
- [Int] _ownershipOf
- [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] _exists
- [Int] _safeMint #
- [Int] _safeMint #
- [Int] _mint #
- [Prv] _transfer #
- [Int] _burn #
- [Int] _burn #
- [Prv] _approve #
- [Prv] _checkContractOnERC721Received #
- [Int] _beforeTokenTransfers #
- [Int] _afterTokenTransfers #
+ PongHeroPetsV1 (Initializable, ERC721A)
- [Pub] Constructor #
- [Ext] togglePause #
- modifiers: onlyOwner
- [Ext] updateMintFee #
- modifiers: onlyOwner
- [Ext] transferOwnership #
- modifiers: onlyOwner
- [Ext] updateTreasury #
- modifiers: onlyOwner
- [Ext] updateMainURI #
- modifiers: onlyOwner
- [Pub] mint ($)
- [Ext] withdrawTreasury #
- modifiers: onlyOwner
- [Pub] bulkTransfer #
- [Pub] multiSendTokens #
- [Ext] baseURI
- [Ext] pause
- [Ext] mintFee
- [Ext] treasuryWallet
- [Ext] maxSupply
- [Pub] tokenURI
Staking Contract
($) = payable function
# = non-constant function
Int = Internal
Ext = External
Pub = Public
+ [Int] IERC20
- [Ext] totalSupply
- [Ext] balanceOf
- [Ext] transfer #
- [Ext] allowance
- [Ext] approve #
- [Ext] transferFrom #
+ [Int] IERC20Permit
- [Ext] permit #
- [Ext] nonces
- [Ext] DOMAIN_SEPARATOR
+ [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 #
- [Int] safePermit #
- [Prv] _callOptionalReturn #
+ Context
- [Int] _msgSender
- [Int] _msgData
+ Ownable (Context)
- [Pub] Constructor #
- [Pub] owner
- [Int] _checkOwner
- [Pub] renounceOwnership #
- modifiers: onlyOwner
- [Pub] transferOwnership #
- modifiers: onlyOwner
- [Int] _transferOwnership #
+ Staking (Ownable)
- [Pub] Constructor #
- [Ext] poolLength
- [Ext] fund #
- modifiers: onlyOwner
- [Ext] add #
- modifiers: onlyOwner
- [Ext] updatePool #
- modifiers: onlyOwner
- [Ext] deposited
- [Ext] pending
- [Ext] claimReward #
- [Ext] compound #
- [Ext] deposit #
- [Ext] withdraw #
- [Ext] emergencyWithdraw #
- [Ext] getWithdrawFeeAmount
- [Ext] addWithdrawFeeToRewards #
- modifiers: onlyOwner
- [Ext] withdrawFeeAmount #
- modifiers: onlyOwner
- [Ext] withdrawRewards #
- modifiers: onlyOwner
- [Ext] withdrawFunds #
- modifiers: onlyOwner
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.