---
title: quoteShrinkExactReserveOut
description: Quote shrinking a position so the wallet receives an exact net USDC amount.
---

> **For AI agents:** the complete documentation index is at [llms.txt](/llms.txt). Append `.md` to any page URL for its markdown version.

Inverse shrink: sell whatever AVM is needed so that sell proceeds cover `debtDecrease` **plus** `netReserveToUser`. Uses [quoteSellExactReserveOut](/developers/math/quote-sell-exact-reserve-out) under the hood (expensive sell selector).

Fails if the implied AVM exceeds position collateral.

## Import

```ts
import { quoteShrinkExactReserveOut } from "@repo/contract-client/math";
```

## Usage

```ts
import { parseUsdc } from "@repo/contract-client";
import { quoteShrinkExactReserveOut } from "@repo/contract-client/math";

const quote = quoteShrinkExactReserveOut(snapshot, position, {
  netReserveToUser: parseUsdc("8"),
  debtDecrease: parseUsdc("2"),
});

quote.collateralRemoved;
quote.debtDecreaseRaw;
quote.netReserveToUserRaw;
```

## Return Value

`ShrinkQuote` with `kind: 'shrinkExactReserveOut'`. Same fields as [quoteShrinkExactAvmIn](/developers/math/quote-shrink-exact-avm-in).

## Parameters

### snapshot

- **Type:** `MarketSnapshot`

### position

- **Type:** `PersonalPosition`

### params.netReserveToUser

- **Type:** `UsdcRaw`

USDC that should remain after repay.

### params.debtDecrease

- **Type:** `UsdcRaw`

Clamped to current debt.

```ts
quoteShrinkExactReserveOut(snapshot, position, {
  netReserveToUser: parseUsdc("8"),
  debtDecrease: parseUsdc("2"),
});
```

## Error

`InsufficientFreeCollateral` if the implied sell burns more AVM than the position holds. Nested exact-out sell errors otherwise.

## Tips

- Prefer [quoteShrinkExactAvmIn](/developers/math/quote-shrink-exact-avm-in) when the user is picking a collateral amount.
