feat: platform fee collection on contributions (#20)#50
Merged
Conversation
|
@jerrymusaga 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! 🚀 |
Implements atomic fee splitting at contribution time via PLATFORM_FEE_BPS env var (basis points). Both direct payments and path payments route the fee to the platform wallet in the same Stellar transaction as the contribution. The fee amount is recorded per-contribution in the DB and displayed transparently in ContributeModal before the user confirms.
a65a196 to
a5ade6a
Compare
Contributor
|
@jerrymusaga review for merge conflicts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #20
Summary
prepareSignedContributionPaymentandprepareSignedContributionPathPaymentnow add a second operation in the same Stellar transaction routing the fee to the platform wallet — no separate transactionsPLATFORM_FEE_BPSenv var (basis points, e.g.150= 1.5%); defaults to0so existing deployments are unaffectedplatform_fee_amountadded tocontributionsvia migration20260426_platform_fee.sql; the ledger monitor reads fee from thestellar_transactions.metadataand writes it on indexContributeModalfetchesGET /api/configon mount and shows "Platform fee: 1.5% = 0.15 USDC — campaign receives X USDC" before the user confirmsTest plan
PLATFORM_FEE_BPS=150in.envand contribute — verify two operations appear in the Stellar transaction (one to campaign wallet, one to platform wallet)contributionstable after ledger monitor indexes —platform_fee_amountshould be populatedPLATFORM_FEE_BPS=0(or unset) — contribution behaves exactly as before (single op, no fee)ContributeModal, enter an amount — fee breakdown line appears; clear amount — line disappearsnpm test— 30 pass, 1 pre-existing failure in campaign refund test (unrelated to this PR)