Skip to main content

What is a Vault?

A vault in Mewler is an isolated lending market for a single ERC-20 token. Each vault operates independently with its own:
  • Interest rate model
  • Collateral and borrowing parameters
  • Oracle configuration
  • Risk parameters
Vaults are deployed using the Mewler Vault Kit (MVK) and follow the ERC-4626 standard for share accounting.

Vault Types

Borrowable Vaults

Borrowable vaults allow users to:
  • Deposit assets to earn interest (supply)
  • Use deposited assets as collateral to borrow other assets
  • Borrow the vault’s underlying asset

Collateral-Only Vaults

Some vaults are configured as collateral-only, meaning:
  • Users can deposit assets to earn interest
  • Deposited assets can be used as collateral in other vaults
  • The vault’s underlying asset cannot be borrowed

Vault Accounting

Share-Based Model

Mewler uses a share-based accounting model similar to ERC-4626:
  • When you deposit assets, you receive vault shares (eTokens)
  • Shares represent your proportional claim on the vault’s assets
  • As interest accrues, the share price increases
  • When you withdraw, shares are redeemed at the current share price

Share Price Calculation

Share Price = Total Assets / Total Shares
The share price increases over time as borrowers pay interest, which is distributed to lenders.

Example

  1. Alice deposits 100 USDC when share price = 1.0
    • Receives: 100 eUSDC shares
  2. Interest accrues, vault now has 110 USDC
    • Share price = 110 / 100 = 1.1
  3. Bob deposits 110 USDC
    • Receives: 100 eUSDC shares (110 / 1.1)
  4. Total: 220 USDC, 200 shares, share price = 1.1
    • Alice can redeem 100 shares for 110 USDC
    • Bob can redeem 100 shares for 110 USDC

Vault Parameters

Collateral Factor

The collateral factor determines how much you can borrow against your collateral:
Max Borrow = Collateral Value × Collateral Factor
For example, with a 75% collateral factor:
  • 1000collateralcanborrowupto1000 collateral → can borrow up to 750

Liquidation Threshold

The liquidation threshold is the health score at which a position becomes liquidatable. Typically set lower than the collateral factor to provide a buffer.

Interest Rate Model

Each vault has an Interest Rate Model (IRM) that determines:
  • Supply APY: Interest earned by lenders
  • Borrow APY: Interest paid by borrowers
Rates adjust based on utilization (how much of the vault is borrowed).

Creating a Vault

Vaults are created using the Mewler Vault Kit. The process involves:
  1. Deployment: Deploy a new vault contract via the factory
  2. Configuration: Set parameters like:
    • Underlying asset
    • Interest rate model
    • Collateral factors
    • Oracle adapter
    • Optional hook targets
  3. Initialization: Initialize the vault with starting parameters
For detailed instructions, see the Developer Guide.

Vault Lifecycle

Deployment

A vault is deployed as an immutable contract (or upgradeable, depending on configuration).

Active Operation

  • Users deposit and withdraw
  • Borrowers take and repay loans
  • Interest accrues continuously
  • Liquidations occur when positions become unhealthy

Risk Management

Vault parameters can be adjusted by governance or risk stewards:
  • Collateral factors
  • Interest rate model parameters
  • Oracle configurations
  • Emergency pauses (if configured)

Cross-Vault Interactions

Using Vault Shares as Collateral

You can use eToken shares from one vault as collateral in another vault. This enables:
  • Leveraged positions
  • Complex DeFi strategies
  • Capital efficiency
Important: Using vault shares as collateral creates nested risk. If the underlying vault has issues, it can affect positions using its shares as collateral.

References

For more details on the underlying architecture, see: