Introduction
We express our gratitude to the JuicyPerp team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
| title | content |
|---|---|
| Platform | EVM |
| Language | Solidity |
| Tags | ERC721, Marketplace |
| Timeline | 27/03/2024 - 09/04/2024 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | https://github.com/juicyperp/contracts→ |
| Commit | f0dc232490682dc1caec4d53fb988195ae4dcd63 |
Review Scope
- Repository
- https://github.com/juicyperp/contracts→
- Commit
- f0dc232490682dc1caec4d53fb988195ae4dcd63
Audit Summary
10/10
97.86%
10/10
10/10
The system users should acknowledge all the risks summed up in the risks section of the report
Document Information
This report may contain confidential information about IT systems and the intellectual property of the Customer, as well as information about potential vulnerabilities and methods of their exploitation.
The report can be disclosed publicly after prior consent by another Party. Any subsequent publication of this report shall be without mandatory consent.
Document | |
|---|---|
| Name | Smart Contract Code Review and Security Analysis Report for JuicyPerp |
| Audited By | Niccolò Pozzolini, Kornel Światłowski |
| Approved By | Przemyslaw Swiatowiec |
| Website | https://www.juicyperp.xyz/→ |
| Changelog | 03/04/2024 - Preliminary Report |
| 09/04/2024 - Second Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for JuicyPerp
- Audited By
- Niccolò Pozzolini, Kornel Światłowski
- Approved By
- Przemyslaw Swiatowiec
- Website
- https://www.juicyperp.xyz/→
- Changelog
- 03/04/2024 - Preliminary Report
- 09/04/2024 - Second Review
System Overview
JuicyPerp is a peer-to-pool based options protocol for NFT floor and other asset prices. It lets users speculate on the price development of various asset pairs in a digital option style, where users that make the correct prediction about the price development of the underlying asset win all the liquidity of the loosing side.
Privileged roles
The Pool.sol contract implements OpenZeppelin’s AccessControl.sol library and uses following roles:
SUPER_ADMIN: This role is the super administrator of the contract. He has authority over the OWNER role. This role belongs to a multi signature wallet that is set at contract deployment. The holder of this role is unable to renounce it and is immutable.
OWNER: This role is able to change critical workings of the contract, like changing fee structures, setting pool templates, and managing the POOL_CREATOR role.
POOL_CREATOR: Holders of this role are able to create custom battle pools.
WHITE_LISTER: Holders of this role can whitelist wallets to enter battles.
The Marketplace.sol contract implements OpenZeppelin’s AccessControl.sol library and uses following roles:
SUPERADMIN: This role is the super administrator of the contract. He has authority over the OWNER role. This role belongs to a multi signature wallet that is set at contract deployment. The holder of this role is unable to renounce it and is immutable. The SUPERADMIN has authority to set the treasury address of the contract.
OWNER: This role is able to change the fee structure of the marketplace.
The FloorPriceOracleMultisig.sol contract implements OpenZeppelin’s AccessControl.sol library and uses following roles:
SUPERADMIN: This role is the super administrator of the contract. He has authority over the SIGNER role. This role belongs to a multi signature wallet that is set at contract deployment. The holder of this role is unable to renounce it and is immutable. The SUPERADMIN is also able to set the number of required signatures that are needed for a price change to become effective in the oracle.
SIGNER: This role is able make oracle update suggestions and sign update suggestions other SIGNERS suggested.
The PricingRouter.sol contract implements OpenZeppelin’s AccessControl.sol library and uses following roles:
SUPER_ADMIN: This role is the super administrator of the contract. He has authority over the OWNER role. This role belongs to a multi signature wallet that is set at contract deployment. The holder of this role is unable to renounce it and is immutable.
OWNER: This role is able to change the routing from the pool contract to the oracle contracts.
Executive Summary
Documentation quality
The total Documentation Quality score is 10 out of 10.
Functional requirements are complete.
Technical description is provided.
Code quality
The total Code Quality score is 10 out of 10.
The development environment is configured.
Test coverage
Code coverage of the project is 97.86% (branch coverage).
Negative cases coverage is present.
Deployment and basic user interactions are covered with tests.
Security score
Upon auditing, the code was found to contain 0 critical, 0 high, 1 medium, and 2 low severity issues. After the remediation part of the audit process, all issues were fixed leading to a security score of 10 out of 10.
All identified issues are detailed in the “Findings” section of this report.
Summary
The comprehensive audit of the customer's smart contract yields an overall score of 9.9. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
Dependency on External Logic for Implemented Logic: The implemented Pyth oracle logic highly depends on external contracts not covered by the audit. This reliance introduces risks if these external contracts are compromised or contain vulnerabilities, affecting the audited project's integrity.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2024-1913 | Missing stale price check in getLatestPrice function | fixed | Medium | |
| F-2024-1942 | Overpermissive approval check in createListing function | fixed | Low | |
| F-2024-1912 | Missing bounds check in setRequiredSignatures function | fixed | Low | |
| F-2024-1974 | Checks-Effects-Interactions pattern violation | fixed | Observation | |
| F-2024-1946 | Contract name mismatch | fixed | Observation | |
| F-2024-1941 | Missing Zero Address Check in setTreasury Function | fixed | Observation | |
| F-2024-1940 | battleContract and poolContract should be declared as immutable in Marketplace.sol | fixed | Observation | |
| F-2024-1911 | Update event is missing the candidate index | fixed | Observation | |
| F-2024-1909 | Missing events in whitelist modification functions | fixed | Observation | |
| F-2024-1908 | Incorrect condition in returnFee function | fixed | Observation |
Appendix 1. Severity Definitions
When auditing smart contracts, Hacken is using a risk-based approach that considers Likelihood, Impact, Exploitability and Complexity metrics to evaluate findings and score severities.
Reference on how risk scoring is done is available through the repository in our Github organization:
Severity | Description |
|---|---|
Critical | Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation. |
High | High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation. |
Medium | Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category. |
Low | Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution, do not affect security score but can affect code quality score. |
Severity
- Critical
Description
- Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation.
Severity
- High
Description
- High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation.
Severity
- Medium
Description
- Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category.
Severity
- Low
Description
- Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution, do not affect security score but can affect code quality score.
Appendix 2. Scope
The scope of the project includes the following smart contracts from the provided repository:
Scope Details | |
|---|---|
| Repository | https://github.com/juicyperp/contracts→ |
| Commit | f0dc232490682dc1caec4d53fb988195ae4dcd63 |
| Whitepaper | https://www.juicyperp.xyz/JuicyPerp_Lightest_Paper_V1.pdf→ |
| Requirements | https://github.com/juicyperp/contracts/blob/main/docs/Requirements.pdf→ |
| Technical Requirements | https://github.com/juicyperp/contracts/blob/main/docs/Requirements.pdf→ |
Scope Details
- Repository
- https://github.com/juicyperp/contracts→
- Commit
- f0dc232490682dc1caec4d53fb988195ae4dcd63
- Technical Requirements
- https://github.com/juicyperp/contracts/blob/main/docs/Requirements.pdf→