#45517 [SC-Insight] Partial Documentation for Self-Close Exit Fee Handling and Redemption Workflow in 'CollateralPool.sol'
Submitted on May 16th 2025 at 00:33:39 UTC by @rusalka711 for Audit Comp | Flare | FAssets
Report ID: #45517
Report Type: Smart Contract
Report severity: Insight
Target: https://github.com/flare-foundation/fassets/blob/main/contracts/assetManager/implementation/CollateralPool.sol
Impacts:
Description
Brief/Intro
The _selfCloseExitTo and fAssetRequiredForSelfCloseExit functions lack critical explanations of their redemption logic, fee lifecycle management, and parameter constraints. Missing documentation increases the risk of user errors during self-close exits and complicates protocol maintenance.
Vulnerability Details
A. Undocumented Parameters
_redeemToCollateral:No explanation of when/why to use direct collateral redemption vs. standard chain redemption.
_redeemerUnderlyingAddress:Missing examples (e.g., BTC/XRP address formats) and validation requirements.
_executor:Unclear role (e.g., receives fees for manual redemptions on non-smart contract chains).
B. Fee Lifecycle Ambiguity
Fee Debt Conversion:
No context on how this affects future fee withdrawals or user balances.
Allowance Checks:
Fails to specify that
transferFeeis paid by the user, not the contract.
C. Collateral Ratio Logic
_getFAssetRequiredToNotSpoilCR:No documentation of its formula or impact on pool solvency.
Agent Redemption Limits:
Undefined consequences of
maxAgentRedemption < requiredFAssets(e.g., partial exits).
D. Event Emissions
IncompleteSelfCloseExit:No explanation of when/why this event is emitted.
ExitedParameters:Undocumented fields (e.g.,
spentFAssetFeesvs.requiredFAssets).
Impact Details
Category: Documentation Improvements Insight
Impact Analysis:
No Direct Exploit: The code operates correctly as written.
Operational Risks:
Insufficient Allowances: Users may underestimate
transferFee, causing transaction reverts.Collateral Misconfigurations: Misunderstanding
_redeemToCollateralcould lead to failed redemptions.Accounting Errors: Poorly tracked fee debt may cause incorrect user balance calculations.
References
Code File:
CollateralPool.sol(Lines 312–412).Key Functions:
_selfCloseExitTofAssetRequiredForSelfCloseExit
Critical Parameters:
_redeemToCollateral_redeemerUnderlyingAddress_executor
Proof of Concept
Proof of Concept
1. _selfCloseExitTo Function Documentation
_selfCloseExitTo Function DocumentationLocation: Insert above the _selfCloseExitTo function.
Code:
2. fAssetRequiredForSelfCloseExit Function Documentation
fAssetRequiredForSelfCloseExit Function DocumentationLocation: Insert above the fAssetRequiredForSelfCloseExit function.
Code:
3. Inline Comment for _redeemerUnderlyingAddress
_redeemerUnderlyingAddressLocation: Insert above the _redeemerUnderlyingAddress parameter usage (inside _selfCloseExitTo).
Code:
4. Event Emission Comment
Location: Insert above the emit IncompleteSelfCloseExit line.
Code:
5. Parameter Validation Comment
Location: Insert above the requiredFAssets < assetManager.lotSize() check.
Code:
Summary of Changes
_selfCloseExitTo
NatSpec for parameters, collateral checks, agent limits, and fee logic.
fAssetRequiredForSelfCloseExit
Formula explanation and edge-case handling.
_redeemerUnderlyingAddress
Example address formats for clarity.
IncompleteSelfCloseExit
Context for partial exits due to agent limits.
requiredFAssets check
Clarifies _redeemToCollateral usage for small amounts.
Result
These comments:
Prevent User Errors: Clarify redemption paths, fee allowances, and address formats.
Improve Auditability: Document formulas and edge cases for critical logic.
Enhance Maintainability: Explain parameter interactions and event triggers.
Was this helpful?