v3-core icon indicating copy to clipboard operation
v3-core copied to clipboard

Eliminate unnecessary variable assignments in Position.update()

Open minebuu opened this issue 2 years ago • 0 comments

Position.Update() causes unnecessary variable assignments for positions with zero liquidity delta.

Even if the liquidtyNext variable is not used when the liquidityDelta is 0, below code assigns the value to the liquidtyNext. https://github.com/Uniswap/v3-core/blob/05c10bf6d547d6121622ac51c457f93775e1df09/contracts/libraries/Position.sol#L53-L56

But the liquidtyNext is not used in below code. https://github.com/Uniswap/v3-core/blob/05c10bf6d547d6121622ac51c457f93775e1df09/contracts/libraries/Position.sol#L69

Therefore, there is no need to assign self.liquidty value to liquidityNext in line 55. Unnecessary mstore().

minebuu avatar Feb 16 '23 06:02 minebuu