---
title: collateralForDebtUp
description: AVM that must be pledged to cover a USDC debt at the floor, rounded up.
---

> **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 floor value. Ceil so the locked tokens still cover the debt after rounding. This is [lockedCollateral](/developers/math/locked-collateral) and the burn size in [quoteSurrender](/developers/math/quote-surrender).

## Import

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

## Usage

```ts
const locked = collateralForDebtUp(position.debtRaw, snapshot.floorPriceWad);
```

## Return Value

`bigint` (AVM atoms, 18 decimals).

## Parameters

### debtRaw

- **Type:** `bigint` (`UsdcRaw`)

```ts
collateralForDebtUp(parseUsdc("10"), snapshot.floorPriceWad);
```

### floorPriceWad

- **Type:** `bigint` (`Wad`)

Must be `> 0`.

```ts
collateralForDebtUp(debtRaw, snapshot.floorPriceWad);
```

## Error

`InvalidAmountError` if `floorPriceWad <= 0`.
