feat: co-creators, payer spending cap, invoice disputes & dispute resolution - #547
Merged
Kingsman-99 merged 2 commits intoJul 29, 2026
Conversation
…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)
|
@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! 🚀 |
6 tasks
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 #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.