Skip to content

Emit payment milestone events at 25%, 50%, 75%, and 100% funded #333

Description

@Kingsman-99

Overview

There are no events emitted when an invoice crosses a funding threshold. Add milestone events so off-chain indexers and the app can react to progress without polling get_invoice.

Acceptance Criteria

  • After each pay_invoice, check if funded_amount crossed a milestone threshold since last check
  • Milestones: 25%, 50%, 75%, 100% of target_amount
  • Each milestone emitted at most once per invoice (tracked in instance storage)
  • Event: MilestoneReached { invoice_id, milestone_bps: u32, funded_amount: i128, ledger: u32 }
  • milestone_bps: 2500, 5000, 7500, 10000 for 25/50/75/100%
  • Multiple milestones can be crossed in a single payment (e.g. one large payment crosses 50% and 75%) — emit both events
  • Milestone tracking stored per invoice; does not affect rent cost significantly
  • Integration tests: single payment crossing 2 milestones, exact milestone hit, overfunded invoice

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 ptseventsContract events and indexer support

    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