borrowCapacity
Additional USDC that can be drawn against a position at the current floor.
floorValueDown(collateral) − debt, floored at 0. This is gross debt headroom before the 3% advance fee. quoteBorrow refuses amounts above this.
Import
import { borrowCapacity } from "@repo/contract-client/math";
Usage
const capacity = borrowCapacity(position, snapshot.floorPriceWad);
Also sv3.position.getBorrowCapacity(market, owner).
Return Value
UsdcRaw — 6-decimal USDC.
Parameters
position
- Type:
PersonalPosition
borrowCapacity(position, snapshot.floorPriceWad);
floorPrice
- Type:
Wad
Usually snapshot.floorPriceWad.
Error
None for empty positions. Floor must be positive to value collateral.
Tips
- Capacity uses down rounding on floor value so a quoted borrow still fits on-chain.
- Liquid reserve can still block a borrow (
InsufficientBacking) even when this number is large. Check getMaxActions.