lockedCollateral
AVM that must stay pledged to cover a position's debt at the current floor.
Ceil-rounded AVM whose floor value covers position.debtRaw. Same formula as collateralForDebtUp. Zero debt locks zero tokens.
Import
import { lockedCollateral } from "@repo/contract-client/math";
Usage
const locked = lockedCollateral(position, snapshot.floorPriceWad);
A floor raise reduces locked collateral for the same debt, which is why raises increase borrow capacity.
Return Value
AvmAtoms
Parameters
position
- Type:
PersonalPosition
Uses position.debtRaw.
lockedCollateral(position, snapshot.floorPriceWad);
floorPrice
- Type:
Wad
Must be > 0 if debt is nonzero.
Error
InvalidAmountError if floorPrice <= 0 and debt is being converted.
Tips
- Surrender burns exactly this amount (for the cancelled debt slice), not the whole position.