This project demonstrates how to perform liquidations on various DeFi projects using Foundry. It includes liquidator contracts and test scripts for Compound V3, Init, and Silo protocols.
MEV (Maximal Extractable Value) Liquidators is a collection of smart contracts and test scripts that simulate and execute liquidations on different DeFi protocols. This project serves as an educational resource and a starting point for developers interested in MEV and liquidation mechanisms.
src/
: Contains the main contract implementationsInitLiquidator.sol
: Liquidator contract for Init protocolSiloLiquidator.sol
: Liquidator contract for Silo protocol
test/
: Contains test scriptstestCompoundV3Liquidator.t.sol
: Test script for Compound V3 liquidationstestInitLiquidator.t.sol
: Test script for Init liquidationstestSiloLiquidator.t.sol
: Test script for Silo liquidations
-
Clone the repository:
git clone https://github.com/alikonuk1/mev-liquidators.git cd mev-liquidators
-
Install dependencies:
forge install
-
Set up environment variables: Create a
.env
file in the project root and add your private key:PRIVATE_KEY=your_private_key
To run all tests:
forge test
To run a specific test file:
forge test --match-path test/testCompoundV3Liquidator.t.sol
forge test --match-path test/testInitLiquidator.t.sol
forge test --match-path test/testSiloLiquidator.t.sol
The test scripts simulate various scenarios:
- Depositing assets
- Borrowing against collateral
- Simulating price drops
- Executing liquidations
- Verifying solvency and balance changes
Contributions are welcome! Please feel free to submit a Pull Request.
This project is for educational purposes only. Always exercise caution when interacting with DeFi protocols.
This project is licensed under the MIT License.