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

some question about flashloan? #31

Open
ocoderr opened this issue Jan 14, 2021 · 0 comments
Open

some question about flashloan? #31

ocoderr opened this issue Jan 14, 2021 · 0 comments

Comments

@ocoderr
Copy link

ocoderr commented Jan 14, 2021

Hi Julien
I watch you flashloan course, run the code .

I have some question about this code
`
if(arbInfo.direction == Direction.KyberToUniswap) {
//Buy ETH on Kyber
dai.approve(address(kyber), balanceDai);
(uint expectedRate, ) = kyber.getExpectedRate(
dai,
IERC20(KYBER_ETH_ADDRESS),
balanceDai
);
kyber.swapTokenToEther(dai, balanceDai, expectedRate);

      //Sell ETH on Uniswap
      address[] memory path = new address[](2);
      path[0] = address(weth);
      path[1] = address(dai);
      uint[] memory minOuts = uniswap.getAmountsOut(address(this).balance, path); 
      uniswap.swapExactETHForTokens.value(address(this).balance)(
        minOuts[1], 
        path, 
        address(this), 
        now
      );
    }

`
why sell all eth balance at uniswap?
Why not the quantity of eth bought from kybar in the previous step?

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