Skip to content

Use effective raised amount for withdrawals#568

Open
Killerjunior wants to merge 2 commits into
Iris-IV:mainfrom
Killerjunior:codex/514-withdraw-effective-fee-basis
Open

Use effective raised amount for withdrawals#568
Killerjunior wants to merge 2 commits into
Iris-IV:mainfrom
Killerjunior:codex/514-withdraw-effective-fee-basis

Conversation

@Killerjunior

Copy link
Copy Markdown

📌 Description

Fixes withdraw_funds so platform fees, creator payout, reserve calculation, and global raised cleanup use campaign.effective_amount_raised instead of historical campaign.amount_raised. This prevents fees from being charged on funds that have already been refunded.

🔗 Related Issues

Fixes #514

🧪 Changes Made

  • Bug fix
  • New feature
  • Refactor
  • Documentation update

✅ Checklist

  • Code compiles successfully
  • Tests added/updated and passing
  • Linting passes (no warnings/errors)
  • Documentation updated (if required)
  • No breaking changes (or clearly documented)

⚠️ Breaking Changes

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 --all completed successfully.

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@davidmaronio davidmaronio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] withdraw_funds fee calculation uses amount_raised not effective_amount_raised — overpays platform fee after refunds

2 participants