Compound v2 lets accounts exit collateral markets without erasing accrued COMP
Compound v2 preserves accrued COMP when an account exits a collateral market. The account must owe nothing in that market, and removing its collateral contribution must leave remaining loans adequately supported. A successful exit changes market membership; it does not withdraw supplied assets or claim reward tokens.
In short: Removing a market from collateral calculations preserves accrued COMP, while withdrawal and reward payment remain separate operations with their own conditions.
Collateral removal, withdrawal, and reward collection
The appropriate operation depends on what remains in the account and what the account holder wants to change. Removing a supplied asset from collateral calculations calls for a market exit. Recovering the underlying asset requires redemption. Receiving unpaid COMP requires a claim. These actions affect different balances, so completing one does not establish that the others occurred.
Accrued rewards alone do not require continued collateral membership. An outstanding loan creates a different dependency: removing collateral must satisfy the Comptroller's restrictions. Debt in the selected market must first reach zero, even when the account has collateral elsewhere.
Compound v2 was deprecated, with new supplies and borrows paused while repayments and withdrawals remained available. Managing an existing position therefore requires distinguishing permitted closing operations from historical participation options. Re-entering a collateral market does not override a supply or borrowing pause.
Market membership, lending balances, and exit conditions
Market membership identifies which markets participate in an account's liquidity calculation. A cToken balance represents supplied assets, while a borrow balance records debt. Accrued COMP belongs to separate reward accounting. The Comptroller manages membership and risk checks; the cToken contract maintains the lending balances.
The following values describe the exit operation's required conditions and recorded outcome. They are contract states, rather than changing reward rates or recommended borrowing levels.
| Exit parameter | Required or resulting value | Control or restriction |
|---|---|---|
| Borrow balance in the selected market | 0 | The caller must clear this debt before exiting. |
| Shortfall after removing the collateral contribution | 0 | The Comptroller rejects an exit if the collateral check finds a shortfall after removal. |
| Account membership after exit | false | The selected market leaves the caller's entered-market set. |
| exitMarket success return code | 0 | The function reports success separately from transaction inclusion. |
| A permitted exit updates membership without redeeming the account's cTokens or paying its accrued COMP. | ||
Must every loan be repaid before exiting one market?
A market exit requires zero debt in the selected market, but other loans may remain if the collateral check passes. The distinction is between debt belonging to that market and debt elsewhere in the account. Extra collateral cannot bypass the selected market's zero-debt requirement.
Repayment reduces debt through the relevant cToken contract. A previously displayed amount can differ from the amount needed when repayment executes because borrowing accrues interest. The remaining borrow balance determines whether this prerequisite has been met. An attempted repayment or a rounded display does not establish a zero balance.
Collateral eligibility depends on live account inputs
The Comptroller evaluates an exit using the account's balances, market collateral factors, exchange rates, and oracle prices. Removing membership removes that market's collateral contribution from the calculation.
A collateral factor determines how much of a supplied asset's value contributes to borrowing capacity. The factor is a market setting that governance can change.
Account liquidity and market cash describe different constraints. Account liquidity measures collateral support after accounting for debt. Market cash is the underlying asset that a market has available for transfers. The exit checks collateral eligibility without making the underlying-asset transfer that redemption requires.
A successful exit establishes that its checks passed at execution. It does not freeze prices, stop interest on remaining debt, or remove applicable liquidation rules. Any remaining loans continue under their market conditions after collateral membership changes.
Accrued COMP survives the membership change
The exitMarket function does not modify the account's stored compAccrued balance. Removing membership therefore does not erase rewards already recorded in that balance.
Reward accounting also includes market indexes and account indexes. Those values support calculations of rewards that have not yet been added to the stored account total. Exiting does not itself perform a reward update, so it should not be treated as a final calculation of everything owed.
Collateral membership was separate from the supply and borrow balances used in reward calculations. Removing membership while retaining cTokens does not, by itself, establish that a reward stream has stopped. Future accrual depends on applicable distribution settings and eligible balances; historical rewards do not prove that a positive distribution speed remains active.
Preservation also differs from payment. A claim processes reward accounting and transfers the accrued amount only if the Comptroller holds enough COMP to cover it in full. Otherwise, the amount remains accrued without a partial payment. An unpaid reward balance can survive an exit without corresponding COMP having reached the holder. That distinction remains relevant even after lending balances have been closed.
Membership records and transaction evidence
A completed membership change emits a MarketExited event identifying the account and cToken market. The market should also disappear from the account's entered-market list, and checkMembership should return false. These observations establish the collateral change without relying on a dashboard label.
A transaction receipt showing successful execution is insufficient on its own. The exit function can report a protocol error through a return code without reverting the transaction. Its error information and resulting membership state therefore matter when determining whether the requested change occurred.
Historical events remain evidence of earlier actions, while current membership describes the account's present state. Later re-entry can change that state again. Neither an exit event nor an empty entered-market list proves that supplied assets were withdrawn or that rewards were paid.
Re-entry restores membership within existing restrictions
Re-entry can restore collateral membership where the market remains listed and the deployed Comptroller permits entry. This requires a new transaction; it does not cancel the historical exit. The supplied balance must still exist to contribute collateral value. Re-entry also cannot recreate redeemed cTokens, reverse a repayment, restore earlier reward settings, or bypass the pauses introduced during v2's deprecation.
Redemption has a separate cash requirement
Withdrawing supplied assets requires the cToken contract to redeem the position and transfer its underlying asset. The redeem function specifies a cToken quantity, while redeemUnderlying specifies an underlying-asset quantity. Both operations depend on their applicable contract checks and sufficient market cash.
Exiting membership is not a compulsory preliminary step for every withdrawal. Redemption can proceed while a market remains entered when the account satisfies the relevant restrictions. Conversely, successful collateral removal does not reserve cash for a subsequent withdrawal. Other market activity can change the available amount before redemption executes.
Why did an exit transaction leave collateral enabled?
An exit can leave collateral enabled because the selected market still contains debt, the collateral check fails, or a required contract read fails. These causes require different responses. Repeating the same transaction does not resolve an unchanged borrow balance or an unchanged collateral shortfall.
Identify the failing condition using the returned error, receipt information, and current account state. A simulation can test the call without changing membership. Its result applies to the state that it evaluates; later balance, price, or configuration changes can invalidate that result before execution.
Debt requires repayment, while a collateral restriction requires sufficient support for the remaining loans. Paused supplies limit the available ways to change that support. An oracle or snapshot failure needs its own resolution rather than an unrelated reward claim. Once membership is already false, the remaining task is whichever balance still needs attention: supplied assets, outstanding debt, or unpaid COMP.
Practical questions about Compound v2
Can another address exit a Compound v2 market for my account?
The exitMarket function changes membership for its caller and has no separate account-holder argument. A different address cannot select your account merely by submitting the transaction. If a contract holds the position, the call must originate from that contract through its authorized execution mechanism.
Does exitMarket take the underlying token address?
The exitMarket argument identifies the cToken market, rather than the underlying token. The Comptroller uses that market contract to read the caller's position and update membership. Supplying an underlying-token address does not identify the required market and can cause the contract call to fail.
Is a token allowance required solely to remove collateral membership?
A direct market exit does not require a token allowance because it does not transfer tokens. Repaying an ERC-20 borrow is a separate operation that requires the relevant spending approval. An interface that combines repayment with exit may therefore request authorization for the repayment component.
Can I disable only part of a market's collateral balance?
Collateral membership applies to the account's entire position in that market, so exitMarket has no amount parameter. A partial redemption changes the supplied balance rather than creating partial membership. Such a redemption must satisfy collateral restrictions and the market's available-cash requirement.
When can an exit succeed without emitting a new MarketExited event?
An exit can return success without a new MarketExited event when the account is already outside the market and the preceding checks pass. No membership change occurs in that case. Reading current membership distinguishes this outcome from a failed attempt that leaves collateral enabled.
Will exiting a market change the voting rights of COMP that I already hold?
Exiting a collateral market does not transfer held COMP or change its voting delegation. Those voting rights depend on the COMP token balance and delegation state. Unclaimed rewards are separate from tokens already held, so an accrued reward display does not establish the same voting balance.