---
title: supplyForPrice
description: Curve supply at which the linear curve reaches a target spot price.
---

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

Inverse of [priceAtSupply](/developers/math/price-at-supply). Returns the supply on the piecewise line whose price equals `price` (or the boundary of that region).

## Import

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

## Usage

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

const supply = supplyForPrice(snapshot.engine, parsePrice("0.001"));
```

## Return Value

`AvmAtoms` — curve supply, 18 decimals.

## Parameters

### state

- **Type:** `LinearCurveState`

```ts
supplyForPrice(snapshot.engine, snapshot.spotPriceWad);
```

### price

- **Type:** `Wad`

Target USDC per AVM. Below floor returns 0. Far above the line returns the region's end.

```ts
supplyForPrice(snapshot.engine, asWad(10n ** 15n));
```

## Error

`InvalidAmountError` if price is not positive or the state is invalid.
