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

Audit name:

[SCA] PreSend | Affiliate Program | Jan2023

Date:

Jan 31, 2023

Table of Content

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

Want a comprehensive audit report like this?

Introduction

We express our gratitude to the PreSend team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.

PreSend contracts stand for storing affiliates and fees collecting.

titlecontent
PlatformEthereum, Polygon
LanguageSolidity
Timeline12/11/2022 - 30/01/2023
Methodologyhttps://hackenio.cc/sc_methodology→

    Type: Transaction verifier, Affiliate program

    Review Scope

    Repositoryhttps://github.com/Presend-DeFi/presend-protocol-payment-affiliate→
    Commitd2c814f6dd1e574b1d0452c243eca4669be6dd94

    Audit Summary

    Total9.95/10
    Security Score

    10/10

    Test Coverage

    98.65%

    Code Quality Score

    10/10

    Documentation Quality Score

    10/10

    23Total Findings
    23Resolved
    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 PreSend
    Audited ByHacken
    Changelog17/11/2022 – Initial Review
    21/12/2022 - Second Review
    30/01/2023 - Third Review
    • Document

      Name
      Smart Contract Code Review and Security Analysis Report for PreSend
      Audited By
      Hacken
      Changelog
      17/11/2022 – Initial Review
      21/12/2022 - Second Review
      30/01/2023 - Third Review

    System Overview

    PreSend contracts stand for storing affiliates and fees collecting. They are represented by these contracts:

    PreSendPayment — Payment contract gives it permission to increase and decrease the amount of funds affiliates can withdraw. Inherited from OpenZeppelin’s Initializable, AccessControl, Chainlink’s AutomationCompatible contracts.

    It has the following attributes:

    • affiliate smart contract reference.

    • address of the treasury where affiliate payments will go.

    • aggregator to get the price of the native coin in USD.

    • the Default Admin user.

    PreSendAffilate - Role to manage affiliates. This role can add/remove affiliates, update the affiliate tier that determines the percentage of fees they get, and add new tiers for affiliates. This role can also update the reference to the payment contract. Inherited from OpenZeppelin’s Initializable, AccessControl contracts.

    It has the following attributes:

    • affiliate features and properties.

    • the address of the PreSend payments smart contract.

    • the Default Admin user.

    Privileged roles

    • Default Admin: Admin who can set and change an Affiliate, Treasury, aggregator, Fee divisor, Payment, Fee roles.

    • Affiliate_Admin: In PreSendAffiliate.sol can add or update tier and affiliate.

    • Payment_Admin: In PreSendPayments.sol this role can increase or decrease currency allowance.

    • Fee_Admin: Fee Admin who manually sends PreSend transaction fees from the contract to the treasury address.

    • Payment_Contract: In PreSendAffiliate.sol it represents PreSendPayments address.

    • User: The person who uses a Payment contract.

    Executive Summary

    Documentation quality

    The total Documentation quality score is 10 out of 10.

    • Technical descriptions are provided.

    • Functional requirements are provided.

    Code quality

    The total Code quality score is 10 out of 10.

    • Technical descriptions are provided.

    • Functional requirements are provided.

    Test coverage

    Code coverage of the project is 98.65%.

    • Some error handlers were not tested.

    Security score

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

    Findings

    F-2023-132 Insufficient Funds
    Status
    fixed
    Severity

    Critical
    F-2023-1320 Upgradeability Errors
    Status
    fixed
    Severity

    Critical
    F-2023-1325Undocumented Behavior
    Status
    fixed
    Severity

    High
    F-2023-132 Access Control Violation
    Status
    fixed
    Severity

    High
    F-2023-1323 Requirements Violation
    Status
    fixed
    Severity

    High
    F-2023-132Requirements Violation
    Status
    fixed
    Severity

    High
    F-2023-1335Contradiction
    Status
    fixed
    Severity

    Medium
    F-2023-133Contradiction
    Status
    fixed
    Severity

    Medium
    F-2023-133Missing Validation
    Status
    fixed
    Severity

    Medium
    F-2023-1332Requirements Violation
    Status
    fixed
    Severity

    Medium
    Code
    ―
    Title
    Status
    Severity
    F-2023-132 Insufficient Funds
    fixed

    Critical
    F-2023-1320 Upgradeability Errors
    fixed

    Critical
    F-2023-1325Undocumented Behavior
    fixed

    High
    F-2023-132 Access Control Violation
    fixed

    High
    F-2023-1323 Requirements Violation
    fixed

    High
    F-2023-132Requirements Violation
    fixed

    High
    F-2023-1335Contradiction
    fixed

    Medium
    F-2023-133Contradiction
    fixed

    Medium
    F-2023-133Missing Validation
    fixed

    Medium
    F-2023-1332Requirements Violation
    fixed

    Medium
    1-10 of 23 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/Presend-DeFi/presend-protocol-payment-affiliate→
    Commitd2c814f6dd1e574b1d0452c243eca4669be6dd94
    WhitepaperNot provided
    RequirementsNot provided
    Technical RequirementsProvided

    Contracts in Scope

    contracts
    PreSendAffiliate.sol - contracts › PreSendAffiliate.sol
    PreSendPayments.sol - contracts › PreSendPayments.sol
    interfaces
    IPreSendAffiliate.sol - interfaces › IPreSendAffiliate.sol

    Disclaimer