hifi-finance / hifi

Monorepo implementing the Hifi fixed-rate, fixed-term lending protocol
https://app.hifi.finance
Other
105 stars 15 forks source link

Fix/remove superfluous revert #99

Closed surbhiaudichya closed 1 year ago

surbhiaudichya commented 1 year ago

Description:

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.