feat: permissionless liquidation trigger for defaulted invoices - #1045
Open
Dannyswiss1 wants to merge 1 commit into
Open
feat: permissionless liquidation trigger for defaulted invoices#1045Dannyswiss1 wants to merge 1 commit into
Dannyswiss1 wants to merge 1 commit into
Conversation
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.
Title: feat: permissionless liquidation trigger for defaulted invoices
Suggested branch:
feat/1037-permissionless-liquidation-triggerBody:
Summary
First slice of the end-to-end liquidation pipeline proposed in #1037: a permissionless keeper entrypoint for the collateral-seizure step of the state machine.
PoolContract::liquidate_invoice(caller, invoice_id)— any address can trigger it once an invoice is objectivelyDefaultedon the invoice contract. Unlike the existingseize_collateral, there's no admin/governance-proposal gate on the trigger itself.seize_collateral_corehelper so both the governance path (execute_seize_collateral) and the new permissionless path share one idempotency guard (CollateralDeposit.settled) and onenon_reentrant!lock — a defaulted invoice cannot be double-liquidated through either path.liq_started/liq_seizedevents (separate from the existingcol_seiz_default) so the indexer can later distinguish keeper-triggered liquidations for pipeline-stage tracking.packages/sdk: addPoolClient.liquidateInvoice()(the keeper-trigger call) andPoolClient.getCollateralDeposit()(a liquidation-status query), plus theCollateralDeposittype.This covers only the "mark defaulted → seize collateral" step. Still open, per #1037's full acceptance criteria:
insurance.file_claimas a keeper-chained follow-up call — pool can't call it atomically due to Soroban's pool→insurance→pool re-entrancy restriction, noted in the code)Test plan
cargo test -p pool --lib liquidate_invoice— 3/3 new tests pass (permissionless happy path, rejection when not yet defaulted, double-liquidation rejection via both permissionless and governance paths)cargo test -p pool --lib seize_collateral— all 6 existing tests still pass (no regression from the refactor)tsc --noEmitclean inpackages/sdkpackages/sdkJest suite passes (4/4)Closes #1037