Skip to content

feat(payment_retry): emit PaymentFunded event on fund_payment#692

Open
jjb9707 wants to merge 16 commits into
Stellopay:mainfrom
jjb9707:feat/payment-retry-funded-event
Open

feat(payment_retry): emit PaymentFunded event on fund_payment#692
jjb9707 wants to merge 16 commits into
Stellopay:mainfrom
jjb9707:feat/payment-retry-funded-event

Conversation

@jjb9707

@jjb9707 jjb9707 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

fund_payment() in onchain/contracts/payment_retry/src/lib.rs records an escrow deposit for a retryable payment but previously emitted no event. Off-chain systems (payroll completion, escrow reconciliation, retry-coverage auditing) had to read contract storage to detect funding.

This PR adds a PaymentFunded event with payment_id, funder, token, and amount, emitted after the deposit transfer is committed (emit-after-commit policy) so indexers never observe an uncommitted funding event.

Changes

  • New PaymentFundedEvent contract type (documented fields).
  • fund_payment now publishes ("payment_funded", payment_id) carrying the event payload after token_client.transfer(...).
  • Two tests in tests/test_retry.rs:
    • test_fund_payment_emits_payment_funded_event — asserts the event payload matches the deposit (id/funder/token/amount).
    • test_fund_payment_emits_per_funding — asserts each funding (initial + top-up) emits its own event.

Security

Emission occurs only after the escrow transfer succeeds, matching the existing pattern for payment_success / payment_failed.

Closes #589

Off-chain systems could not observe escrow funding for retryable payments
without reading contract storage. This adds a PaymentFunded event carrying
the payment id, funder, token, and amount, emitted after the deposit transfer
is committed (emit-after-commit policy) so indexers never see an uncommitted
funding event.

Adds two tests asserting the event is emitted with the correct payload on a
single funding and on an initial+top-up funding pair.

Closes Stellopay#589
@jjb9707 jjb9707 requested a review from Jagadeeshftw as a code owner July 7, 2026 01:42
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.

Emit a fund_payment escrow-deposit event in payment_retry

1 participant