---
title: quoteBorrow
description: Quote a non-recourse USDC advance against pledged AVM collateral.
---

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

Increases position debt by `amount`. Net USDC out is amount minus the **3%** advance fee. Spot does not move, so `priceImpact` is `null` (not zero).

Local math refuses over-capacity even if an on-chain quoter still returns a struct. Capacity is [borrowCapacity](/developers/math/borrow-capacity): floor value of collateral minus existing debt.

The position has no interest and no due date. Locked tokens stay pledged until repay, shrink, or [quoteSurrender](/developers/math/quote-surrender).

## Import

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

## Usage

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

const quote = quoteBorrow(snapshot, position, parseUsdc("10"));

quote.grossDebtIncreaseRaw;
quote.netReserveOutRaw;
quote.borrowCapacityRaw;
quote.fees.totalRaw; // 3% of gross
quote.position.debtRaw; // previous + amount
quote.priceImpact; // null
```

Load `position` from [getAccountContext](/developers/get-account-context). Size the slider with [getMaxActions](/developers/math/get-max-actions).

## Return Value

`BorrowQuote`

| Field                  | Meaning                                   |
| ---------------------- | ----------------------------------------- |
| `kind`                 | `'borrow'`                                |
| `grossDebtIncreaseRaw` | Debt added (the `amount` you passed)      |
| `netReserveOutRaw`     | USDC the wallet receives                  |
| `borrowCapacityRaw`    | Capacity **before** this borrow           |
| `fees`                 | 3% split (protocol / creator / floor)     |
| `position`             | Resulting collateral (unchanged) and debt |
| `priceImpact`          | `null`                                    |

## Parameters

### snapshot

- **Type:** `MarketSnapshot`

Needs `floorPriceWad` and `balances.liquidReserveRaw`. The liquid reserve must cover net out plus withdrawable fee legs.

```ts
quoteBorrow(snapshot, position, parseUsdc("10"));
```

### position

- **Type:** `PersonalPosition`

`{ owner, collateralAvm, debtRaw }`.

```ts
quoteBorrow(snapshot, account.position, parseUsdc("10"));
```

### amount

- **Type:** `UsdcRaw`

Gross debt increase. ≥ `100` raw and ≤ remaining capacity.

```ts
quoteBorrow(snapshot, position, asUsdcRaw(10_000_000n));
```

## Error

| Error                                          | When                                 |
| ---------------------------------------------- | ------------------------------------ |
| `ProtocolRevertError` `BelowMinimum`           | `amount < 100`                       |
| `ProtocolRevertError` `BorrowCapacityExceeded` | `amount > capacity`                  |
| `ProtocolRevertError` `InsufficientBacking`    | Liquid reserve cannot pay net + fees |

## Tips

- Borrow does not mint. Collateral must already sit in the position (from a buy-and-pledge / expand, or a prior deposit).
- Fee surplus from the 3% still goes toward future floor raises, same as trade fees.
