feat(soroban-contracts): Add payment splitter contract for revenue sharing (#247) - #283
Merged
manoahLinks merged 1 commit intoApr 27, 2026
Conversation
…crowdpass-live#247) Implements a Soroban smart contract that distributes incoming token payments proportionally across multiple recipients using configurable share weights. - Configurable share weights per recipient (u32) - Multi-token support via any SEP-41 / Soroban token address - Admin-controlled recipient management (add / remove / update shares) - Dust-aware distribution: indivisible remainder forwarded to first recipient - Reentrancy guard on release() to prevent re-entrant attacks - Swap-with-last O(1) recipient removal algorithm - Hard cap of 50 recipients to bound per-call resource usage - Full upgradeable / time-lock pattern via upgradeable crate - Rich event emissions: PaymentReleased, RecipientAdded, RecipientRemoved, SharesUpdated 19 unit tests covering: - Initialization happy path and all error cases - Release with equal shares, unequal shares, dust remainder, single recipient - Add / remove / update recipient operations with error cases - End-to-end: recipient mutation followed by release Closes crowdpass-live#247
|
@amankoli09 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 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.
Summary
Implements
PaymentSplitter, a Soroban smart contract that distributesincoming token payments proportionally across multiple recipients using
configurable share weights.
Closes #247
Changes
New contract:
soroban-contract/contracts/payment_splitter/Cargo.tomlsoroban-sdk+upgradeablesrc/lib.rssrc/test.rsModified
soroban-contract/Cargo.toml— registeredpayment_splitteras a workspace memberFeatures
u32share weight; payout isbalance × shares / total_sharesadd_recipient(account, shares)— adds a new payeeremove_recipient(account)— O(1) swap-with-last removalupdate_shares(account, new_shares)— adjust weights without re-initializationrelease()prevents cross-contract re-entryMAX_RECIPIENTS = 50to bound per-call resource usageupgradeablecratePaymentReleased,RecipientAdded,RecipientRemoved,SharesUpdatedTests (19 / 19 pass)
Security Notes
release(),add_recipient(),remove_recipient(), andupdate_shares()— prevents griefing