8000 Update README.md · lazycoder1/liquity-arbitrage@4df82f9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4df82f9

Browse files
authored
Update README.md
1 parent c25960e commit 4df82f9

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
# liquity-arbitrage
22

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.
29+
```
30+
profit = ETH_USED * (uniswapPrice/chainLinkPrice) * (1-redemptionFeePercentage) - GasCost
31+
```
32+
33+
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+
339
# How to start
440

541
Run the following commands
@@ -10,3 +46,17 @@ Run the following commands
1046

1147
After this add your private keys and wallet addresses to .env file.
1248

49+
#### To start the server:
50+
```
51+
yarn start
52+
```
53+
54+
#### Sample `.env` file
55+
```
56+
PRIVATE_KEY='PVT_KEY_FROM_WALLET'
57+
WSS_PROVIDER='wss://kovan.infura.io/ws/v3/API_KEY'
58+
HTTPS_PROVIDER='https://kovan.infura.io/v3/API_KEY'
59+
ACCOUNT_ADDRESS='WALLET_ADDRESS_OF_THE_PRIVATE_KEY'
60+
```
61+
62+

0 commit comments

Comments
 (0)
0