This project aims to build a high frequency arbitrage bot. The goal is to exploit the slippage when swapping tokens in Uniswap, and use the liquidity generated by Flashloan. There are several arbitrage projects already existing in DeFI space, and currently flashloan usecases are mainly based around collateral swaps, interest rate swaps. By utilising small variations in token pricing, and performing a multi-token arbitrage a small profit can be made using the liquidity generated from Flashloan. A small amount of Eth for example 0.2 Eth needs to be deposited for covering the gas fees, and also transactions getting potentially reverted due to change in price The pipeline for performing such an arbitrage: 1. Run a script to identify token list for performing arbitrage with Uniswap (include gas, exchange fees) 2. Flash loan to secure Ethereum or Dai token as entry point into arbitrage 3. Swap1 Eth --> Token 1 --> Token 2 --> Eth 4. Pay back Eth + gas fees + 0.09% flash loan fee (Step 2 to 4 needs to be done in a single transaction. ) 5. Scaling this slippage over a large number of transactions will be profitable
How It's Made
This project uses Solidity and Python. -->Truffle flashloan box example by Aave is used as a template. --> To achieve the 1st goal a script is used to query via GraphQL the token pricing, and then to calculate the spread. --> UniSwap router contract is used as an interface, and function swapExactETHForTokens is used to create the swaps generating the slippage value Unfortunately the project could not achieve the goal of generating profit in step 4. The spreads were such that 3 way token exchange rate was higher resulting in not enough reserve to payback the flash loan.