Label: complexity: high
Points: 200
Description
refund() assumes the contract always holds enough token balance to refund everyone in full. In an edge case where custody is short (e.g. interaction with the streaming/DEX-swap features leaves less than expected), there's no defined, fair order for partial refunds. This issue adds an explicit priority rule.
Technical Context
Involves lib.rs refund() — before transferring, check token_client.balance(&env.current_contract_address()) against the sum owed; if short, refund payers in ascending order of contribution amount first (protects smaller contributors fully before larger ones absorb any shortfall), rather than reverting the entire refund.
Acceptance Criteria
Label: complexity: high
Points: 200
Description
refund()assumes the contract always holds enough token balance to refund everyone in full. In an edge case where custody is short (e.g. interaction with the streaming/DEX-swap features leaves less than expected), there's no defined, fair order for partial refunds. This issue adds an explicit priority rule.Technical Context
Involves
lib.rsrefund()— before transferring, checktoken_client.balance(&env.current_contract_address())against the sum owed; if short, refund payers in ascending order of contribution amount first (protects smaller contributors fully before larger ones absorb any shortfall), rather than reverting the entire refund.Acceptance Criteria
refund_shortfallevent recording the total shortfall amount when this path triggerscargo clippypasses with zero warnings