feat(payment_retry): emit PaymentFunded event on fund_payment#692
Open
jjb9707 wants to merge 16 commits into
Open
feat(payment_retry): emit PaymentFunded event on fund_payment#692jjb9707 wants to merge 16 commits into
jjb9707 wants to merge 16 commits into
Conversation
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
…h contract convention; detect via String topic in tests
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
fund_payment()inonchain/contracts/payment_retry/src/lib.rsrecords 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
PaymentFundedevent withpayment_id,funder,token, andamount, emitted after the deposit transfer is committed (emit-after-commit policy) so indexers never observe an uncommitted funding event.Changes
PaymentFundedEventcontract type (documented fields).fund_paymentnow publishes("payment_funded", payment_id)carrying the event payload aftertoken_client.transfer(...).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