Implementation Path

ERC-4626 Core Mechanics Overview

Learn how ERC-4626 converts between assets and shares, previews operations, applies limits, and handles rounding.

DifficultyGuided
Estimated1h 50m
Versionv0.1.0
AvailabilityAvailable

From Vault basics to ERC-4626

The previous Vault Path introduced assets, shares, deposits, withdrawals, totalAssets(), totalSupply, and proportional ownership.

This Path adds the remaining core ERC-4626 mechanics: mint, redeem, non-1:1 conversions, Preview functions, maximum functions, and rounding.

The goal is to understand the accounting well enough to recognize unsafe implementations and test the main invariants with Foundry. This Path focuses on the core mechanics, not every ERC-4626 edge case or a specific exploit.

Learning objectives

  • Explain the difference between deposit, mint, withdraw, and redeem.

  • Convert assets to shares and shares to assets when the exchange rate is not 1:1.

  • Match each Preview function with its corresponding operation.

  • Use the maximum functions to understand the Vault’s current operational limits.

  • Identify the correct rounding direction and test that an operation does not transfer unfair value between users.