Submitted by bin2chen, also found by immeas
In openPosition(), it allows token0PremiumPortion and token1PremiumPortion to be 0 at the same time.
In this case, if tokenId enters out_of_price, for example, UpperOutOfRange, anyone might be able to input:
Note: amountFromBorrowed + marginFrom == 0, so fees ==0
To open a new Position, borrow Liquidity, but without paying any fees. Its basically a no-cost loan.
out_of_price tokenId, due to the no-cost loan, might lead to the following issues:
The following test case demonstrates that if it is out_of_price, anyone can borrow at no cost.
Add to OpenPosition.t.sol:
It is suggested that openPosition() should add a minimum token0PremiumPortion/token1PremiumPortion limit.
wukong-particle (Particle) confirmed and commented:
