How euler-xyz/ethereum-vault-connector works
Project type and purpose
• This is a Solidity‐based library/module called the “Ethereum Vault Connector” (EVC).
• Its primary purpose is to sit between ERC-4626 vault contracts and higher-level lending/borrowing protocols, handling the common logic of vault interactions (deposits, withdrawals, callbacks, batches, etc.).
File structure
• src/
• interfaces/ — ERC-4626 & other standard interfaces (IEthereumVaultConnector.sol, IVault.sol, IERC1271.sol)
• utils/ — supporting library code (EVCUtil.sol)
• EthereumVaultConnector.sol — main contract implementing connector logic
• ExecutionContext.sol, TransientStorage.sol, Set.sol — submodules for state management & reentrancy guards
• Events.sol, Errors.sol — centralized definitions
• certora/, audits/ — formal-verification and security artifacts
• test/ & forge-std/ — unit, invariant, fuzz tests under Foundry
• CI configs (.github/workflows/*.yml), slither/mythril configs for static analysis
Key README insights
• EVC abstracts away vault‐to‐vault plumbing so core lending contracts can focus on novel features.
• Integration is via “forge install,” and all logic is exercised with Foundry tests, Certora specs, Mythril, Slither, etc.
Components
a. Main components:
• EVC Core Module
– EthereumVaultConnector
– ExecutionContext, TransientStorage, Set, EVCUtil
– Errors & Events definitions
• External Vaults (any ERC-4626-compliant vault contracts)
• Lending Protocol Contracts (consume EVC API)
• Storage Layer (EVM storage via TransientStorage & Set)
• Interfaces (IERC4626, IERC1271, IVault)
• Tooling & Pipeline (Foundry test runner, Certora prover, Slither, GitHub Actions)
b. Relationships & interactions:
– Lending Protocol → calls → EthereumVaultConnector → dispatches → vault.deposit()/vault.withdraw()
– EVC modules share data via TransientStorage & Set
– ExecutionContext manages msg.sender spoofing, deferred checks
– Events emitted back to front‐end or off‐chain indexers
– CI tools analyze contracts and run tests
c. Architectural patterns & principles:
– Modular Solidity design: single‐responsibility contracts (Context, Storage, Connector)
– Interface‐driven development (ERC-4626 interface abstraction)
– Separation of concerns: connector vs. vault logic vs. core lending logic
– Declarative error handling (Errors.sol) and standardized events
d. Key technologies & libraries:
– Solidity, EVM
– ERC-4626 vault standard
– Foundry (forge) for testing
– Certora for formal verification specs
– Mythril & Slither for static analysis
– GitHub Actions for CI/CD