In the getAmount0AndAmount1 function of the FlashUniswapV3 contract, there is an error message that is raised when the underlying parameter is not equal to either token0 or token1. However, based on the code in the flashLiquidate function, it is guaranteed that underlying will always be equal to either token0 or token1.
This means that the error message will never be raised, which could be confusing for developers who are trying to understand the code.
I propose removing the superfluous error message entirely and simply returning amount0 and amount1 without raising an error.
Changes Made:
Removed the unnecessary revert statement from the getAmount0AndAmount1() function.
Simplified the logic for cases where underlying is guaranteed to be one of the tokens in the pool.
Description:
In the
getAmount0AndAmount1
function of theFlashUniswapV3
contract, there is an error message that is raised when the underlying parameter is not equal to eithertoken0
ortoken1
. However, based on the code in theflashLiquidate
function, it is guaranteed that underlying will always be equal to eithertoken0
ortoken1
. This means that the error message will never be raised, which could be confusing for developers who are trying to understand the code. I propose removing the superfluous error message entirely and simply returningamount0
andamount1
without raising an error.Changes Made:
Removed the unnecessary revert statement from the
getAmount0AndAmount1()
function. Simplified the logic for cases where underlying is guaranteed to be one of the tokens in the pool.