Skip to content

Add missing indexer events: allowlist toggle, auto-resume, tip, forward_to - #658

Open
Olakunle567 wants to merge 1 commit into
Stellar-split:mainfrom
Olakunle567:feat/indexer-events-allowlist-tip-forward-autoresume
Open

Add missing indexer events: allowlist toggle, auto-resume, tip, forward_to#658
Olakunle567 wants to merge 1 commit into
Stellar-split:mainfrom
Olakunle567:feat/indexer-events-allowlist-tip-forward-autoresume

Conversation

@Olakunle567

@Olakunle567 Olakunle567 commented Aug 28, 2026

Copy link
Copy Markdown

Summary

Four state changes were previously invisible to indexers because no event was emitted. This PR closes all four gaps, additively (no behavior or storage changes):

  • contributor_allowlist toggleInvoiceExt2::contributor_allowlist gates who can call pay/contribute, but flipping it on (first entry added via add_contributor_to_allowlist) or off (last entry removed via remove_contributor_allowlist) was silent. Now emits contributor_allowlist_toggled(creator, enabled) exactly on the None <-> Some transition — not on every list edit, so adding/removing a non-last entry stays quiet as before.
  • invoice_auto_resumed — an invoice paused with auto_resume_at set resumes lazily the next time pay() is called after the timestamp passes, inside the internal _pay path. That path emitted no event at all (not even the existing invoice_resumed), so indexers had no way to see it, let alone distinguish it from a manual resume. Now emits invoice_auto_resumed(auto_resume_at); the manual resume_invoice path is untouched and still emits invoice_resumed.
  • tip on payment_receivedPayment.tip (contracts/split/src/types.rs) was tracked in storage and aggregated internally (e.g. compress_payments, fee/payout math) but never surfaced on the payment_received event, forcing indexers to re-parse Invoice.payments to see tipping behaviour. payment_received's data tuple now includes tip. Note: no public entry point currently lets a caller set a nonzero tip — every Payment construction site in the contract still hardcodes tip: 0 — so the event will carry 0 until tip-setting is wired up elsewhere; this PR only closes the event-visibility gap for the field as it exists today.
  • forward_configuredInvoiceOptions.forward_to lets surplus funds be forwarded to another address on release, but setting it at creation time was invisible until funds actually moved. Now emits forward_configured(forward_to) right after invoice_created when forward_to is Some.

Changes

  • contracts/split/src/events.rs — new forward_configured, invoice_auto_resumed, contributor_allowlist_toggled event functions; payment_received gains a tip: i128 parameter.
  • contracts/split/src/lib.rs — wires the above in at the 4 relevant call sites (_create_invoice_inner, the lazy auto-resume block in _pay, add_contributor_to_allowlist/remove_contributor_allowlist), and updates all 7 existing payment_received call sites to pass tip (currently always 0).
  • contracts/split/src/test.rs — one new/extended test per feature, using the existing topic0_is/topic1_is event-assertion helpers already established in the file.

Test plan

  • cargo test -p split — full suite plus the new/extended tests:
    • test_auto_resume_allows_payment_after_timestamp (extended): asserts invoice_auto_resumed fires and invoice_resumed does not, on lazy auto-resume.
    • test_forward_configured_event_emitted_when_forward_to_set / test_forward_configured_event_absent_when_forward_to_unset
    • test_contributor_allowlist_toggle_events: add (enabled=true) then remove-last (enabled=false), asserting exactly one toggle event each time.
    • test_payment_received_event_includes_tip: decodes the event data tuple and checks the tip field.
  • cargo build --target wasm32-unknown-unknown --release --package split to confirm the WASM build is unaffected.

Note: this PR was authored in an environment without a local Rust toolchain, so the above was verified by careful manual review (signatures, field names, call-site consistency) rather than a local cargo test run — please confirm CI is green before merging.
closes #604
closes #606
closes #605
closes #603

…ip, and forward_to

Four indexer-visible state changes were previously silent:

- InvoiceExt2::contributor_allowlist could be toggled on/off (via
  add_contributor_to_allowlist / remove_contributor_allowlist) with no
  event, so indexers enforcing compliance rules couldn't observe it.
  Now emits contributor_allowlist_toggled(creator, enabled) exactly on
  the None <-> Some transition (first add / last remove), not on every
  list edit.

- Automatic (timer-triggered) invoice resume via auto_resume_at emitted
  no event at all (the lazy check lives in pay()'s internal _pay path).
  Now emits invoice_auto_resumed(auto_resume_at), distinct from the
  existing invoice_resumed event which remains manual-resume-only.

- Payment.tip was tracked in storage but never surfaced on the
  payment_received event, forcing indexers to re-parse
  Invoice.payments to see tipping behaviour. payment_received now
  carries tip in its data tuple.

- InvoiceOptions.forward_to, when set at invoice creation, had no
  dedicated event and was invisible until funds were actually
  forwarded at release time. Now emits forward_configured(forward_to)
  right after invoice_created when forward_to is Some.

Adds one test per feature following the existing topic0_is/topic1_is
event-assertion pattern in test.rs.
Copilot AI lite review requested due to automatic review settings August 28, 2026 09:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants