feat(split): emit events for overfunding, penalty, deadline & whitelist changes (#686–689) - #716
Merged
Kingsman-99 merged 2 commits intoAug 31, 2026
Conversation
…st changes Adds four indexer-facing events so payers and off-chain monitors can explain balance/state changes that were previously silent: - overfunding_triggered(invoice_id, payer, policy, surplus) (Stellar-split#686) Emitted from _pay when an AcceptAll / ReturnSurplus policy pushes funded past total. `surplus` is the amount refunded (ReturnSurplus) or accepted beyond the target (AcceptAll). Cap keeps its existing overflow_behavior events. - penalty_applied(invoice_id, payer, penalty_amount, penalty_bps) (Stellar-split#687) Emitted from the late-payment path when penalty_bps > 0 and penalty_deadline has passed. penalty_amount is the actual stroops deducted and distributed to recipients. - deadline_extended(invoice_id, old_deadline, new_deadline) (Stellar-split#688) Emitted from extend_deadline. Topics (split, dl_ext, invoice_id), data (old_deadline, new_deadline, event_seq). - recipient_whitelist_updated(invoice_id, enabled, added, removed) (Stellar-split#689) Emitted from add_to_recipient_whitelist / remove_from_recipient_whitelist whenever the whitelist mutates; added/removed are address vectors. Also fixes an unclosed-delimiter merge artifact in events.rs (a half-written duplicate invoice_expired) and a duplicated `use` line in test.rs, both of which prevented the crate from compiling at all. Tests: 8 new unit tests in test.rs covering each event's presence, absence on the negative path, and payload values. Note: `main` currently has ~39 further pre-existing compile errors from earlier bad merges (unrelated to these issues), so the full `cargo test` suite does not yet build; these events and their call sites are self-contained and follow the existing events.rs conventions. Closes Stellar-split#686 Closes Stellar-split#687 Closes Stellar-split#688 Closes Stellar-split#689 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RESwkFykGpG3KJdWhGQC2E
|
@Tisan1000 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.
What
Adds four indexer-facing events in
contracts/split/src/events.rsand wires them into the relevant code paths inlib.rs, so payers and off-chain monitors can explain balance / state changes that were previously silent.overfunding_triggered(split, ovf_trig, invoice_id)(payer, policy, surplus, event_seq)penalty_applied(split, pen_appl, invoice_id)(payer, penalty_amount, penalty_bps, event_seq)deadline_extended(split, dl_ext, invoice_id)(old_deadline, new_deadline, event_seq)recipient_whitelist_updated(split, rcp_wl_up, invoice_id)(enabled, added, removed, event_seq)#686 — overfunding policy
Emitted from
_payonly when anAcceptAllorReturnSurpluspolicy actually pushesfundedpasttotal:ReturnSurplus:surplus= stroops transferred straight back to the payer.AcceptAll:surplus= stroops accepted beyond the target (funded + credited - total).Capis intentionally excluded — it defers tooverflow_behavior, which already has its own events.#687 — late-payment penalty
Emitted from the existing penalty branch in
_paywhenpenalty_bps > 0andpenalty_deadlinehas passed, after the penalty has been distributed.penalty_amountis the actual amount deducted from the payment (amount * penalty_bps / 10_000).#688 — deadline extension
Emitted from
extend_deadlineafter the new deadline is persisted, carrying the previous value. Topics/data match the issue spec exactly.#689 — recipient whitelist
Emitted from both
add_to_recipient_whitelistandremove_from_recipient_whitelistwhenever the list actually changes.added/removedareVec<Address>(single entry in practice, vector leaves room for batch updates);enabledreflectsrecipient_whitelist_enabled. The pre-existingrecipient_whitelisted/recipient_removed_from_whitelistevents are left in place.Tests
8 new unit tests in
contracts/split/src/test.rs:ReturnSurplusandAcceptAll, and not emitted on an exact fill (funded + payment == total)mainmaindoes not currently compile. Fixing the four target issues surfaced this. There is one unclosed-delimiter merge artifact directly in the target file (events.rs) — a half-written duplicateinvoice_expired— which this PR fixes, plus a duplicateduseline intest.rs. Beyond that,mainhas ~39 further pre-existing compile errors from earlier bad merges that are unrelated to these issues and out of scope here, e.g.:mod validation;and a stalevalidation.rs/storage.rsusing an old soroban-sdk API (Map::has,Vec::to_vec,Persistent::bump)calc_platform_fee/ContractError::TooFewRecipientsInvoiceStatus::PayoutInProgressnot handled in 6matchexpressionsinvoice_refundedcalled with 3 args against a 2-arg definitionenv.storage().*.get()calls needing type annotationsBecause of those,
cargo test --workspacecannot build yet. The event functions and their call sites in this PR are self-contained, follow the existingevents.rsconventions, and introduce no new errors.Closes #686
Closes #687
Closes #688
Closes #689
🤖 Generated with Claude Code