Exit & recovery
Describe the next safe step, including cancellations and delayed withdrawals.
On this page
exit.next(context)
The exit context includes the account snapshot, slippage policy and a minimum_receive helper. The integration chooses the next bounded step. It must support ordinary closure and keeper recovery without requiring fresh cooperation from the borrower.
PluginExit
type ExitResult =
| { status: "execute"; step_id: string; plan: PluginPlan }
| { status: "wait"; tracking_id: string; retry_at: number }
| { status: "blocked"; reason: string }
| { status: "done" };Choose the next step
| State | Next step |
|---|---|
| Resting or partially filled orders | Request cancellation, then reconcile the final fill and refund. |
| Delayed redemption or unstake | Wait for the existing request; do not submit a duplicate. |
| Open position | Close, redeem or withdraw using an admitted recovery call. |
| Non-settlement holdings | Execute a protected conversion into the House settlement asset. |
| No app obligations | Return done; facility repayment and safe closure continue separately. |
step_id identifies the chosen operation at the observed state. retry_at is a Unix timestamp. blocked needs an actionable reason such as recovery-liquidity-unavailable.
Required checks
- The destination stays under Credit Account or settlement-inbox control.
- Output minima and input maxima are bound to the approved recovery policy.
- Unknown liabilities or positions prevent done.
- A request and the position it replaces are not counted twice.
- Only admitted dust can remain; token balances cannot be discarded arbitrarily.
- After each step, reread and verify state before advancing.