Skip to main content

DepositVault

The DepositVault contract securely holds user deposits that serve as collateral for credit lines and as the source of funds for yield generation.

Overview

  • Pattern: UUPS Upgradeable Proxy
  • Solidity Version: 0.8.24
  • Dependencies: OpenZeppelin Contracts v5

Key Functions

deposit

function deposit(address token, uint256 amount) external

Deposits tokens into the vault. The caller must have approved the vault to spend the specified amount.

Parameters:

  • token -- ERC-20 token address
  • amount -- Amount to deposit (in token's native decimals)

Events: Deposited(address indexed user, address token, uint256 amount)

withdraw

function withdraw(address token, uint256 amount) external

Withdraws tokens from the vault. The withdrawal will revert if it would cause the user's health factor to drop below the minimum threshold (1.5).

Parameters:

  • token -- ERC-20 token address
  • amount -- Amount to withdraw

Events: Withdrawn(address indexed user, address token, uint256 amount)

getBalance

function getBalance(address user, address token) external view returns (uint256)

Returns the user's deposit balance for a specific token.

getCollateralValue

function getCollateralValue(address user) external view returns (uint256)

Returns the total USD value of all of a user's deposits, weighted by collateral factors. Uses the OracleReader for price data.

Supported Tokens

The vault accepts deposits in the following tokens:

TokenCollateral Factor
USDC95%
USDT90%
DAI90%
WETH80%
wstETH75%

New tokens can be added through governance proposals.

Security Considerations

  • Deposits are held in the contract, not sent to external protocols (the YieldRouter handles yield deployment)
  • Emergency withdrawal is available even when the contract is paused
  • Withdrawal checks ensure health factor remains safe

Next Steps