You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50Lines changed: 50 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,41 @@
1
1
# liquity-arbitrage
2
2
3
+
This project will perform an arbitrage of LUSD/ETH pair. This will be done by 2 steps
4
+
1. Swap ETH for LUSD at uniswap
5
+
2. Redeem LUSD for ETH at liquity
6
+
7
+
# Design
8
+
9
+
The project has two main components , one is the node server and another is the smart contract.
10
+
11
+
The node server is responsible to keep a track of the prices of ETH at chainlink and at uniswap. When we notice a price difference where there is a possiblity of a profit from arbitrage it will trigger the smart contract to perform the arbitrage between uniswap and liquity smart contracts.
12
+
13
+
### How is the amount of eth to be used for the arbitrage calculated ?
14
+
15
+
We have three restrictions in place to determine the ETH that can be used for the arbitrage.
16
+
1) The ETH present in the arbitragers wallet
17
+
2) The redeemable amount at liquity
18
+
3) The uniswap reserves in the LUSD/ETH pair
19
+
20
+
We will first take the minimum of
21
+
```
22
+
min( <ETH present in Wallet> , <12.5% of the reserve pool of uniswap pair> ) // We will not use a bigger percentage of the uniswap pool because it will impact the prices heavily
23
+
```
24
+
Once the minimum is determined we will then check at liquity if we can redeem LUSD the amount of ETH swapped. If not , we will use the redeemableLUSD at liquity to determine the ETH used for swap.
25
+
26
+
### How will it determine if there is an arbitrage opportunity ?
27
+
28
+
We can determine the arbitrage opportunity by the following formula.
If we find that the profit is positive we will then invoke the smart contract.
34
+
35
+
### What mechanism will be used to make sure the server can be run 24/7 ?
36
+
37
+
To run the server 24/7 we will need a poller mechanism which will continously monitor the prices. To do this , this project will subscribe to the new block headers generated in the ethereum chain. This is done considering uniswap prices are updated after every block is mined.
38
+
3
39
# How to start
4
40
5
41
Run the following commands
@@ -10,3 +46,17 @@ Run the following commands
10
46
11
47
After this add your private keys and wallet addresses to .env file.
0 commit comments