This repository contains the source code for the smart contracts implementing Lido Defi-interface yield vault middleware.
Lido Defi-interface is an ERC4626-compliant vault infrastructure that enables integration of arbitrary ERC4626 yield strategies into wallets and applications. The system provides a foundation for yield aggregation with comprehensive security controls, fee management, and reward distribution.
The architecture implements:
- Abstract Vault base with ERC4626 compliance, access control, fee harvesting, inflation attack protection, and emergency mechanisms
- Protocol adapters for integrating various DeFi protocols
- Reward distribution system with configurable recipient allocations and two-step distribution flow
This project uses Foundry for development and testing, so you'll need to have Foundry installed.
-
Install Foundry and
forgehttps://book.getfoundry.sh/getting-started/installationcurl -L https://foundry.paradigm.xyz | bash foundryup -
Clone the repository
git clone https://github.com/your-org/lido-earn.git cd lido-earn -
Install forge dependencies
forge install
-
Verify installation
forge --version
This repository contains different sets of tests written using the Foundry framework:
-
Unit tests - Comprehensive tests covering each module in isolation (deposits, withdrawals, fees, access control, pausable behavior, emergency operations, etc.). This is the most thorough set of tests covering every edge case.
-
Integration tests - Tests that verify how contracts work in a forked environment using real protocol state:
- Mainnet fork tests - Verify integration with real ERC4626 vaults (e.g. Morpho) using mainnet state
- Reward distribution tests - End-to-end testing of fee collection and distribution flows
-
Invariant tests - Property-based fuzzing tests that verify critical system invariants hold under all conditions:
- Vault solvency and accounting correctness
- Reward distribution integrity
- Handler-based fuzzing for complex multi-step scenarios
The following commands can be used to run different types of tests:
-
Run all tests
forge test -
Run tests with detailed output
forge test -vvv -
Run specific test file
forge test --match-path test/unit/vault/Vault.Deposit.t.sol -
Run specific test function
forge test --match-test test_Deposit_Basic -
Run unit tests exclusively
forge test --match-path "test/unit/**/*.sol"
-
Run integration tests exclusively
forge test --match-path "test/integration/**/*.sol"
-
Run invariant tests exclusively
forge test --match-path "test/invariant/**/*.sol"
Note
For mainnet fork tests, you may need to configure MAINNET_RPC_URL in your environment if using specific RPC providers.
-
Install
lcovpackage in your OSbrew install lcov -OR- apt-get install lcov
-
Generate coverage report
forge coverage --report lcov genhtml lcov.info -o coverage-report
-
Open
./coverage-report/index.htmlin your browser.
- Foundry Book - Foundry framework documentation
- ERC4626 Standard - Tokenized vault standard specification
- Morpho Docs - Morpho protocol documentation
- OpenZeppelin Docs - Security primitives and token standards
This project is licensed under the MIT License.