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

Audit name:

[SCA] TrustSwap | Team Finance | Mar2026

Date:

May 8, 2026

Table of Content

Introduction
Audit Summary
System Overview
Potential Risks
Findings
Appendix 1. Definitions
Appendix 2. Scope
Appendix 3. Additional Valuables
Disclaimer

Want a comprehensive audit report like this?

Introduction

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

Team Finance is a token management platform by TrustSwap that provides infrastructure for project teams to lock, vest, stake, and distribute tokens on the Stellar blockchain. The platform's Soroban smart contract suite — comprising the token locking, staking, multisender, vesting (factory and instance), and token minting contracts — was audited for security vulnerabilities.

Document

NameSmart Contract Code Review and Security Analysis Report for TrustSwap
Audited ByKerem Solmaz; Felipe Donato
Approved ByIvan Bondar
Websitehttps://trustswap.com/
Changelog24/04/2026 - Preliminary Report
29/04/2026 - Final Report
PlatformStellar (Soroban)
LanguageRust
TagsStaking, Vesting, Fungible Token, Factory, Oracle, Upgradable, Centralization, Claims
Methodologyhttps://docs.hacken.io/methodologies/smart-contracts
  • Document

    Name
    Smart Contract Code Review and Security Analysis Report for TrustSwap
    Audited By
    Kerem Solmaz; Felipe Donato
    Approved By
    Ivan Bondar
    Changelog
    24/04/2026 - Preliminary Report
    29/04/2026 - Final Report
    Platform
    Stellar (Soroban)
    Language
    Rust
    Tags
    Staking, Vesting, Fungible Token, Factory, Oracle, Upgradable, Centralization, Claims

Review Scope

Repositoryhttps://github.com/trustswap/teamfinance-stellar-contracts
Initial Commit1897cc2
Final Commitb4df357

Audit Summary

19Total Findings
18Resolved
1Accepted
0Mitigated

The system users should acknowledge all the risks summed up in the risks section of the report

{Finding_Table?columns=title,severity,status&setting.filter.type=Vulnerability}

Documentation quality

  • The repository contains no whitepaper, technical specification, or architectural overview document. A README was present at the repository root but was deleted prior to the audit commit.

  • Inline documentation is absent across all contract modules. No rustdoc comments describe public functions, storage structures, fee formulas, or reward accumulation logic.

  • No formal specification exists for the staking reward distribution algorithm, the vesting release schedule arithmetic, or the fee-charging mechanism.

Code quality

  • The codebase is well-organized into separate contract crates with clear separation between contract logic, storage, events, and error definitions.

  • The project leverages the stellar-access, stellar-contract-utils, stellar-macros, and stellar-tokens crate ecosystem (v0.4.0) built on soroban-sdk 22.0.8, providing standardized patterns for ownership, pausability, upgradeability, and token operations.

  • Several arithmetic and input validation edge cases were identified across the locking, staking, and vesting contracts, particularly around signed integer handling and boundary checks.

  • Code duplication was observed between contracts where admin-related functions and event emitters were reused without adapting contract-specific constants.

Test coverage

Code coverage of the project cannot be measured.

  • The test suite comprises approximately 6,681 lines across 9 test files, covering the primary operational flows for each contract.

  • The locking contract has the most extensive test coverage, followed by the staking contract and the multisender.

  • Tests do not cover negative case scenarios such as withdrawals exceeding a staked or locked balance, fee enforcement on alternative code paths, or vesting revocation edge cases.

  • No fuzz tests, property-based tests, or invariant tests are present. Adding stateful fuzz testing for the staking reward accumulator and the locking partial-withdrawal arithmetic is recommended.

  • The minting token contracts have minimal test coverage (173-207 lines each), with no tests for access control edge cases.

System Overview

The Team Finance platform is a suite of Soroban smart contracts on the Stellar blockchain that provides token management infrastructure for project teams. The platform enables time-locked token custody, staking reward distribution, batch token distribution, token vesting with Merkle-tree-based schedules, and configurable token minting. All fee-bearing operations convert a USD-denominated fee into XLM using the Reflector oracle price feed.

