Overview
There is no on-chain source of truth for protocol-wide stats. Add instance-storage aggregate counters that track total invoices created, total XLM volume, and total recipients paid across all time.
Acceptance Criteria
- Instance storage fields:
stats_total_invoices: u64, stats_total_volume: i128, stats_total_recipients_paid: u64
- Counters incremented atomically in
create_invoice, pay_invoice, and release_funds respectively
get_stats() view function returns all three counters
- Emits
StatsUpdated { total_invoices, total_volume, total_recipients_paid, ledger } event on each change
- Counters overflow-safe: use
checked_add with StatsOverflow error
- Stats are instance storage (persists without rent; no TTL)
- Integration tests: counters after 1 invoice cycle, counters after 5 invoices, overflow guard
Overview
There is no on-chain source of truth for protocol-wide stats. Add instance-storage aggregate counters that track total invoices created, total XLM volume, and total recipients paid across all time.
Acceptance Criteria
stats_total_invoices: u64,stats_total_volume: i128,stats_total_recipients_paid: u64create_invoice,pay_invoice, andrelease_fundsrespectivelyget_stats()view function returns all three countersStatsUpdated { total_invoices, total_volume, total_recipients_paid, ledger }event on each changechecked_addwithStatsOverflowerror