Skip to content

Commit

Permalink
Do not proceed if cannot convert to ETH
Browse files Browse the repository at this point in the history
  • Loading branch information
chefnomi committed Aug 31, 2020
1 parent b3672d9 commit 180bc9b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions contracts/SushiMaker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ contract SushiMaker {
return amount;
}
IUniswapV2Pair pair = IUniswapV2Pair(factory.getPair(token, weth));
if (address(pair) == address(0)) {
return 0;
}
(uint reserve0, uint reserve1,) = pair.getReserves();
address token0 = pair.token0();
(uint reserveIn, uint reserveOut) = token0 == token ? (reserve0, reserve1) : (reserve1, reserve0);
Expand Down

0 comments on commit 180bc9b

Please sign in to comment.