Vaults

Product Overview

Vaults are specialized asset managers in the ZeUSD protocol, implementing the BaseVault interface to handle specific asset types and their interactions. The current implementation focuses on USYC vault management with support for secondary assets.

Core Components

1. Asset Management System

The Asset Management System handles both primary (USYC) and secondary assets through a structured approach:

1.1 Asset Registry

// Supported assets tracking
mapping(address => bool) private _supportedAssets;
address private immutable _primaryAsset;

Key Features:

  • Primary asset immutability

  • Dynamic secondary asset support

  • Asset validation checks

  • Event emission for tracking

2. Deposit Flow

Key Components:

  • Asset type detection

  • Amount validation

  • Slippage protection

  • Transfer security

3. Emergency Control System

Features:

  • Emergency mode activation

  • Time-delayed withdrawals

  • Admin-only controls

  • Event logging

4. Asset Support Management

Implementation:

function addAsset(
    address asset,
    string calldata reason
) external override {
    // Validation and addition logic
    emit Vault_AssetAdded(asset, reason);
}

5. Error Handling

Comprehensive error system:

error Vault_Unauthorized(address caller);
error Vault_AssetNotSupported(address asset);
error Vault_InvalidAmount();
error Vault_EmergencyModeActive(uint256 timestamp);
error Vault_SlippageExceeded(uint256 expected, uint256 actual, uint256 maxSlippage);

6. Events

event VaultPrimaryAssetOperation(
    address indexed user,
    uint256 amount,
    bool isDeposit
);

event VaultSecondaryAssetOperation(
    address indexed asset,
    address indexed user,
    uint256 amount,
    bool isDeposit
);

7. Security Features

Key Security Features:

  • Role-based access control

  • Pausable operations

  • Emergency mode

  • Slippage protection

  • Amount validation

  • Asset verification

8. Integration Flow

Integration Points:

  • Router interface

  • Registry validation

  • Asset transfers

  • Event emission

This documentation reflects the current implementation focusing on:

  • USYC vault specifics

  • Secondary asset support

  • Emergency controls

  • Security features

  • Integration patterns

The system provides a secure and flexible framework for managing USYC and secondary assets while maintaining protocol security and efficiency.

Last updated