Skip to content

Build invoice payment notification hooks #141

@Kingsman-99

Description

@Kingsman-99

Label: complexity: high
Points: 200

Description

External contracts need to react to every payment event for composable DeFi workflows. This issue adds payment_hook: Option<Address> to create_invoice() — after every successful pay(), the contract calls on_payment(invoice_id, payer, amount) on the registered hook contract.

Technical Context

Involves types.rs (add payment_hook: Option<Address>) and lib.rs pay(). After updating invoice.funded and before auto-release check, if payment_hook is Some, invoke it via cross-contract call with (invoice_id, payer, amount). Hook failure must not revert the payment.

Acceptance Criteria

  • create_invoice() accepts optional payment_hook
  • Hook called after every successful pay()
  • Hook failure does not revert the payment transaction
  • payment_hook = None produces identical behaviour to current implementation
  • Test mocks hook contract and verifies it is called with correct arguments
  • All existing cargo tests pass
  • cargo clippy passes with zero warnings

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 pts

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions