feat(#563): Allow proportional withdrawals based on milestones#581
feat(#563): Allow proportional withdrawals based on milestones#581Banx17 wants to merge 4 commits into
Conversation
|
@Banx17 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
this is the real milestone-withdrawals feature and the logic checks out, the new CampaignWithdrawnAmount key is additive (defaults 0 for existing campaigns, no orphaning), the reserve accumulation and partial to_process accounting look correct, and test passes. just ci: clippy fails on an unnecessary |
Overview
This PR introduces proportional, milestone-based withdrawals for campaigns that enable
uses_milestones, resolving #563.Currently, funds can only be withdrawn if all milestones are verified. This PR updates the withdrawal logic to allow creators to withdraw funds progressively as individual milestones are verified.
Changes Made
CampaignWithdrawnAmount(u32)toDataKeyinsrc/storage.rsto safely track the gross amount processed for withdrawals without breaking existingCampaigndata structures.withdraw_fundsinsrc/campaigns/withdraw.rsto allow partial withdrawals. The amount processed in each step is bounded by the total sum oftarget_amountacross all verified milestones, capped atamount_raised.CampaignReserve.campaign.funds_withdrawn = trueandcampaign.is_active = falseonly once the entire raised amount is processed.src/tests/test_issues.rs(test_milestone_proportional_withdrawals_563).Validation
[npm run lint ✅ completed (existing repo warnings only)
npm run typecheck ✅ passed
npm test -- src/config/tests/config.test.ts --runInBand ✅ passed (9/9)
npm run build ✅ passed]
Fixes #563