#46976 [SC-Low] Agent Destruction Can Permanently Lock Unclaimed Transfer Fees

Submitted on Jun 7th 2025 at 07:06:56 UTC by @Bluedragon for Audit Comp | Flare | FAssets

  • Report ID: #46976

  • Report Type: Smart Contract

  • Report severity: Low

  • Target: https://github.com/flare-foundation/fassets/blob/main/contracts/assetManager/facets/TransferFeeFacet.sol

  • Impacts:

    • Permanent freezing of unclaimed yield

Description

Summary:

When transfer fees are enabled (transferFeeMillionths > 0), agents accumulate transfer fees that can be claimed via claimTransferFees. However, when an agent destroys their vault, the system doesn't enforce collection of these accumulated fees before destruction. Since the claimTransferFees function depends on agent vault storage that gets deleted during destruction, any unclaimed transfer fees become permanently locked in the AssetManager contract.

Vulnerability Details:

The issue stems from the transfer fee system's dependency on agent vault storage and the lack of fee collection enforcement during agent destruction.

Transfer fees are tracked and accumulated in TransferFeeTracking.sol , where each agent has associated fee tracking data.

Agents can claim their accumulated fees using TransferFeeFacet.sol, which requires the agent vault to exist and uses the vault's storage for calculations.

However, when an agent destroys their vault, there's no mechanism to force collection of outstanding transfer fees before the destruction process completes.

Impact:

  • Permanent Fee Loss: Unclaimed transfer fees become permanently inaccessible after agent destruction

  • Fund Lock-up: Transfer fees accumulate in the AssetManager contract with no recovery mechanism

  • Economic Inefficiency: Agents lose rightful fee earnings if they forget to claim before destruction

  • System Accounting Issues: Contract holds more funds than can be distributed

Scenario (step by step):

  1. Transfer Fee Accumulation:

    • Transfer fees are enabled with transferFeeMillionths > 0

    • Agent operates normally, accumulating transfer fees over time

    • Fees are tracked in TransferFeeTracking.sol

  2. Agent Decides to Exit:

    • Agent reduces their position to zero (no minted assets, no collateral backing)

    • Agent announces exit from the system

    • Agent has accumulated transfer fees but doesn't claim them

  3. Destruction Process:

    • Agent calls destroy function after waiting period

    • System allows destruction without checking for unclaimed transfer fees

    • Agent vault storage is deleted/reset

  4. Permanent Fee Loss:

    • After destruction, claimTransferFees can no longer be called for this agent

    • The function requires agent vault storage which fails after vault destruction

    • Transfer fees remain in the contract but become unclaimable

Option 1: Enforce Fee Collection Before Destruction

Add a check in the agent destruction process to ensure all transfer fees are claimed:

Option 2: Auto-claim During Destruction Automatically claim and transfer any outstanding fees to the agent owner during the destruction process.

The most user-friendly approach would be Option 2, automatically claiming fees during destruction to prevent accidental loss.

Proof of Concept

Proof of Concept:

  1. Add the following test to the 12-TrailingFees in test/integration/fasset-simulation/ directory

  2. Run the test using yarn testHH

Logs

Was this helpful?