feat(repayment): idempotency and no-double-repay guards (#148) - #231
feat(repayment): idempotency and no-double-repay guards (#148)#231bilhokista wants to merge 1 commit into
Conversation
…VaultLink#148) Add explicit status guards rejecting repayment calls when an invoice or offer is already Repaid, and ensure settled obligations cannot be double-repaid. Add unit tests covering retry and duplicate partial settlement.
|
Warning Review limit reachedNext included review available in 15 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Note
|
samjay8
left a comment
There was a problem hiding this comment.
🤖 Auto-merge bot —
Please request assignment before opening a PR. Maintainers assign issues to avoid duplicate work and ensure quality review.
Once assigned, this PR will be re-evaluated automatically.
Summary
Adds explicit status-based idempotency and double-repay guards to
repay_invoicein the repayment contract:ContractError::InvalidTransition(Invoice-as-NFT tokenization #3) ifinvoice.status == InvoiceStatus::Repaidoroffer.status == OfferStatus::Repaid.ContractError::InvalidTransition(Invoice-as-NFT tokenization #3) ifremaining_principal <= 0, preventing redundant repayment executions against already settled loan principal.repay_invoice.Error(Contract, #3).clippy::needless_borrowwarning in test setup helpers.Type of change
Checklist
cargo testpassescargo clippy -- -D warningspasses (CI)stellar contract buildsucceedsRelated issues
Closes #148