some question about flashloan?
ocoderr opened this issue · comments
ocoderr commented
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?