Submitted by 0xpiken, also found by adeolu, hyh, and Shield
https://github.com/code-423n4/2024-06-size/blob/main/src/libraries/actions/SellCreditMarket.sol#L51-L122https://github.com/code-423n4/2024-06-size/blob/main/src/libraries/actions/Compensate.sol#L42-L101
A credit buyer could be forced to buy a not for sale credit position with no way to sell it passively, potentially suffering a loss due to missing an arbitrage opportunity.
Any user is allowed to lend or borrow szaUSDC through Size protocol.
A lender can set their allCreditPositionsForSaleDisabled to true, which prevents any of their credit positions from being sold. Alternatively, a specific credit position can be marked as not for sale, making it impossible to sell and for anyone to buy it.
While no one can buy a not for sale credit position, their owner can force to sell it or use it compensate their debt. Once sold, no one can buy it again due to its not for sale status, resulting the new owner potentially suffering a loss.
Copy below codes to SellCreditMarketTest.t.sol and run forge test --match-test test_SellCreditMarket_sellNotForSaleCreditPosition:
As we can see, as a speculator, Candy might suffer a loss because the credit position she is forced to buy is not able to be bought from her by any other buyer.
No one should be allowed to sell their not for sale credit positions or use them to compensate their debts:
Context
aviggiano (Size) confirmed and commented:
hansfriese (judge) commented:
Note: For full discussion, see here.
