Smart Contract Audit Report
FanFire is creating a new NFT marketplace in which users can buy and sell both ERC-721 and ERC-1155 tokens.
For this audit, we reviewed the project team's Marketplace contract at commit ff719f83a176b2876e8ec80524c6862f7ebc28ed on the team's GitHub repository.
Please ensure trust in the team prior to investing as they have substantial control in the ecosystem.
Date: May 17th, 2022.
Updated: May 19th, 2022 to reflect changes from commit 43c7975f70c5628699453e58297961846de0a531 to commit ff719f83a176b2876e8ec80524c6862f7ebc28ed.
Finding #1 - Marketplace - Informational (Resolved)Description: The list() function contains untrusted calls to a passed NFT contract which can lead to reentrancy.
Risk/Impact: Users may be able to create multiple listings for a single NFT.
Recommendation: The nonReentrant modifier should be added to the list() function or the beginning of the function should be updated to the following:Resolution: The team has implemented the above recommendation.
// check that the NFT not listed already require(!_isListed[nftAddress][tokenId], 'NFT already listed'); _isListed[nftAddress][tokenId] = true;
- Users can list ERC-721 or ERC-1155 tokens through this contract for a specified price and payment token.
- The specified payment token must be included in the list of accepted payment tokens.
- Only one of an ERC-1155 contract's token can be listed per token ID.
- If the token is ERC-2981 compliant, the royalty recipient and amount are set according to the token's royalty information.
- If not ERC-2981-compliant, the royalty recipient is set to the owner of the token contract (if one exists) with an amount of 0.
- If the token is ERC-2981 compliant and the contract's royalty settings have changed since listing, the royalty amount can be updated to the latest royalty information returned by the token contract.
- If the token is not ERC-2981 compliant and the royalty recipient is set, the recipient can update the royalty amount to any specified value. In this case, the Listing's price is adjusted based on the difference between the Listing's current royalty amount and the new royalty amount.
- Any user can remove a Listing if this contract no longer has approval for the token or if the seller no longer owns the token.
- When purchasing a Listing, payment is transferred from the buyer to this contract.
- The seller will then be "credited" payment tokens after the royalty fee and a "protocol fee" are both taken and credited to the royalty recipient and protocol wallet, respectively.
- The buyer will then be transferred the purchased token from the seller.
- Users that are credited tokens must withdraw them from the contract in order to receive them.
- The Reserver role has the ability to reserve a Listing for a specified reservee for up to 1 day.
- Only the reservee is permitted to buy the listed token during the reserved period.
- A seller can cancel their Listing at any time unless it has been reserved. A seller can bypass this reservation limitation by removing token approval of this contract and calling the unlistStale() function.
- Users should exercise caution and only purchase trusted NFT Listings.
- The owner can pause the contract at any time, disabling listing, buying, reserving, Listing cancellations, fund withdrawals, and royalty updates.
- The owner can add a new token to the accepted payment token list at any time.
- The team should exercise caution and not accept fee-on-transfer tokens as payment tokens unless the proper exemptions are made.
- The owner can update the protocol wallet at any time.
- The owner can update the protocol fee to any percentage at any time.
- As the contract is implemented with Solidity v0.8.x, it is safe from any possible overflows/underflows.
- ReentrancyGuard is utilized in applicable functions, protecting them from any potential reentrancy attacks.
|Arbitrary Jump/Storage Write||N/A||PASS|
|Centralization of Control||WARNING|
|Delegate Call to Untrusted Contract||N/A||PASS|
|Dependence on Predictable Variables||N/A||PASS|
|Improper Authorization Scheme||N/A||PASS|
|Outdated Compiler Version||N/A||PASS|
|Overall Contract Safety||PASS|
($) = payable function # = non-constant function + [Int] IERC165 - [Ext] supportsInterface + [Int] IERC721 (IERC165) - [Ext] balanceOf - [Ext] ownerOf - [Ext] safeTransferFrom # - [Ext] transferFrom # - [Ext] approve # - [Ext] getApproved - [Ext] setApprovalForAll # - [Ext] isApprovedForAll - [Ext] safeTransferFrom # + [Int] IERC20 - [Ext] totalSupply - [Ext] balanceOf - [Ext] transfer # - [Ext] allowance - [Ext] approve # - [Ext] transferFrom # + [Int] IERC1155 (IERC165) - [Ext] balanceOf - [Ext] balanceOfBatch - [Ext] setApprovalForAll # - [Ext] isApprovedForAll - [Ext] safeTransferFrom # - [Ext] safeBatchTransferFrom # + [Int] IERC2981 (IERC165) - [Ext] royaltyInfo + Context - [Int] _msgSender - [Int] _msgData + Pausable (Context) - [Pub]
# - [Pub] paused - [Int] _pause # - modifiers: whenNotPaused - [Int] _unpause # - modifiers: whenPaused + ReentrancyGuard - [Pub] # + [Lib] ERC165Checker - [Int] supportsERC165 - [Int] supportsInterface - [Int] getSupportedInterfaces - [Int] supportsAllInterfaces - [Prv] _supportsERC165Interface + Ownable (Context) - [Pub] # - [Pub] owner - [Pub] renounceOwnership # - modifiers: onlyOwner - [Pub] transferOwnership # - modifiers: onlyOwner - [Int] _transferOwnership # + [Lib] Strings - [Int] toString - [Int] toHexString - [Int] toHexString + [Int] IAccessControl - [Ext] hasRole - [Ext] getRoleAdmin - [Ext] grantRole # - [Ext] revokeRole # - [Ext] renounceRole # + ERC165 (IERC165) - [Pub] supportsInterface + 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 # + Storage (Ownable, AccessControl) + Marketplace (Storage, Pausable, ReentrancyGuard) - [Pub] list # - modifiers: whenNotPaused - [Pub] status - [Pub] unlistStale # - modifiers: whenNotPaused - [Pub] reserve # - modifiers: onlyRole,whenNotPaused - [Pub] buy # - modifiers: whenNotPaused,nonReentrant - [Pub] getReservedState - [Pub] unlist # - modifiers: whenNotPaused - [Prv] _unlist # - [Int] _setRoyalties # - modifiers: whenNotPaused - [Ext] getListingPointer - [Pub] addPaymentToken # - modifiers: onlyOwner - [Pub] changeProtocolWallet # - modifiers: onlyOwner - [Pub] changeProtocolFee # - modifiers: onlyOwner - [Ext] isListed - [Pub] isPaymentToken - [Pub] getBalance - [Pub] getListingByPointer - [Pub] getListing - [Ext] getAllListings - [Pub] getRoyalties - [Pub] updateRoyaltyAmount # - [Pub] pullFunds # - modifiers: whenNotPaused,nonReentrant - [Pub] pause # - modifiers: onlyOwner - [Pub] unpause # - modifiers: onlyOwner
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.