Add ADRs for insurance pool, NFT invoices, multisig admin; add SDK getLpInvoices - #589
Merged
Merged
Conversation
Document the insurance_pool contract's separation from invoice_liquidity, its accounting-not-custody stub scope, timelocked admin actions, and the still-unwired claim_default integration hook, per issue Invoice-Liquidity-Network#555.
Document the InvoiceNftMetadata data model, its mint/transfer/burn lifecycle design, and that the lifecycle is not yet wired into submit_invoice/fund_invoice/mark_paid, per issue Invoice-Liquidity-Network#556.
Document the M-of-N threshold scheme, proposal expiration window, and admin action types in multisig.rs, and note that the lib.rs/storage.rs/ errors.rs integration was lost in a prior merge conflict resolution and is not currently reachable from the contract's public API, per issue Invoice-Liquidity-Network#557.
Expose the contract's list_invoices_by_lp(lp, page, page_size) view as getLpInvoices, a read-only simulation that needs no caller-supplied source account, matching the getReputation/getTopPayers convention. Wired into the free-function API, ILNClient, and the iln singleton.
|
@Samuel1505 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! 🚀 |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #555,
closes #556,
closes #557,
closes #558.
Docs — Architecture Decision Records
docs/adr/ADR-006-insurance-pool-design.md: documents why theinsurance pool is a separate contract from
invoice_liquidity, theaccounting-not-custody / flat-coverage-cap scope of the current stub, the
timelocked coverage/admin-change flow, and the
claim_default→ poolclaimintegration hook. Flags that the hook is documented indocs/insurance-pool-design.mdbut not yet wired intoclaim_default.docs/adr/adr-007-nft-invoice-representation.md: documents theInvoiceNftMetadatadata model and the mint/transfer/burn lifecycle designin
contracts/invoice_liquidity/src/nft.rs. Flags that none ofmint_invoice_nft,transfer_invoice_nft, orburn_invoice_nftarecurrently called from
submit_invoice,fund_invoice, ormark_paid—only the read-only queries are wired into the contract's public API today.
docs/adr/adr-008-multisig-admin.md: documents the M-of-Nthreshold scheme, the 24-hour (
MULTISIG_WINDOW_LEDGERS) proposalexpiration window, and the closed
AdminActionenum incontracts/invoice_liquidity/src/multisig.rs. Flags — traced viagit logand
MULTISIG_IMPLEMENTATION.md— that the full contract integration(
initialize_multisig_admin,propose_pause/propose_unpause,sign_proposal,execute_proposal) shipped in commitd267e36but waslost from
lib.rsin a later merge-conflict resolution (9e94e45); themodule and its test suite (
tests_multisig_admin.rs) exist but are notdeclared in
lib.rsand are not reachable from the contract today.docs/adr/README.md.Each ADR documents the design as built, including where the
implementation currently falls short of the original design, so contributors
don't assume more is wired up than actually is.
SDK —
getLpInvoices(#558)getLpInvoices(server, contractId, lp, page?, pageSize?, networkPassphrase?)in
sdk/src/methods/lpInvoices.ts, wrapping the contract'slist_invoices_by_lp(lp, page, page_size)view(
contracts/invoice_liquidity/src/lib.rs:627).pagedefaults to0,pageSizedefaults to10(the contract itselfclamps
page_sizeto 50). Returns a decodedInvoice[]for the requestedpage (empty past the last page), reusing the existing
decodeInvoicehelper.
listInvoicesByLPinqueries.ts(which requires thecaller to construct and pass a
sourceAccount), this method follows thenewer
getReputation/getTopPayersconvention: a self-contained read-onlysimulation with a G-address validity check, no caller-supplied account
needed.
ILNClient#getLpInvoicesand theilnsingleton, and exportedfrom
sdk/src/index.ts.Test plan
sdk/src/methods/lpInvoices.test.ts— decoded page of invoices,default/custom
page/pageSizepassed through asu32, empty page, emptyretval, invalid-address rejection, RPC/simulation errors.
sdk/src/client.test.ts—iln.getLpInvoicesthrows beforeiln.configure(...)is called.npx vitest run(sdk) — same 13 pre-existing failures across 5 filespresent on
mainbefore this change (unrelated:nft.test.tsmockaccount setup,
governance.test.tsfilter assertion, aget_token_decimalsaddress-type test); all new tests pass, total passingcount increased by 10 with no new failures.
npx tsc --noEmit(sdk) — same 18 pre-existing error lines onmain(unrelated:
batch.ts,client.ts:389,events/types.ts,xdrDecoder.ts:33); no new errors introduced (verified viagit stashdiff against
main).npx eslinton all touched/added files — clean.since they are documentation-only; the "not wired up" findings recorded in
the multisig and NFT ADRs were confirmed by grepping
lib.rsfor therelevant module/function names and cross-checking with
git log.