Closed sherlock-admin closed 8 months ago
2 comment(s) were left on this issue during the judging contest.
karanctf commented:
interesting
takarez commented:
invalid
Limit orders are akin to stop loss/profit take strategies. So they need to be executed when the price is not in the range. I can see the custom issue name is a bit misleading as I think it should be named FlatcoinErrors.LimitOrderPriceInRange
but the function fulfills its purpose.
chaduke
medium
LimitOrder._closePosition() Revert for the case of within-range, leading to failure in normal casess.
Summary
LimitOrder._closePosition() Revert for the case of within-range, leading to failure in normal casess.
Vulnerability Detail
While we expect that when the price is within the range, the execution will go normally. However, the above code will revert even when the price is within the range. In other words, the code will revert when price is normal.
Impact
LimitOrder._closePosition() reverts for the case of within-range, leading to failure in normal casess.
Code Snippet
https://github.com/sherlock-audit/2023-12-flatmoney/blob/bba4f077a64f43fbd565f8983388d0e985cb85db/flatcoin-v1/src/LimitOrder.sol#L151-L161
Tool used
VCode
Manual Review
Recommendation
Change the logic so that normal price will not revert.