The Locking contract allows users to deposit fungible tokens or NFTs into time-locked positions. Each deposit records a token address, withdrawal address, locked amount, and unlock timestamp. Deposits are assigned sequential IDs and tracked per withdrawal address in a persistent deposit vector. The contract supports partial withdrawals after the unlock time, lock splitting into new deposit IDs with independent unlock times, lock duration extension, and lock ownership transfer to a different withdrawal address. An owner-controlled recover_assets() function reassigns all deposits from one withdrawal address to another. The contract implements the Pausable trait, allowing the owner to halt lock creation and splitting during emergencies. A referral system provides fee discounts to callers who supply a referrer address, with a configurable split between the referrer and the protocol company wallet.

The Staking contract implements a pool-based staking model where pool creators deposit reward tokens upfront and stakers earn proportional rewards over a fixed time window. Reward distribution uses a time-weighted acc_token_per_share accumulator scaled by a configurable precision factor. Pool creators can add additional rewards, stop reward accrual early (reclaiming remaining rewards), and set per-pool stake limits. Stakers deposit tokens into specific pools, accrue rewards proportional to their share of total staked supply, and withdraw principal along with pending rewards. An emergency withdrawal function allows stakers to reclaim principal while forfeiting all accumulated rewards.

The Multisender contract provides batch distribution of fungible tokens and NFTs. The caller provides parallel arrays of recipients and amounts (or token IDs for NFTs), and the contract executes individual transfer_from calls for each entry in a single transaction. Configurable transfer limits cap the maximum batch size at 1,000 for tokens and 500 for NFTs. An owner-only claim_token/claim_nft function distributes tokens held by the contract itself.

The VestingFactory contract deploys individual Vesting contract instances using Soroban's deploy_v2 mechanism with a stored WASM hash. Each deployment is seeded with a unique salt derived from a sequential vesting ID and the token address. The factory transfers the total vesting allocation from the caller directly to the newly deployed vesting contract.

The Vesting contract distributes tokens to beneficiaries according to a schedule encoded in a Merkle tree. Each leaf contains an index, beneficiary address, total amount, revocability flag, start time, end time, cadence, and percentage claimable at start. The claim() function verifies a Keccak-256 Merkle proof against the stored root before computing the claimable amount using a linear release formula with optional cliff. Revocable schedules can be terminated by the owner through stop_vesting(), which returns unclaimed tokens to the owner. An emergency_withdraw() function allows the owner to reclaim all tokens if no claims have been executed, serving as a recovery mechanism for misconfigured Merkle roots.

The minting module provides four token contract variants built on the stellar-tokens fungible token base: TeamToken (fixed supply, no mint/burn), MintableTeamToken (owner-mintable), BurnableTeamToken (holder-burnable), and MintBurnTeamToken (owner-mintable and holder-burnable). All variants accept a name, symbol, decimals, initial supply, owner, and IPFS metadata hash at construction. The owner can update the metadata IPFS hash on all variants.

Privileged roles

  • Owner (Locking, Staking, Multisender, VestingFactory, Vesting, all Token variants): The owner is set at construction via ownable::set_owner() and can be transferred using the Ownable trait. In the locking contract, the owner controls fee parameters, the oracle address, the company wallet, referral parameters, the whitelist admin roster, the free-token list, and the pause state, and can reassign all deposits from any user to any other address via recover_assets() without timelock or beneficiary consent. In the staking contract, the owner controls identical fee and whitelist parameters and can extract arbitrary token amounts from the contract via save_me(). In the multisender contract, the owner controls fee parameters and can distribute any tokens held by the contract through claim_token() and claim_nft(). In the vesting factory, the owner controls fee parameters and the WASM hash used for new vesting deployments. In the vesting contract, the owner can revoke revocable schedules and reclaim funds, and can execute emergency withdrawals before any claims occur. In the mintable and mint-burn token variants, the owner can mint unlimited tokens with no supply cap. The locking, staking, multisender, and vesting factory contracts implement the Upgradeable pattern, allowing the owner to replace the contract implementation. No timelock, multisig, or governance mechanism constrains any owner action.

  • Whitelist Admin (Locking, Staking, Multisender, VestingFactory): Whitelist admins are granted by the owner through update_whitelist_admin_access(). Admins can add or remove wallet addresses from the fee-exemption whitelist. A compromised whitelist admin can exempt arbitrary addresses from protocol fees, causing revenue loss.

  • Pool Owner (Staking): The address that calls add_pool() becomes the pool owner, distinct from the contract owner. The pool owner can add additional reward tokens to the pool, stop reward accrual and reclaim remaining rewards, and set the per-pool stake limit. The pool owner has no control over protocol-level settings or other pools.

