ityfuzz
ityfuzz copied to clipboard
Feature: Better Liquidation Support
Currently, for EVM program fuzzing, we use Uniswap V2 / Pancakeswap for borrowing flash loan. Specifically, we provide hacker ETHs and swap these ETHs into the desired token using Uniswap router during flash loan phase, and swap it back to ETHs during the liquidation phase. However, the majority of tokens have migrated to Uniswap V3. We want to support both V2/V3 during flashloan and liquidation, and here are the actionable items:
- [ ] Build a quotation algorithm that is provided with (an array of paths with their reserves information, # of desired token expected to receive) and returns an array of (path, percentage). Similar to 1inch's quote API but we need to have high performance.
- [ ] Instead of using Uniswap router, directly calculate the
amountOutfor each hop in the swap path and use it to build a sequence of transactions (e.g.,transfer(token1) -> swap(token1, token2) -> transfer(token2) -> swap(token2, token3)) - [ ] Index all pairs for Uniswap V3, Uniswap V2, Sushiswap, Pancakeswap, etc. so that the quotation algorithm can be initialized in short time