---
title: areaAtSupply
description: Integral of the linear curve from 0 to a supply, in WAD.
---

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

Certified area under the price curve. Rounding `'up'` or `'down'` is explicit — backing uses the conservative pair (area up, floor value down).

The USDC (6dp) form is `areaAtSupplyRaw(snapshot, supply, rounding)` on the same module.

## Import

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

## Usage

```ts
const areaUp = areaAtSupply(snapshot.engine, snapshot.curveSupply, "up");
const areaDown = areaAtSupply(snapshot.engine, snapshot.curveSupply, "down");
```

## Return Value

`Wad` — 18-decimal USDC·AVM area. Convert to reserve units with [wadToRaw](/developers/math/wad-to-raw).

## Parameters

### state

- **Type:** `LinearCurveState`

```ts
areaAtSupply(snapshot.engine, snapshot.curveSupply, "up");
```

### supply

- **Type:** `AvmAtoms`

Upper bound of the integral (from 0).

### rounding

- **Type:** `'up' | 'down'`

There is no default. Callers must pick.

```ts
areaAtSupply(snapshot.engine, supply, "down");
```

## Error

`InvalidAmountError` on negative supply or a state that fails [validateState](/developers/math/validate-state).

## Tips

- [requiredBacking](/developers/math/required-backing) is `floorLiability + (areaUp(curveSupply) − floorValueDown(curveSupply))`.