Potential Risks

Scope Definition and Security Guarantees: The audit does not cover all code in the repository. Contracts outside the audit scope may introduce vulnerabilities, potentially impacting the overall security due to the interconnected nature of smart contracts.

System Reliance on External Contracts: The locking, staking, multisender, and vesting factory contracts depend on the Reflector oracle contract for XLM/USD price data used in fee calculations. The oracle address is owner-configurable with no on-chain validation of the target contract. If the Reflector oracle returns stale or manipulated data, or becomes unavailable, all fee-bearing operations are affected — either reverting or charging incorrect amounts. Additionally, all contracts interact with user-supplied token addresses via the SEP-41 token interface and, in the case of locking and multisender, with user-supplied NFT contracts via a custom client interface. The behavior of these external token and NFT contracts is outside the audit scope and assumed to be correct.

Dependency on External Libraries: The project relies on the stellar-access (v0.4.0), stellar-contract-utils (v0.4.0), stellar-macros (v0.4.0), and stellar-tokens (v0.4.0) crate ecosystem for core security primitives including ownership enforcement, pausability, upgradeability, Merkle proof verification, and the fungible token base implementation. These crates are compiled into the production WASM and provide the access control and cryptographic foundations that the audited contracts depend on. Vulnerabilities in these libraries would directly impact the security of the platform.

Centralized Control of Minting Process: The mintable and mint-burn token contracts allow the owner to mint an unlimited number of tokens to any address, with no maximum supply parameter, rate limit, or on-chain cap defined at construction. A compromised owner key enables unlimited supply inflation with no on-chain safeguard, reducing the value of all existing holdings.

Arbitrary Oracle Address Setting by Admin: The owner of the locking, staking, multisender, and vesting factory contracts can set the oracle address to any Soroban contract address through the fee parameter configuration function without on-chain verification that the target implements the Reflector interface or returns legitimate price data. A malicious or misconfigured oracle address would cause all fee calculations to return incorrect values or revert, affecting every fee-bearing operation across the platform.

Owner's Unrestricted State Modification: The contract owner can reassign all of a user's locked deposits to an arbitrary address through the asset recovery function in the locking contract without timelock, beneficiary consent, or on-chain justification. In the staking contract, the owner can extract arbitrary token amounts and types from the contract through a dedicated rescue function. In the vesting contract, the owner can revoke revocable schedules and reclaim tokens. These capabilities represent significant trust assumptions placed on a single key.

Absence of Time-lock Mechanisms for Critical Operations: No timelock or delay mechanism constrains any owner action across the platform. Fee parameter changes, oracle address updates, whitelist modifications, asset recovery, contract upgrades, and vesting revocations all execute immediately upon the owner's signature, leaving no window for users to review or react to potentially harmful changes.

Single Points of Failure and Control: All administrative functions across the five contract modules are gated by a single owner address set at construction. The owner controls fee configuration, oracle selection, whitelist management, contract upgrades, pause state (locking only), asset recovery, and token minting. Compromise of this single key grants full control over all platform operations and user funds. No multisig, governance vote, or threshold signature scheme protects any privileged operation.

Flexibility and Risk in Contract Upgrades: The locking, staking, multisender, and vesting factory contracts implement an upgradeable pattern via the stellar-contract-utils crate, allowing the owner to replace the contract WASM implementation at any time. While this provides the ability to patch vulnerabilities and evolve the platform, it also means the owner can unilaterally alter contract logic — including removing withdrawal constraints, changing fee formulas, or introducing backdoors — with no on-chain review period or user notification.

Absence of Upgrade Window Constraints: The upgrade mechanism executes immediately upon the owner's call with no mandatory delay, cooldown, or governance approval. There is no on-chain mechanism for users to verify proposed new WASM code before it takes effect, increasing the risk of rapid deployment of flawed or malicious code without community oversight.

Findings

Code
Title
Status
Severity
F-2026-1527Unbounded Withdrawal Allows Complete Drain of Staked Tokens
fixed

Critical
F-2026-1528Missing Per-Deposit Withdrawal Bound Allows Negative Balance Exploitation To Drain Locked Funds
fixed

