-
Notifications
You must be signed in to change notification settings - Fork 263
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
Question about sAmountIn #10
Comments
hey rob,
It's all right.
Its because you wanna know how much WTM u will need to payback on sushiswap given u borrow (amountIn) PNA on sushi, so once u know how much u need to repay to sushi, your profit will be the (amountOut) WTMs that u got from uniswap less the sAmountIn of WTM u need to payback the flashloan on sushi (payback for the PNA u borrowed) I hope have been clear! (otherwise, let me know but i think u got it, after all u understand all the shitty computations i made haha, cheers!) |
Hi @6eer , Thanks for your comment. I am still a bit confused though. Let me try to break this down into steps and maybe you can identify where exactly I am misunderstanding? Steps:
This is where i am getting confused, because we dont currently own any WTM, so how can we send in 'sAmountIn' WTM into Sushiswap? Shouldn't there be a step somewhere to borrow WTM on Sushiswap for the ETH that we currently do own? (note that here i am referring to the normal bot, so there should not be any flash loans involved). |
Ah, ok! (I saw the edit). Yeah u are right with the normal bot u need to be holding the WTM, u only use sushiswap as oracle, as if the sushiprice was the market price (a VERY BAD assumption, here i suppose using a binance API to get the price reference would be a much better idea).
U use the PNA tokens that u owns (the account u use to send & sign the transaction must have enough PNA). I wrote it in the first paragraph of the What its included in this repo? section
U dont borrow nothing!! u just make the arbitrage with your funds |
I'm a bit confused about the calculation of sAmountIn:
Output log:
My understanding is that the bot discovers and arbitrage opportunity where WTM is underpriced relative to PNA on Uniswap than it is on sushiswap (since on Uniswap, WTM is in excess and PNA is in shortage). So in order to exploit this, we would want to purchase WTM on Uniswap and sell PNA on Uniswap, hence we would be swapping
amountIn
PNA foramountOut
WTM on uniswap.Now that we have WTM, we would look to sell it on Sushiswap, so we would be sending in WTM and getting back PNA.
If so, why is it that sAmountIn is calculated from amountIn (this PNA amount going into Uniswap), and not amountOut (the WTM amount coming out of uniswap)?
The text was updated successfully, but these errors were encountered: