Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shouldn't profit be proportional to liquidated amount? #9

Open
Shymaa-Arafat opened this issue Jun 8, 2022 · 0 comments
Open

Shouldn't profit be proportional to liquidated amount? #9

Shymaa-Arafat opened this issue Jun 8, 2022 · 0 comments

Comments

@Shymaa-Arafat
Copy link

Shymaa-Arafat commented Jun 8, 2022

I'm trying to get the most learning value of this exercise and have tried different options:
-In systematic 2 steps full liquidation (liquidating 1568 ETH), I get profit of 24.11 ETH
https://github.com/DrShymaa2022/defi-mooc-lab2
-If I compared this to 1 step profit as 21...ETH, it seems reasonable and satisfiable to increase it by about 1/7 = 14%
-However, if we looked at the details of the results 2 annoying observations:
1-How come a gain of 142 ETH ends to be only 24.1?
2-How come what a lot of people did of liquidating less than ≤1000 leads to more than double the profit (43.8 ETH, for difference gain ranging from 86 to 94 if we applied 2 steps
https://github.com/Shymaa-Arafat/defi-mooc-lab2/blob/a00d99b0dd63c1da3cf32d9b918f63b8bfcd72c0/contracts/LiquidationOperator.sol)?
.
-If the flash swap charges ratio "rt" for the Flashloan, ie for loan X we payback (1+rt)X { rt<1 in fact should be 0.003?}
If X1>> X2
X1 leads to 142 ETH
X2 leads to 86 ETH
Profit Pr= gain from liquidation - ratio
X
for Pr1 < Pr2 ( what happened in the runs)
rt*(X1-X2)> gain difference
in our case
rt1.5m$ >142-86 ETH
rt> 56
1.8/1500
rt> 0.0672
no way uniswap charges more than 6.7%????
If we added more exact values ( difference is nearly 20 ETH)
It should be rt = 76*1.8/1500 = 9.1%
.
If this is not the case as I think, please take the time to find out what is the common mistake most of us had fallen in and was not discovered by the test script
( I tried running other people codes and changing parameters or printing details to check it out) and was not discovered by the test script
.
-Finally, would be helpful for the next course version if the read me guide shed some light on using uniswap router or regular call to payback and pros & cons of both ( people in discord mentioned re-entrancy attack)
.
Thanks
Uploading IMG_20220608_184540.jpg…
Uploading IMG_20220603_223350.jpg…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant