Ethereum Vault Connector
The Ethereum Vault Connector (EVC) is a foundational layer designed to facilitate core lending market functionality. It serves as a base building block for various protocols, providing a robust and flexible framework for developers to build upon. The EVC primarily mediates between vaults - contracts that implement the ERC-4626 interface and contain additional logic for interfacing with other vaults.
Core Functionality
Vault Mediation
The EVC's primary role is to mediate between different vaults in the protocol. When a user wishes to borrow, they must link their accounts and collateral vaults to the borrowed-from vault via the EVC. The liability vault, also known as the "controller", is then consulted whenever a user wants to perform an action that could impact account solvency, such as withdrawing collateral.
The EVC is responsible for calling the controller, which determines whether the action is allowed or if it should be blocked to prevent account insolvency. This mediation ensures that all operations maintain the protocol's safety parameters while enabling complex cross-vault interactions.
Account Management
The EVC maintains a user's voluntary associations with vaults through several key mechanisms:
-
Collateral Management: Users deposit funds into collateral vaults and call
enableCollateral
for each vault they intend to use as collateral. This adds the vault to the account's collateral set. -
Controller Association: When a user wants to borrow from a vault, they must call
enableController
to add this vault to their controller set. This is a significant action as it submits the account to the rules encoded in the controller vault's code. -
Collateral Control: Once a controller is enabled, it can prevent withdrawals or disabling of collateral if such actions would violate the account's solvency requirements. The controller can also seize collateral to repay debt using the
controlCollateral
function.
Advanced Features
Batching
The EVC enables multiple operations affecting multiple vaults and external smart contracts to be performed within a single batch operation. This provides several benefits:
- More convenient for UI users
- More gas efficient
- Allows deferring liquidity checks until the end of the batch
Sub-accounts
The EVC introduces sub-accounts, allowing users to create multiple isolated positions within their single owner account. This feature enables:
- Easy rebalancing of collateral/liabilities between positions
- No need for additional approvals
- No special logic required from vaults
Operators
Users can attach external contracts to act on behalf of a sub-account. This generalizes the token approval system and enables powerful functionality:
- Intents support
- Stop-loss/take-profit/trailing-stop modifiers
- Layered position managers
Gasless Transactions
The EVC supports meta-transactions out of the box for both EOAs and contract wallets, enabling gasless transaction capabilities.
Security Features
Lockdown Mode
The EVC introduces a LOCKDOWN MODE
that can be activated by the owner for all their accounts simultaneously. In this mode:
- Owner is restricted to managing operators and nonces
- Operators are restricted to revoking their own permissions
- Calling external smart contracts is prohibited
- Controllers can still control collaterals for the accounts
Permit Disabled Mode
The PERMIT DISABLED MODE
can be activated by the owner to prevent execution of permits signed by the owner. This is particularly useful in emergency situations where harmful permit messages have been signed.
Authentication and Authorization
Vaults outsource their authentication to the EVC but handle authorization themselves. When a vault is invoked via the EVC's call
, batch
, or controlCollateral
functions:
- The vault sees the EVC as the
msg.sender
- The vault should call back into the EVC to retrieve the current execution context
- The vault receives the
onBehalfOfAccount
andcontrollerEnabled
status
For more detailed information about the implementation and technical specifications, please refer to the Ethereum Vault Connector repository.