Q2 2026 Security & Compliance Report67 incidents, $764M in losses, 88% from operational failures.
Get the report →

Audit name:

[SCA] Gable Finance | Staking | Oct2023

Date:

Oct 31, 2023

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 express our gratitude to the Gable Finance team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.

Gable is a protocol creating the liquidity market on Radix DLT. Users can borrow funds without collateral in the form of flash loans, as well as earn staking rewards and interest earnings from supplying their tokens to the protocol.

titlecontent
PlatformRadix DLT
LanguageRust/Scrypto
TagsStaking, Flashloans
Timeline03/10/2023 - 01/11/2023
Methodologyhttps://hackenio.cc/sc_methodology→

    Review Scope

    Repositoryhttps://github.com/gable-finance/gable/tree/main/src/backend/scrypto/flashloan-pool/→
    Commitafeb0343533798020630fcf45432abce7580b7e8

    Audit Summary

    Total8.7/10
    Security Score

    10/10

    Test Coverage

    66.66%

    Code Quality Score

    10/10

    Documentation Quality Score

    10/10

    13Total Findings
    13Resolved
    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 Gable Finance
    Audited ByHacken
    Websitehttps://gable.finance/→
    Changelog10/10/2023 - Initial Review
    01/11/2023 - Second Review
    • Document

      Name
      Smart Contract Code Review and Security Analysis Report for Gable Finance
      Audited By
      Hacken
      Changelog
      10/10/2023 - Initial Review
      01/11/2023 - Second Review

    System Overview

    Gable is a protocol creating the liquidity market on Radix DLT. Users can borrow funds without collateral in the form of flash loans, as well as earn staking rewards and interest earnings from supplying their tokens to the protocol.

    Users that are staking XRD on the Gable validator receive liquid staking units (LSU tokens) that can be deposited in the flashloan pool to earn some interest.

    Borrowers that take loans repay it with some interest that is then split 50-50 between the users that deposited LSU and the smart contract owner.

    Privileged roles

    • The owner of the contract could perform multiple administrative changes, like changing interest rates, updating suppliers key value store, deposit and withdraw liquidity to the pool directly, depositing and withdrawing validator node ownership token, as well as perform unstaking and claiming operations.

    • The admin role can perform most of the owner’s actions, except from depositing and withdrawing liquidity and validator node ownership token.

    Executive Summary

    Documentation quality

    The total Documentation quality score is 10 out of 10.

    • Functional and technical requirements were provided.

    • Technical description and diagrams were provided.

    • The code implements complex calculations logic with small amounts of descriptions and requirements.

    Code quality

    The total Code quality score is 10 out of 10.

    • The development environment is configured.

    • The code is readable and easy to digest.

    • Most of the methods are described with appropriate comments.

    • Test cases are well described with requirements.

    Test coverage

    Code coverage of the project could not be directly calculated with common tools likely due to the lack of support for Scrypto. Nevertheless, taking into account the functional coverage and the number of tests available in the code repository, the tests cover approximately 66.66% of the codebase.

    • Deployment and basic user interactions are covered with tests.

    • Negative cases coverage is missed.

    • Interaction with validator and methods associated with these operation are not covered

    Security score

    Upon auditing, the code was found to contain 0 critical, 1 high, 2 medium, and 5 low severity issues. Out of these, 8 issues have been addressed and resolved, 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 8.7. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.

    Risks

    The smart contract could be upgraded and its functionality may be changed.

    Centralization and the owner's ability to withdraw the whole liquidity from the pool might be dangerous, if his wallet/badge will be compromised.

    Findings

    F-2023-0151Owner could withdraw more than he has deposited as owner_liquidity
    Status
    fixed
    Severity

    High
    F-2023-0153Missing validations in multiple calculations could lead to unexpected state
    Status
    fixed
    Severity

    Medium
    F-2023-0152Missing upper bound on interest rate change
    Status
    fixed
    Severity

    Medium
    F-2023-0158Test functions should be removed
    Status
    fixed
    Severity

    Low
    F-2023-0157Floating Language Version
    Status
    fixed
    Severity

    Low
    F-2023-0156Wrong limit for the size of box
    Status
    fixed
    Severity

    Low
    F-2023-0155Owner is able to unlock and update royalties for function calls
    Status
    fixed
    Severity

    Low
    F-2023-0154Macros used for debugging should not be used in production code
    Status
    fixed
    Severity

    Low
    I-2023-0042Former name is mentioned
    Status
    fixed
    Severity

    Observation
    I-2023-0041Suggestions for idiomatic code style
    Status
    fixed
    Severity

    Observation
    Code
    ―
    Title
    Status
    Severity
    F-2023-0151Owner could withdraw more than he has deposited as owner_liquidity
    fixed

    High
    F-2023-0153Missing validations in multiple calculations could lead to unexpected state
    fixed

    Medium
    F-2023-0152Missing upper bound on interest rate change
    fixed

    Medium
    F-2023-0158Test functions should be removed
    fixed

    Low
    F-2023-0157Floating Language Version
    fixed

    Low
    F-2023-0156Wrong limit for the size of box
    fixed

    Low
    F-2023-0155Owner is able to unlock and update royalties for function calls
    fixed

    Low
    F-2023-0154Macros used for debugging should not be used in production code
    fixed

    Low
    I-2023-0042Former name is mentioned
    fixed

    Observation
    I-2023-0041Suggestions for idiomatic code style
    fixed

    Observation
    1-10 of 13 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:

    Scope Details

    Repositoryhttps://github.com/gable-finance/gable/tree/main/src/backend/scrypto/flashloan-pool/→
    Commitafeb0343533798020630fcf45432abce7580b7e8
    WhitepaperProvided→
    RequirementsProvided→
    Technical RequirementsProvided→

    Contracts in Scope

    flashloan-pool
    src
    events.rs - flashloan-pool › src › events.rs
    lib.rs - flashloan-pool › src › lib.rs

    Disclaimer