Submitted by hyh, also found by 0xAlix2, almurhasan, BenRai, 0xStalin, and bin2chen
Any credit position can be forcibly sold with the help of its borrower. This will be executed only when have expected profit; for example, when lenders curve is not null and is above the market it is profitable to buy credit from them (lend to them at above market rates), but they might block it with the lack of free collateral and the forSale = false flag, which can be overridden by the corresponding borrower of this credit position. The impact of this forced sale is proportional to interest rate volatility and can be substantial. There are no additional prerequisites for the setup.
createDebtAndCreditPositions creates credit positions with forSale == true:
AccountingLibrary.sol#L62-L82
This can be done on demand for any credit position by the borrower of the corresponding debt position, by running Compensate with params.creditPositionToCompensateId == RESERVED_ID, which will create new position with forSale == true and substitute the existing lender position with it:
Compensate.sol#L118-L145
Then, it can be then bought with BuyCreditMarket:
BuyCreditMarket.sol#L79-L8
Consider passing the flag to createDebtAndCreditPositions() indicating forSale flag to be set, which be passed from the existing credit in Compensate.sol#L139, so it wont be changed.
aviggiano (Size) confirmed and commented:
hansfriese (judge) decreased severity to Medium and commented:
