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
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
pay_invoice, check iffunded_amountcrossed a milestone threshold since last checktarget_amountMilestoneReached { invoice_id, milestone_bps: u32, funded_amount: i128, ledger: u32 }milestone_bps: 2500, 5000, 7500, 10000 for 25/50/75/100%