Use effective raised amount for withdrawals#568
Conversation
|
@Killerjunior 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! 🚀 |
davidmaronio
left a comment
There was a problem hiding this comment.
the intent (use the post-refund effective amount as the fee/reserve basis) is reasonable, but it doesn't compile, clippy: E0425 cannot find value withdraw_basis (withdraw.rs, x2). you reference withdraw_basis but never bind it, add let withdraw_basis = campaign.effective_amount_raised;. then run cargo fmt and rebase onto a clean main (the other compile errors in the log are from a stale base, not your diff). note #583 carries this same withdraw change plus a coverage job, so one of the two should drop it.
📌 Description
Fixes
withdraw_fundsso platform fees, creator payout, reserve calculation, and global raised cleanup usecampaign.effective_amount_raisedinstead of historicalcampaign.amount_raised. This prevents fees from being charged on funds that have already been refunded.🔗 Related Issues
Fixes #514
🧪 Changes Made
✅ Checklist
None.
📸 Screenshots (if applicable)
Not applicable.
🧩 Additional Notes
Added a regression test proving withdrawal fees are calculated from live effective funds after a simulated refund. I could not run the focused tests locally because Cargo dependency resolution failed on crates.io SSL/cached dependency availability for
ryu;cargo fmt --allcompleted successfully.