Critical
F-2026-1529Missing Fee Enforcement In Split Lock Allows Unlimited Deposit Creation At Zero Cost
fixed

High
F-2026-1528Fee Charge Logic Allows Deterministic Underpayment
fixed

Medium
F-2026-1528Reward Over-Collection When Adding Rewards Before Pool Start
fixed

Medium
F-2026-1606Missing Transfer Amount Verification In All Contracts Leads To Undercollateralization With Fee-On-Transfer Tokens
fixed

Medium
F-2026-1595Revocation Of Vesting Schedule Seizes Already-Vested Tokens From Beneficiary
fixed

Medium
F-2026-1529Absent Oracle Price Staleness Validation Can Lead To Incorrect Fee Calculation
fixed

Low
F-2026-1656 Missing On-Chain Bounds Validation Of Merkle-Authenticated Leaf Parameters In Vesting
fixed

Low
F-2026-1609No Supply Cap on Mintable Token Contracts Leaves Holders With No On-Chain Dilution Protection
accepted

Low
1-10 of 19 findings

Identify vulnerabilities in your smart contracts.

Appendix 1. Definitions

Severities

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.
  • 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.

Potential Risks

The "Potential Risks" section identifies issues that are not direct security vulnerabilities but could still affect the project’s performance, reliability, or user trust. These risks arise from design choices, architectural decisions, or operational practices that, while not immediately exploitable, may lead to problems under certain conditions. Additionally, potential risks can impact the quality of the audit itself, as they may involve external factors or components beyond the scope of the audit, leading to incomplete assessments or oversight of key areas. This section aims to provide a broader perspective on factors that could affect the project's long-term security, functionality, and the comprehensiveness of the audit findings.

Appendix 2. Scope

The scope of the project includes the following smart contracts from the provided repository:

Scope Details

Repositoryhttps://github.com/trustswap/teamfinance-stellar-contracts
Commit1897cc2b7f6a9f4a1bc98e0c4296239313392455
Final Commitb4df3576d563089b9c7532e3f7c66038dd520832
WhitepaperN/A
RequirementsN/A
Technical RequirementsREADME.md, Team Finance Stellar STRIDE Threat Model.pdf

Assets in Scope

contracts
locking
src
contract.rs - contracts › locking › src › contract.rs
errors.rs - contracts › locking › src › errors.rs
events.rs - contracts › locking › src › events.rs
lib.rs - contracts › locking › src › lib.rs
nft.rs - contracts › locking › src › nft.rs
storage.rs - contracts › locking › src › storage.rs
minting
burnable-team-token
src
contract.rs - contracts › minting › burnable-team-token › src › contract.rs
lib.rs - contracts › minting › burnable-team-token › src › lib.rs
mintable-team-token
src
contract.rs - contracts › minting › mintable-team-token › src › contract.rs
lib.rs - contracts › minting › mintable-team-token › src › lib.rs
mint-burn-team-token
src
contract.rs - contracts › minting › mint-burn-team-token › src › contract.rs
lib.rs - contracts › minting › mint-burn-team-token › src › lib.rs

Appendix 3. Additional Valuables

Additional Recommendations

The smart contracts in the scope of this audit could benefit from the introduction of automatic emergency actions for critical activities, such as unauthorized operations like ownership changes or proxy upgrades, as well as unexpected fund manipulations, including large withdrawals or minting events. Adding such mechanisms would enable the protocol to react automatically to unusual activity, ensuring that the contract remains secure and functions as intended.

To improve functionality, these emergency actions could be designed to trigger under specific conditions, such as:

  • Detecting changes to ownership or critical permissions.

  • Monitoring large or unexpected transactions and minting events.

  • Pausing operations when irregularities are identified.

These enhancements would provide an added layer of security, making the contract more robust and better equipped to handle unexpected situations while maintaining smooth operations.

Frameworks and Methodologies

This security assessment was conducted in alignment with recognised penetration testing standards, methodologies and guidelines, including the NIST SP 800-115 – Technical Guide to Information Security Testing and Assessment , and the Penetration Testing Execution Standard (PTES) , These assets provide a structured foundation for planning, executing, and documenting technical evaluations such as vulnerability assessments, exploitation activities, and security code reviews. Hacken’s internal penetration testing methodology extends these principles to Web2 and Web3 environments to ensure consistency, repeatability, and verifiable outcomes.

Disclaimer