SV3 logo

collateralForDebtUp

AVM that must be pledged to cover a USDC debt at the floor, rounded up.

Inverse of floor value. Ceil so the locked tokens still cover the debt after rounding. This is lockedCollateral and the burn size in quoteSurrender.

Import

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

Usage

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

Return Value

bigint (AVM atoms, 18 decimals).

Parameters

debtRaw

  • Type: bigint (UsdcRaw)
collateralForDebtUp(parseUsdc("10"), snapshot.floorPriceWad);

floorPriceWad

  • Type: bigint (Wad)

Must be > 0.

collateralForDebtUp(debtRaw, snapshot.floorPriceWad);

Error

InvalidAmountError if floorPriceWad <= 0.