Skip to main content

Collateral Assets

Overview

Each fixed rate market implements a collateral framework to ensure that borrowers overcollateralize their debts with assets of greater value. The Market Manager provides functions to deposit and withdraw different types of collateral:

  • Collateral Assets (e.g., WETH, wstETH)
  • Loan Tokens
  • Fixed Tokens
  • Limit Orders

Deposit Collateral

function depositCollateral(
ILoanToken loanToken,
bytes32 collateralMarketId,
address onBehalf,
uint256 amount
) external nonReentrant
  • Deposits collateral assets into the market
  • Updates account's collateral balance
  • Supports deposits on behalf of other addresses

Withdraw Collateral

function withdrawCollateral(
ILoanToken loanToken,
address onBehalf,
uint256 amount
) external nonReentrant
  • Withdraws collateral if health check passes
  • Updates account state
  • Requires sufficient collateral balance

Fixed Token Management

Deposit Fixed Tokens

function depositFixed(
ILoanToken loanToken,
Seconds maturity,
address onBehalf,
uint256 amount
) external nonReentrant
  • Deposits Fixed Tokens as collateral
  • Maturity-specific accounting

Withdraw Fixed Tokens

function withdrawFixed(
ILoanToken loanToken,
Seconds maturity,
address onBehalf,
uint256 amount
) external nonReentrant
  • Withdraws Fixed Token collateral
  • Performs a health check
  • Validates maturity conditions
  • Requires sufficient balance

Limit Order Management

Deposit Limit Order

function depositLimitOrder(
ILoanToken loanToken,
Seconds maturity,
uint256 liquidityTokenId,
address onBehalf,
uint256 amount
) external nonReentrant
  • Deposits limit orders as collateral
  • Links to specific liquidity token

Withdraw Limit Order

function withdrawLimitOrder(
ILoanToken loanToken,
Seconds maturity,
address onBehalf,
uint256 amount
) external nonReentrant
  • Withdraws limit order positions
  • Performs a health check

Loan Token Management

Deposit Loan

function depositLoan(
ILoanToken loanToken,
address onBehalf,
uint256 amount
) external nonReentrant
  • Deposits Loan Tokens as collateral
  • Updates account loan balance
  • Supports deposits on behalf

Withdraw Loan

function withdrawLoan(
ILoanToken loanToken,
address onBehalf,
uint256 amount
) external nonReentrant
  • Withdraws Loan Token balance
  • Performs a health check
  • Requires sufficient balance