Skip to content

docs: add ContractError guide, event Indexer Guides, calc.rs rationale, InvoiceExt3 storage layout - #667

Open
laddyr141-ui wants to merge 4 commits into
Stellar-split:mainfrom
laddyr141-ui:docs-639-642
Open

docs: add ContractError guide, event Indexer Guides, calc.rs rationale, InvoiceExt3 storage layout#667
laddyr141-ui wants to merge 4 commits into
Stellar-split:mainfrom
laddyr141-ui:docs-639-642

Conversation

@laddyr141-ui

Copy link
Copy Markdown

Title

docs: add ContractError guide, event Indexer Guides, calc.rs rationale, InvoiceExt3 storage layout

Body

This PR adds documentation-only improvements requested across four issues. No code or logic was changed.

#639 — Adds an "Adding a new ContractError variant" section to CONTRIBUTING.md, explaining the append-only discriminant rule from contracts/split/src/error.rs, with a before/after code snippet showing how to correctly add a new variant.

#640 — Adds # Indexer Guide sections to milestone_reached and funding_checkpoint in contracts/split/src/events.rs, following the format already used by invoice_state_changed. Each explains the topic filter, the meaning of milestone_bps / threshold_bps, and the event's data fields.

#641 — Expands the module doc in contracts/split/src/calc.rs with a # Why largest-remainder? section explaining why floor division alone leaves up to n-1 stroops undistributed, how the largest-remainder method fixes this while preserving the sum(result) == total invariant, and a numeric example (10 among 3 equal shares -> [4, 3, 3]).

#642 — Adds a # Storage layout section to InvoiceExt3 in contracts/split/src/types.rs. Based on reading get_invoice_ext3 in lib.rs, InvoiceExt3 is not stored as a single serialized struct under one key — it's assembled at read time from four independent persistent-storage entries (rel_dly, fund_led, meta_hsh, paid_rec), each keyed by (Symbol, u64) with the invoice id. The section documents this accurately, including why the fields are split rather than merged into a single InvoiceKey-style entry.

Closes #639
Closes #640
Closes #641
Closes #642

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@laddyr141-ui Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant