Introduction
We thank Genie Swap for allowing us to conduct a Smart Contract Security Assessment. This document outlines our methodology, limitations, and results of the security assessment.
GenieSwap is a farming protocol designed to allow users to open farms by locking in a specific farm token for a defined period.
title | content |
---|---|
Platform | EVM |
Language | Solidity |
Tags | Farming,Staking |
Timeline | 26.12.2023 - 08.01.2024 |
Methodology | https://hackenio.cc/sc_methodology→ |
Last Review Scope | |
---|---|
Repository | https://github.com/Genieswap-com/simplified-farms-contracts→ |
Commit | 2fed0fdde983b6ec96592ec4d003cc33fd71540b |
Last Review Scope
- Commit
- 2fed0fdde983b6ec96592ec4d003cc33fd71540b
Audit Summary
10/10
100%
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 Genie Swap |
Audited By | Kaan Caglan |
Approved By | Przemyslaw Swiatowiec |
Website | https://genieswap.com/→ |
Changelog | 27/12/2023 - Preliminary Report |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Genie Swap
- Audited By
- Kaan Caglan
- Approved By
- Przemyslaw Swiatowiec
- Website
- https://genieswap.com/→
- Changelog
- 27/12/2023 - Preliminary Report
System Overview
GenieSwap is a farming protocol designed to allow users to open farms by locking in a specific farm token (and optionally a platform token for boosts) for a defined period. It facilitates earning yields based on the lock time and amount, with an option to boost returns. The system consists of two main contracts: TimelockedFarm for managing individual farms and FarmFactory for deploying these farm contracts.
TimeLockedFarm - Manages the lifecycle of individual farms where users can lock tokens to earn yield. It allows for operations like opening, boosting, extending, and ending farms.
FarmFactory - Deploys new instances of the TimelockedFarm contract with unique configurations. It maintains a registry mapping farm tokens to their respective farm contracts.
Privileged roles
The owner of the contract can set parameters like minimum/maximum lock times, yield rates, and amounts.
The owner of the contract can pause the contract or withdraw remaining tokens.
Executive Summary
Documentation quality
The total Documentation Quality score is 10 out of 10.
Functional requirements are provided.
Technical description is provided.
Natspec is sufficient.
Code quality
The total Code Quality score is 10 out of 10.
The code follows the Solidity best practices.
The code is structured and readable.
Test coverage
Code coverage of the project is 100% (branch coverage).
All of the functionalities are covered by unit tests.
Security score
Upon auditing, it was found that the code contained 1 critical, 1 high, 0 medium, and 0 low severity issues. All the issues mentioned in the report were resolved, resulting in 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 10. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
No risks have been identified.
Findings
Code ― | Title | Status | Severity | |
---|---|---|---|---|
F-2023-0286 | Exploitable "extendLockTime" Function in Farming Contract | fixed | Critical | |
F-2023-0287 | Exploitable Parameter Adjustment via "extendLockTime" in Yield Calculation | fixed | High | |
F-2023-0308 | Cache State Variables | fixed | Observation | |
F-2023-0285 | Inefficient Resource Usage in resetFarm Function | fixed | Observation | |
F-2023-0284 | Owner Can Renounce Ownership | fixed | Observation | |
F-2023-0283 | Avoid Using State Variables Directly in emit for Gas Efficiency | fixed | Observation | |
F-2023-0282 | Storage Layout Optimization | fixed | Observation | |
F-2023-0281 | Custom Errors in Solidity for Gas Efficiency | fixed | Observation | |
F-2023-0280 | Revert String Size Optimization | fixed | Observation | |
F-2023-0279 | Floating Pragma | fixed | Observation |
Identify vulnerabilities in your smart contracts.
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/Genieswap-com/simplified-farms-contracts→ |
Commit | 926a0dac1e9dea07e886cb891d5a43f9d4213fb4 |
Whitepaper | Not provided |
Requirements | https://github.com/Genieswap-com/simplified-farms-contracts/docs→ |
Technical Requirements | https://github.com/Genieswap-com/simplified-farms-contracts/docs→ |
Scope Details
- Commit
- 926a0dac1e9dea07e886cb891d5a43f9d4213fb4
- Whitepaper
- Not provided
- Technical Requirements
- https://github.com/Genieswap-com/simplified-farms-contracts/docs→