← Back to home

FlashYield

SolidityPythonGraphQL

Project aims to build a high frequency arbitrage bot using liquidity from Aave in a Flashloan to perform token swaps

Problem Statement

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 priceThe pipeline for performing such an arbitrage:Run a script to identify token list for performing arbitrage with Uniswap (include gas, exchange fees)Flash loan to secure Ethereum or Dai token as entry point into arbitrageSwap1 Eth --> Token 1 --> Token 2 --> EthPay back Eth + gas fees + 0.09% flash loan fee (Step 2 to 4 needs to be done in a single transaction. )Scaling this slippage over a large number of transactions will be profitable

Solution

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 valueUnfortunately 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.

Hackathon

HackMoney

2024

Contributors