Q1 2025 Web3 Security ReportAccess control failures led to $1.63 billion in losses
Discover report insights
  • Hacken
  • Audits
  • genie-swap
  • [SCA] Genie Swap / Farm / Dec2023
Genie Swap logo

Genie Swap

Audit name:

[SCA] Genie Swap / Farm / Dec2023

Date:

Jan 9, 2024

Table of Content

Introduction
Audit Summary
Document Information
System Overview
Executive Summary
Risks
Findings
Appendix 1. Severity Definitions
Appendix 2. Scope
Disclaimer

Want a comprehensive audit report like this?

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.

titlecontent
PlatformEVM
LanguageSolidity
TagsFarming,Staking
Timeline26.12.2023 - 08.01.2024
Methodologyhttps://hackenio.cc/sc_methodology

    Last Review Scope

    Repositoryhttps://github.com/Genieswap-com/simplified-farms-contracts
    Commit2fed0fdde983b6ec96592ec4d003cc33fd71540b

    Audit Summary

    Total10/10
    Security Score

    10/10

    Test Coverage

    100%

    Code Quality Score

    10/10

    Documentation Quality Score

    10/10

    10Total Findings
    10Resolved
    0Accepted
    0Mitigated

    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

    NameSmart Contract Code Review and Security Analysis Report for Genie Swap
    Audited ByKaan Caglan
    Approved ByPrzemyslaw Swiatowiec
    Websitehttps://genieswap.com/
    Changelog27/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
      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-0286Exploitable "extendLockTime" Function in Farming Contract
    fixed

    Critical
    F-2023-0287Exploitable Parameter Adjustment via "extendLockTime" in Yield Calculation
    fixed

    High
    F-2023-0308Cache State Variables
    fixed

    Observation
    F-2023-0285Inefficient Resource Usage in resetFarm Function
    fixed

    Observation
    F-2023-0284Owner Can Renounce Ownership
    fixed

    Observation
    F-2023-0283Avoid Using State Variables Directly in emit for Gas Efficiency
    fixed

    Observation
    F-2023-0282Storage Layout Optimization
    fixed

    Observation
    F-2023-0281Custom Errors in Solidity for Gas Efficiency
    fixed

    Observation
    F-2023-0280Revert String Size Optimization
    fixed

    Observation
    F-2023-0279Floating Pragma
    fixed

    Observation
    1-10 of 10 findings

    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:

    Contracts in Scope

    contracts
    Farm.sol - contracts/Farm.sol
    FarmFactory.sol - contracts/FarmFactory.sol

    Disclaimer