Skip to content

feat: co-creators, payer spending cap, invoice disputes & dispute resolution - #547

Merged
Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
augustinemartins:feature/co-creators-payer-cap-disputes-resolution
Jul 29, 2026
Merged

feat: co-creators, payer spending cap, invoice disputes & dispute resolution#547
Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
augustinemartins:feature/co-creators-payer-cap-disputes-resolution

Conversation

@augustinemartins

@augustinemartins augustinemartins commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Closes #490
Closes #491
Closes #492
Closes #493

Implements 4 features: co-creator management, payer spending cap, contributor-raised disputes, and dispute resolution with timeout. Also fixes pre-existing compilation bugs.

…sputes, and dispute resolution

## Feature 1: Co-creator Management
- Add MAX_CO_CREATORS constant (10) to prevent unbounded storage growth
- Add require_creator_or_cocreator() helper for shared auth checks
- Add add_co_creator() and remove_co_creator() contract methods (creator-only)
- Emit CoCreatorAdded and CoCreatorRemoved events
- Update cancel_invoice and extend_deadline to allow co-creator callers

## Feature 2: Global Payer Spending Cap
- Add PayerSpendLimitExceeded error variant
- Implement ledger-based spending window accumulator in temporary storage
- Add set_payer_spend_cap() admin config (cap + window_ledgers)
- Check and enforce cap in contribute() entry point
- Emit PayerSpendLimitReached event on breach

## Feature 3: Contributor-Raised Invoice Disputes
- Add Disputed variant to InvoiceStatus with full serialization support
- Add InvoiceDisputed error variant for blocked operations
- Add raise_invoice_dispute() allowing any contributor to flag an invoice
- Store dispute record with timeout config in persistent storage
- Block release_payment when invoice status is Disputed
- Emit InvoiceDisputeRaised event with disputer address and reason hash

## Feature 4: Dispute Resolution with Timeout
- Add dispute_timeout_ledgers and dispute_opened_ledger to DisputeRecord
- Add resolve_invoice_dispute() (admin-only, any time before timeout)
- Add auto_close_dispute() (permissionless, after timeout elapses)
- Add Release and Refund outcomes to DisputeOutcome enum
- Add set_dispute_timeout() admin configuration
- Emit DisputeResolved event with outcome and resolver

## Additional Fixes
- Fix duplicate error discriminants in ContractError (was causing compilation errors)
- Fix corrupted recipient_address_rotated() function body in events.rs
- Fix missing closing brace in role_discriminant() function
- Fix Disputed status handling in all InvoiceStatus helpers (to_u8, from_u8, to_compact, from_compact, invoice_state_changed)
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@augustinemartins 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

@Kingsman-99
Kingsman-99 merged commit 7f26646 into Stellar-split:main Jul 29, 2026
@grantfox-oss grantfox-oss Bot mentioned this pull request Jul 29, 2026
6 tasks
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.

Dispute Resolution Timeout On-Chain Dispute Initiation Payer Total Spending Limit Across Invoices Invoice Co-Creator Authorization

2 participants