flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Contracts] Implement the allowance debit path in create_allowance_stream or remove the entrypoint

Open blurbeast opened this issue 2 weeks ago • 3 comments

Overview & Background

create_allowance_stream mints a stream that can never pay anything. It sets rate_per_second: 1 with deposited_amount: 0, and calculate_claimable caps accrual at remaining = deposited - withdrawn, so claimable is always 0. No code path ever calls token transfer_from — the only transfers are apply_withdrawal's transfer from the contract's own balance. The docs promise "Tokens are debited from the sender's balance during withdrawals, not locked upfront", but withdraw on such a stream always fails with InvalidAmount and the allowance is never consumed. The validated duration parameter is then unused. A half-implemented feature presented as a working entrypoint.


Technical Specification & Architecture

  1. Implement the debit-from-allowance withdrawal path (reconciling it with the escrow-based apply_withdrawal), or remove/hide the entrypoint until it is functional.
  2. If kept, test that withdrawals debit the sender's allowance balance.

Target Files

  • contracts/stream_contract/src/lib.rs
  • contracts/stream_contract/src/test.rs

Acceptance Criteria

  • [ ] No public entrypoint exists that can never succeed.
  • [ ] If implemented: withdrawal debits the sender via transfer_from and updates accounting.
  • [ ] Docs match actual behavior.

blurbeast avatar Nov 18 '26 19:11 blurbeast

@achiever2110 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

this is easy it

ℹ️ Repo Maintainers: To accept this application, review their application or assign @achiever2110 to this issue.

achiever2110 avatar Nov 21 '26 07:11 achiever2110

Congratulations, @achiever2110! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.

🧑‍💻 @achiever2110: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Nov 21 '26 07:11 drips-wave[bot]

This issue has been completed by @achiever2110 as part of the Stellar Wave Program's 11th Wave 🥳

😎 @achiever2110: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

drips-wave[bot] avatar Nov 22 '26 20:11 drips-wave[bot]