sherlock-audit / 2023-05-perennial-judging

12 stars 9 forks source link

rvierdiiev - When Product is closed, then liquidation is not allowed #223

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

rvierdiiev

medium

When Product is closed, then liquidation is not allowed

Summary

When Product is closed, then liquidation is not allowed. Positions that will be underwater will not be closed by their owners which will make losses for another traders.

Vulnerability Detail

Product contract can be closed by the coordinator. When this is done, then the only option that is enabled to users is to close their positions, because everything else uses notClosed modifier.

What we need to check is that closeAll function also can't be called when product is closed. This function is used by Collateral contract in order to liquidate account.

That means that once product will be closed, then liquidations will not be allowed as well. However it's not guaranteed that user's will close their positions immediately, so they can become underwater and no one will liquidate them.

Impact

Underwater positions can't be liquidated

Code Snippet

Provided above

Tool used

Manual Review

Recommendation

Allow liquidation after closing product, as liquidation closes position as well.