Rita94105 / FlashSwapPractice

Implement Arbitrage in different pools to get profits that borrow tokens in low price pool, swap in high price pool, and then return tokens to low price pool.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flash Swap Practice

This is a UniswapV2 flash swap practice, our goal is to pass the test.

Practice 1: Liquidator.sol

liquidate() will call FakeLendingProtocol.liquidatePosition() to liquidate the position of the user. Follow the instructions in contracts/Liquidator.sol to complete the practice. (Do not change any other files)

Practice 2: Arbitrage.sol

arbitrage() will do the arbitrage between the given two pools (must be the same pair). Follow the instructions in contracts/Arbitrage.sol to complete the practice. For convenience, we will only practice method 1, and fix the borrowed amount to 5 WETH

If you are interested in the flash swap arbitrage, you can read more in this repository

Local Development

Clone this repository, install Node.js dependencies, and build the source code:

git clone https://github.com/Rita94105/FlashSwapPractice.git
cd FlashSwapPractice
npm install
forge install
forge build
forge test

About

Implement Arbitrage in different pools to get profits that borrow tokens in low price pool, swap in high price pool, and then return tokens to low price pool.


Languages

Language:Solidity 83.5%Language:TypeScript 16.4%Language:Makefile 0.0%Language:Nix 0.0%Language:JavaScript 0.0%