How euler-xyz/euler-vault-kit works
The Euler Vault Kit is essentially a modular, on-chain library of smart contracts for building ERC-4626-style “credit vaults” on Ethereum. There is no UI/front-end; the primary components are Solidity contracts, a factory for deployment, a registry/config, a set of vault modules, and external dependencies/integration points.
Main System Type and Purpose
• Type: On-chain smart-contract library (no UI).
• Purpose: Deploy and manage “credit vaults” (ERC-4626 + borrowing) in a pluggable, modular fashion. Developers install via Foundry and integrate with other contracts or dApps.
Key Top-Level Components (derive from file structure & README)
a. GenericFactory (src/GenericFactory) – Deploys new vault instances.
b. SequenceRegistry (src/SequenceRegistry) – Stores ordered lists of modules/config for each vault type.
c. EVault Core (src/EVault)
– Shared storage and interfaces (src/EVault/shared/*).
– Modules (src/EVault/modules/*): BalanceForwarder, Governance, Liquidation, RiskManager, Vault.
d. ProtocolConfig & InterestRateModels (src/ProtocolConfig, src/InterestRateModels) – Global parameters and interest-rate logic.
e. Synths (src/Synths) – Optional synthetic assets integration.
f. Interfaces (src/interfaces) – ERC-4626, ERC-20, connector abstractions.
g. External Libraries (lib/*): OpenZeppelin, permit2, ethereum-vault-connector, forge-std.
h. Testing & Verification (test/*, certora/*, slither.config.json) – Off-chain test harness and formal tools.
Relationships & Data Flows
• User/client wallet or dApp → calls GenericFactory.createVault(params)
• GenericFactory → writes config to SequenceRegistry → deploys new EVault proxy
• EVault proxy delegates calls into modules (via internal dispatch)
– deposit/withdraw calls hit Vault module → updates balances
– borrow/repay calls hit Vault + RiskManager
– liquidation triggers call Liquidation module
– governance/admin calls hit Governance module → update ProtocolConfig
• EVault calls external ERC-20 tokens for transfers
• EVault may call ethereum-vault-connector to integrate with external yield protocols
• ProtocolConfig and InterestRateModels provide read-only parameters to modules
• Synths module mints/burns synthetic assets if configured
Important Patterns & Principles
• Modular contract design – each concern isolated in its own module
• Proxy / Factory pattern – GenericFactory + Registry + minimal proxy for upgradeability
• ERC-4626 standard compliance with extension for credit/borrow
• Pluggable interest-rate and protocol configuration
• Formal verification harnesses (Certora) and fuzz/invariant testing (Foundry, Echidna)