uni-sushi-flashloaner
uni-sushi-flashloaner copied to clipboard
question: shouldTrade?
Struggling to understand this comparison:
const shouldTrade = spread > (
(shouldStartEth ? ETH_TRADE : DAI_TRADE)
/ Number(
ethers.utils.formatEther(uniswapReserves[shouldStartEth ? 1 : 0]),
));
It seems that we should trade when the ratio of the ETH_TRADE (or DAI_TRADE) in to the reserve in uniswap is less than the spread. That is,
- spread = ratio of price difference
- shouldTrade = ratio of price difference > ratio of ETH_TRADE / uniswap ETH reserve
Why is this comparison necessary?