If I move currencies a lot I may have entered many markets which now provide very high gas costs. In order to clean up, I must cleanly exit a market. A user can only exit a market if all are true:
They have previously entered the market
They have 0 BTokens in this market
They have 0 LTokens in this Market, OR, they would still be "above water" without this collateral. eg. TotalCreditLine.credit_line - CreditLine.credit.line < TotalCreditLine.debt
If these checks all pass, we can remove them from the list of entered markets.
Follow up from #24
If I move currencies a lot I may have entered many markets which now provide very high gas costs. In order to clean up, I must cleanly exit a market. A user can only exit a market if all are true:
TotalCreditLine.credit_line - CreditLine.credit.line < TotalCreditLine.debt
If these checks all pass, we can remove them from the list of entered markets.