> For the complete documentation index, see [llms.txt](https://docs.term.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.term.finance/terminal-1-execution/workflows/repay-loop-out.md).

# Repay / Loop-out

Repay / Loop-out is the Terminal 1 workflow for exiting an existing position by repaying debt and unwinding linked exposure using a **flash-loan-backed route**. Terminal 1 composes the required steps into a single atomic execution flow so users do not need to manually sequence repays, swaps, collateral movements, and venue interactions.

<figure><img src="/files/nnX6RVqZAg5O8W3sHNnd" alt=""><figcaption></figcaption></figure>

### When to use it

* You want to exit a fixed-term position cleanly without manually unwinding intermediate steps.
* You want to unwind looping exposure (repay + deleverage) in one execution flow.
* You want to close without pre-funding all intermediate tokens in your wallet.

### What the route does (high level)

A repay / loop-out route generally:

* takes flash liquidity to source repayment funds,
* repays the debt and releases the position’s collateral,
* performs any required swaps to repay the flash loan,
* unwinds linked exposure created by prior looping paths (where applicable),
* returns remaining assets to the user per route outputs and constraints.

### Route selection (solver)

Terminal 1 uses a solver to construct an optimal repay / loop-out route given your position and available venues. The solver searches supported routes (including swaps and ERC‑4626 withdrawals where applicable) to maximize net token returns and minimize unnecessary slippage, subject to route constraints and execution safety checks.

### What to review before signing

* source repayment funds
* repay debt
* unlock or return collateral
* swap or transfer released assets as needed

### Common failure cases

* Required approvals/permits are missing or insufficient.
* Swap execution is stale or worse than expected and the flash repayment cannot be satisfied.
* Route constraints fail (fees, buffers, deadlines, or venue constraints).
* External venue conditions change during execution (liquidity moved, quote expired).

### Notes

Close / Loop-out is an execution workflow. It does not change core protocol mechanics, fees, or penalties; it changes how actions are composed into a single atomic route.
