Q1 2026 Security & Compliance Report44 incidents, $482M in losses, insights from 11 industry leaders.
Read the report

Audit name:

[SCA] Sweatco | Claim | Dec2023

Date:

Jan 19, 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 The Sweat Foundation Ltd. for allowing us to conduct a Smart Contract Security Assessment. This document outlines our methodology, limitations, and results of the security assessment.

Sweat Economy is a system that allows users to earn $SWEAT tokens by walking. The Sweatco Claim feature is an extension of the Sweat Wallet application, designed to provide users with a secure and controlled environment for their earned $SWEAT tokens.

titlecontent
PlatformNEAR Protocol
LanguageRust
TagsClaims
Timeline20.12.2023 - 18.01.2024
Methodologyhttps://hackenio.cc/sc_methodology

    Last Review Scope

    Repositoryhttps://github.com/sweatco/sweat-claim
    Commitffa3791f9e722b98736efdd2ca773c444eccd7cd

    Audit Summary

    Total9.2/10
    Security Score

    10/10

    Test Coverage

    88.79%

    Code Quality Score

    9/10

    Documentation Quality Score

    9/10

    4Total Findings
    4Resolved
    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 The Sweat Foundation Ltd.
    Audited ByNoah Jelich
    Approved ByNoah Jelich
    Websitesweatco.in
    Changelog29/12/2023. - Preliminary Report
    18/01/2024. - 2nd Review
    • Document

      Name
      Smart Contract Code Review and Security Analysis Report for The Sweat Foundation Ltd.
      Audited By
      Noah Jelich
      Approved By
      Noah Jelich
      Website
      sweatco.in
      Changelog
      29/12/2023. - Preliminary Report
      18/01/2024. - 2nd Review

    System Overview

    The claim feature is an extension of the Sweat Wallet application and aims to safely store the $SWEAT minted for a given users based on their steps provided by the Sweatcoin Oracle and converted to $SWEAT as per the token's minting curve .

    Prior to this "claim" feature, $SWEAT accrued from steps was calculated several times per day as determined by the Sweatcoin Oracle and $SWEAT was minted accordingly by the token.sweat contract and transferred to the given user's wallet address. The goal of the "claim" feature is to given the user more control over their $SWEAT earned from walking. This is accomplished by diverting minted $SWEAT to a new contract where it will accrue until a user claims it.

    The contract furthermore caters for edge cases in user behaviour which current places the Sweat economy at risk. E.g. If a user churns and disbands the project then there should be a mechanism to recover $SWEAT that was minted to a user's address but abandoned by the user. Currently this is impossible as Sweat Wallet is a self-custody thereby rendering complete control of funds to the user. Having a contract where minted $SWEAT accrues provides a degree of separation in terms of ownerships rights /control of minted $SWEAT. Sweat Wallet may therefore impose a condition that $SWEAT which is not claimed after a set amount of time may be burned from the claim contract. This will not only create a healthier economy (supply vs demand) but furthermore provide a method for maintaining an efficient contract size.

    Privileged roles

    • It Oracle role can perform token burns, a full reset of the system, set the burn and claim period, as well as record batches for holding.

    Executive Summary

    Documentation quality

    The total Documentation Quality score is 9 out of 10.

    • Functional requirements are provided.

    • Technical description is mostly provided.

      • Lower primitives are documented, but there is lacking documentation of top-level api functions.

    Code quality

    The total Code Quality score is 9 out of 10.

    • The code is well written and architected.

    • The development environment is configured.

    Test coverage

    Code coverage of the project is 88.79% (line coverage).

    • Coverage can be measured for the integration tests using wasmcov .

    Security score

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

    Risks

    The projest is built on a custom fork of near-sdk standard libraries, which are out of scope. While the changes are minimal, this represents a known unknown in potential behaviour.

    • near-sdk = { git = "https://github.com/sweatco/near-sdk-rs", rev = "8c48b26cc48d969c1e5f3162141fe9c824fccecd" }

    • near-contract-standards = { git = "https://github.com/sweatco/near-sdk-rs", rev = "8c48b26cc48d969c1e5f3162141fe9c824fccecd" }

    The project has large out-of-scope external dependencies that comprise a significant portion of functionality:

    • integration-trait = { git = "https://github.com/sweatco/integration-trait.git", rev = "83a69f7ba4acab9405bf935f7dfc70f2f5279c40" }

    • integration-utils = { git = "https://github.com/sweatco/integration-utils.git", rev = "0b3c2faf0db31cdb3481be4d35dbb48b62a98618" }

    • sweat-model = { git = "https://github.com/sweatco/sweat-near", rev = "82b5acf1c743d38191b996dc8eff3ac289e467d6" }

    • sweat-integration = { git = "https://github.com/sweatco/sweat-near", rev = "82b5acf1c743d38191b996dc8eff3ac289e467d6" }

    The Oracle role has high unregulated privileges in the system, including a full system reset.

    Findings

    Code
    Title
    Status
    Severity
    F-2023-0295Inconsistent Claim Availability Logic
    fixed

    Medium
    F-2023-0250Compilation Issues Due to Conflicting near-sdk Versions in Cargo.toml
    fixed

    Medium
    F-2023-0319Tests Can Be Excluded From Coverage Report
    fixed

    Observation
    F-2023-0249Outdated borsh library version in Cargo.toml
    fixed

    Observation
    1-4 of 4 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 (Initial Review)

    Repositoryhttps://github.com/sweatco/sweat-claim
    Commitffa3791f9e722b98736efdd2ca773c444eccd7cd
    Whitepaperhttps://drive.google.com/file/d/1IPklRcEQvgJkCaeYvGh43yjWl-Dj5_6i/view
    Requirements
    Technical Requirements

    Contracts in Scope (Initial Review)

    contract/src/lib.rs;3d128446bace506c36148e0e0eacb210cf2fc924db3b56b8de99a5425f9d6088
    contract/src/auth/api.rs;bb473cd72a84baf4515a6542ffe0d8eda56eed23dd4ec64184bb55dbb7d81fc6
    contract/src/auth/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad
    contract/src/burn/api.rs;c4f944d04011d9b3ba8e47e8c48cb4555b982680de97869d89a99aa8124294df
    contract/src/burn/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad
    contract/src/claim/api.rs;f0b6bff0b06bcb91ad8760d0a5e31510ea99a1470f93bd46b419bfabd840b990
    contract/src/claim/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad
    contract/src/clean/api.rs;c2345b3f8377f8cf2444f0105c28b77372a730b90a472cd42057eec17bd1868c
    contract/src/clean/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad
    contract/src/common/asserts.rs;c0bc54ca31e9779c16eda45a87f43746ff1a92fa722ecc910901f6768315a817
    contract/src/common/mod.rs;ff029b2e627d245a3cffe5f3bfee68b8f9b661844ef77018b01d3da5945f8db3
    contract/src/config/api.rs;1f04756c6bf9c86a60237764e3a0df9ab1cdef4620e1884a3af22cbc75a89807
    contract/src/config/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad
    contract/src/record/api.rs;247dbe9648c7a787efc4cf3dccfa1a64f468114c964ced455bc326b391ec4be4
    contract/src/record/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad
    model/src/account_record.rs;1f5c5d93a6572f7b14b5032e753459581cadceb7b147af5ac1c0fdfca2acb501
    model/src/api.rs;5128d613a50c2f2f4bfce6fec386cf30e5c9aad472452cfcc7af344205a11395
    model/src/event.rs;75b6a384457bed841ee9d08e6c522a2cb4df4e68babdcc397bc5c102a3ce0b7c; model/src/lib.rs;ee6123d7b1f9628961cecf2231ccbbd928c3b4bbf195485d2304971af323968e
    • Contracts in Scope (Initial Review)

      contract/src/lib.rs;3d128446bace506c36148e0e0eacb210cf2fc924db3b56b8de99a5425f9d6088

      Contracts in Scope (Initial Review)

      contract/src/auth/api.rs;bb473cd72a84baf4515a6542ffe0d8eda56eed23dd4ec64184bb55dbb7d81fc6

      Contracts in Scope (Initial Review)

      contract/src/auth/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad

      Contracts in Scope (Initial Review)

      contract/src/burn/api.rs;c4f944d04011d9b3ba8e47e8c48cb4555b982680de97869d89a99aa8124294df

      Contracts in Scope (Initial Review)

      contract/src/burn/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad

      Contracts in Scope (Initial Review)

      contract/src/claim/api.rs;f0b6bff0b06bcb91ad8760d0a5e31510ea99a1470f93bd46b419bfabd840b990

      Contracts in Scope (Initial Review)

      contract/src/claim/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad

      Contracts in Scope (Initial Review)

      contract/src/clean/api.rs;c2345b3f8377f8cf2444f0105c28b77372a730b90a472cd42057eec17bd1868c

      Contracts in Scope (Initial Review)

      contract/src/clean/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad

      Contracts in Scope (Initial Review)

      contract/src/common/asserts.rs;c0bc54ca31e9779c16eda45a87f43746ff1a92fa722ecc910901f6768315a817

      Contracts in Scope (Initial Review)

      contract/src/common/mod.rs;ff029b2e627d245a3cffe5f3bfee68b8f9b661844ef77018b01d3da5945f8db3

      Contracts in Scope (Initial Review)

      contract/src/config/api.rs;1f04756c6bf9c86a60237764e3a0df9ab1cdef4620e1884a3af22cbc75a89807

      Contracts in Scope (Initial Review)

      contract/src/config/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad

      Contracts in Scope (Initial Review)

      contract/src/record/api.rs;247dbe9648c7a787efc4cf3dccfa1a64f468114c964ced455bc326b391ec4be4

      Contracts in Scope (Initial Review)

      contract/src/record/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad

      Contracts in Scope (Initial Review)

      model/src/account_record.rs;1f5c5d93a6572f7b14b5032e753459581cadceb7b147af5ac1c0fdfca2acb501

      Contracts in Scope (Initial Review)

      model/src/api.rs;5128d613a50c2f2f4bfce6fec386cf30e5c9aad472452cfcc7af344205a11395

      Contracts in Scope (Initial Review)

      model/src/event.rs;75b6a384457bed841ee9d08e6c522a2cb4df4e68babdcc397bc5c102a3ce0b7c; model/src/lib.rs;ee6123d7b1f9628961cecf2231ccbbd928c3b4bbf195485d2304971af323968e

    Scope Details (2nd Review)

    Repositoryhttps://github.com/sweatco/sweat-claim
    Commitbf93665d86bb36dfab898e3788ebd5a1a09e52e6
    Whitepaperhttps://drive.google.com/file/d/1IPklRcEQvgJkCaeYvGh43yjWl-Dj5_6i/view
    Requirements
    Technical Requirements

    Contracts in Scope (2nd Review)

    contract/src/lib.rs;80cccb87d14e180ca675e6eeeb38fa3d617179b267dac1b6914c3c4edb656aae
    contract/src/auth/api.rs;bb473cd72a84baf4515a6542ffe0d8eda56eed23dd4ec64184bb55dbb7d81fc6
    contract/src/auth/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad
    contract/src/burn/api.rs;c4f944d04011d9b3ba8e47e8c48cb4555b982680de97869d89a99aa8124294df
    contract/src/burn/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad
    contract/src/claim/api.rs;40995b92ac6f4c2689832fa07bfcea50aa9efe3b145979641685c9afc1bc7a72
    contract/src/claim/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad
    contract/src/clean/api.rs;c2345b3f8377f8cf2444f0105c28b77372a730b90a472cd42057eec17bd1868c
    contract/src/clean/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad
    contract/src/common/asserts.rs;01273e5a47f5912b71c29f719ac5445b93dec124ce80a3c471bc885825cd4d31
    contract/src/common/mod.rs;56817bfae267249473eeb436089003b781293df5d5ae3a5cbde9a8ca36bf868f
    contract/src/config/api.rs;1f04756c6bf9c86a60237764e3a0df9ab1cdef4620e1884a3af22cbc75a89807
    contract/src/config/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad
    contract/src/record/api.rs;c2af3c6ab4d20230351b8bf367be3d2923091f417bc402f26d6846e9d766a0a5
    contract/src/record/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad
    model/src/account_record.rs;9ece8a9c8edfe96f0f1f9ec48ca8bd0eb437f28b9d31191b30ea103c50deea3b
    model/src/api.rs;5128d613a50c2f2f4bfce6fec386cf30e5c9aad472452cfcc7af344205a11395
    model/src/event.rs;75b6a384457bed841ee9d08e6c522a2cb4df4e68babdcc397bc5c102a3ce0b7c; model/src/lib.rs;5f54333c181704215e5212f16526abf7fb98e5cf3a6c10bf0d33fcbac82f939d
    • Contracts in Scope (2nd Review)

      contract/src/lib.rs;80cccb87d14e180ca675e6eeeb38fa3d617179b267dac1b6914c3c4edb656aae

      Contracts in Scope (2nd Review)

      contract/src/auth/api.rs;bb473cd72a84baf4515a6542ffe0d8eda56eed23dd4ec64184bb55dbb7d81fc6

      Contracts in Scope (2nd Review)

      contract/src/auth/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad

      Contracts in Scope (2nd Review)

      contract/src/burn/api.rs;c4f944d04011d9b3ba8e47e8c48cb4555b982680de97869d89a99aa8124294df

      Contracts in Scope (2nd Review)

      contract/src/burn/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad

      Contracts in Scope (2nd Review)

      contract/src/claim/api.rs;40995b92ac6f4c2689832fa07bfcea50aa9efe3b145979641685c9afc1bc7a72

      Contracts in Scope (2nd Review)

      contract/src/claim/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad

      Contracts in Scope (2nd Review)

      contract/src/clean/api.rs;c2345b3f8377f8cf2444f0105c28b77372a730b90a472cd42057eec17bd1868c

      Contracts in Scope (2nd Review)

      contract/src/clean/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad

      Contracts in Scope (2nd Review)

      contract/src/common/asserts.rs;01273e5a47f5912b71c29f719ac5445b93dec124ce80a3c471bc885825cd4d31

      Contracts in Scope (2nd Review)

      contract/src/common/mod.rs;56817bfae267249473eeb436089003b781293df5d5ae3a5cbde9a8ca36bf868f

      Contracts in Scope (2nd Review)

      contract/src/config/api.rs;1f04756c6bf9c86a60237764e3a0df9ab1cdef4620e1884a3af22cbc75a89807

      Contracts in Scope (2nd Review)

      contract/src/config/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad

      Contracts in Scope (2nd Review)

      contract/src/record/api.rs;c2af3c6ab4d20230351b8bf367be3d2923091f417bc402f26d6846e9d766a0a5

      Contracts in Scope (2nd Review)

      contract/src/record/mod.rs;274b1983864b577d0f0ed71506623fa7bc45b34c3a2529d882c9e8c504a880ad

      Contracts in Scope (2nd Review)

      model/src/account_record.rs;9ece8a9c8edfe96f0f1f9ec48ca8bd0eb437f28b9d31191b30ea103c50deea3b

      Contracts in Scope (2nd Review)

      model/src/api.rs;5128d613a50c2f2f4bfce6fec386cf30e5c9aad472452cfcc7af344205a11395

      Contracts in Scope (2nd Review)

      model/src/event.rs;75b6a384457bed841ee9d08e6c522a2cb4df4e68babdcc397bc5c102a3ce0b7c; model/src/lib.rs;5f54333c181704215e5212f16526abf7fb98e5cf3a6c10bf0d33fcbac82f939d

    Assets in Scope

    contract
    src
    lib.rs - contract › src › lib.rs
    auth
    api.rs - contract › src › auth › api.rs
    mod.rs - contract › src › auth › mod.rs
    burn
    api.rs - contract › src › burn › api.rs
    mod.rs - contract › src › burn › mod.rs
    claim
    api.rs - contract › src › claim › api.rs
    mod.rs - contract › src › claim › mod.rs
    clean
    api.rs - contract › src › clean › api.rs
    mod.rs - contract › src › clean › mod.rs
    common
    asserts.rs - contract › src › common › asserts.rs
    mod.rs - contract › src › common › mod.rs
    config
    api.rs - contract › src › config › api.rs
    mod.rs - contract › src › config › mod.rs
    record

    Disclaimer