Implement Anti-Spam Deposits, Batch Refunds, Payment Thresholds, and Platform Fee Accounting#247
Merged
Merged
Conversation
…split#201, Stellar-split#202 with tests Stellar-split#196 - Add spam deposit slashing for invoice creation - set_spam_deposit(admin, amount, min_age_secs) stores deposit config - create_invoice charges deposit to contract custody - cancel_invoice slashes to treasury if age < min_age_secs, else refunds creator - Deposit of 0 disables the feature - Tests: early cancel slashes, late cancel refunds, zero disables, get returns values Stellar-split#197 - Batch refund for multiple expired invoices - refund_batch(invoice_ids) accepts up to 20 IDs, panics above that - Skips ineligible invoices (not Pending, deadline not passed, auction active) - Returns Vec of IDs actually refunded - Each refund emits individual invoice_refunded/payer_refunded events - Tests: mixed batch processes correct subset, panics at >20, empty returns empty Stellar-split#201 - Creator-set minimum payment increment - min_payment_increment field on InvoiceOptions/InvoiceExt2 - _pay() rejects amounts below threshold with 'payment below minimum increment' - Independent of existing min_payment micro-payment accumulator - Tests: below threshold panics, at/above threshold succeeds, zero disables Stellar-split#202 - Total platform fee accounting ledger - total_platform_fees_key() counter incremented on every release path - get_total_platform_fees() pure view function - Zero platform_fee_bps releases do not increment counter - Tests: starts at zero, accumulates across invoices, zero bps unchanged, exact amounts fix: add missing ToXdr trait import for ScVal::to_xdr in compute_shard_id
|
@johnsmccain 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! 🚀 |
7 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.
Summary
This PR enhances invoice management by introducing anti-spam deposits, batch refund processing, configurable minimum payment increments, and platform fee accounting.
Closes
Changes
#196 Anti-Spam Deposit
0#197 Batch Refunds
refund_batch()for processing multiple expired invoices#201 Minimum Payment Increment
min_payment_incrementto invoice options#202 Platform Fee Ledger
get_total_platform_fees()view functionValidation
cargo clippypasses with zero warnings