Submitted by hickuphh3
Swap fees are taken from the output. Hence, if swapping token0 for token1 (zeroForOne is true), then fees are taken in token1. We see this to be the case in the initialization of feeGrowthGlobal in the swap cache
feeGrowthGlobal = zeroForOne ? feeGrowthGlobal1 : feeGrowthGlobal0;
and in _updateFees().
However, looking at Ticks.cross(), the logic is the reverse, which causes wrong fee accounting.
Switch the 0 and 1 in Ticks.cross().
sarangparikh22 (Sushi) confirmed
