core-v2 icon indicating copy to clipboard operation
core-v2 copied to clipboard

USDC blacklisting breaks liquidations

Open Van0k opened this issue 2 years ago • 1 comments

Issue: CreditManager.closeCreditAccount(), which is invoked during liquidations, has the following line:

   // transfer remaining funds to the borrower [liquidations only]
        if (remainingFunds > 1) {
            _safeTokenTransfer(
                creditAccount,
                underlying,
                borrower,
                remainingFunds,
                false
            ); // F:[CM-13,18]
        }

Since this is always executed when there are remaining funds, liquidations on an account will fail if the borrower cannot be transferred to - such as when the borrower is blacklisted by USDC. While the account can be liquidated after some time due to account value dropping relative to borrowed amount (which leads to remainingFunds = 0), this can lead to a temporary freezing of LP funds and break "Expirable" Credit Manager logic used for fixed rate loans.

There are two proposed solutions:

  1. Modify the USDC CreditFacade to check the borrower address being in the blacklist on liquidation. If the borrower is in the blacklist, the CF will transfer the Credit Account to the treasury / a treasury-controlled contract before liquidation - this will send the remaining funds to the treasury, so the borrower can recover them on a different address by contacting the DAO.
  2. Change the CreditManager logic so that the borrower retains their Credit Account after liquidation. Note that the borrower would be able to close their account normally, since they can pass a different recipient address for their USDC. In addition to solving this issue, this has UX benefits. However, this requires updating Credit Managers, which is more disruptive than updating the Credit Facade.

Van0k avatar Nov 16 '22 11:11 Van0k

Fix (1) implemented in 9f24d7d19702802a9d90034200b869c641640ee3.

Van0k avatar Jan 16 '23 06:01 Van0k