Vaults, collateral, and risk
Deposit, withdraw, and read vault-held collateral; determine collateral requirements, factors, and risk.
Collateral lives in the CollateralVault, not in the LOC. You deposit tokens once, and each open LOC
reserves part of that balance for as long as it lasts — which is why a vault balance comes back
split into what is available and what is reserved. sdk.vault.getCollateralBalance reports what you
hold, sdk.loc.getCollateralTokens lists what the vault accepts, and sdk.loc.getCollateralFactor
returns a pair’s creation and liquidation factors.
How much a LOC needs depends on its pair: a static LOC is backed 1:1 in the token it credits, while
a dynamic one is backed by a different token at an oracle price and the pair’s collateral factor.
Prefer sdk.loc.getRequiredCollateralForDynamic, which fetches the price and factor for you and
returns undefined for a disabled pair;
computeRequiredCollateral below is the
bare arithmetic for callers that already hold both. Once a LOC exists,
assessLetterOfCreditRisk evaluates its
current outstanding state with a sourced pair price, current configuration and an explicit clock.
Reservations are generic vault facts. sdk.vault.getCollateralReservations retains full chain,
vault and reservation identity;
deriveCollateralAllocations groups
active amounts by account, token and reserving contract. Select an older compatible vault explicitly
for its balances, allowances, deposits, withdrawals and signatures without mutating the SDK profile.
Deposits and withdrawals go through sdk.vault.buildDepositWorkflow and buildWithdrawWorkflow; a
signature-only allowance can pre-authorize a deposit without a transaction. The oracle price itself,
and a token’s identity independent of the protocol, are in
Pricing and oracles and Tokens and balances.
The collateral-factor model is set out in the Collateral and risk guide.
How much WETH backs 1,000 USDC of face value:
const price = await sdk.pricing.getPrice({ inputToken: WETH, outputToken: USDC,});const factor = await sdk.loc.getCollateralFactor({ collateralToken: WETH, creditedToken: USDC,});// The SDK returns undefined for an unconfigured pair. A configured pair// with a zero creation factor also cannot back a new dynamic LOC.if (!factor || factor.creationCollateralFactorBasisPoints === 0n) { throw new Error('WETH/USDC is not a configured pair');}// 1,000 USDC = 1_000_000_000n (6 decimals). At an 8_000 bp creation// factor// the collateral must be worth 1000 / 0.80 = 1,250 USDC. At $2,000/ETH// that is 0.625 WETH = 625_000_000_000_000_000n wei.const requiredWei = computeRequiredCollateral( price, 1_000_000_000n, factor.creationCollateralFactorBasisPoints);Primary APIs
Functions
deriveCollateralAllocations— Groups active reservations by their actual reserving contract, account, asset and vault namespace.
Interfaces
CollateralReservation— Generic vault reservation facts.VaultModule— Vault operations: collateral balance queries, deposits, withdrawals, and allowance signature workflows.
Supporting types and functions in this group are not listed here; each has its own page, listed with the group in the sidebar.