Liquidation Event Handling And Collateral Reserves
01Summary
Upgrade Compound III (cUSDCv3) to improve liquidation event logging and collateral reserve handling. The patch adds a Transfer event when users are liquidated, treats all excess collateral in the protocol as implicit reserves automatically, and formalizes collateral reserve accounting with a new getCollateralReserves function. Additionally, 10 COMP will be awarded to ilemi.eth for identifying the missing event log issue.
- Type
- contract upgrade
- Funding
- $10
Key changes
- Emit Transfer event from absorb function when users are liquidated and left with positive base asset balance, improving Etherscan and blockchain explorer visibility(medium)
- Implicit collateral reserves: all excess collateral available via ERC20 balanceOf is automatically considered part of collateral reserves, including accidentally transferred collateral and accrued interest(high)
- Formalize collateral reserves concept by adding getCollateralReserves(asset) function for protocol transparency(medium)
- Deploy new CometFactory with patched version and upgrade cUSDCv3 implementation to use the new factory(high)
Generated by Kvorum
02Description
Liquidation Event Handling And Collateral Reserves
Explanation
Emit Transfer event from absorb
When a user is liquidated in Compound III, all of their collateral is absorbed into the protocol, and they are typically left with a positive balance of the base asset (USDC) and no debt (or collateral dust).
Shortly after the first market launched, a community developer noticed that the absorb function was missing an event log in the case when an account is left with a positive balance.
While this doesn’t have any economic impact, adding this event log will improve the user experience on Etherscan and blockchain explorers, and make analytics easier.
Implicit collateral reserves
Without this patch, the collateral which is bought using buyCollateral must be part of the protocol's balance explicitly, which can happen during absorb. Excess collateral simply transferred to the protocol will not be available as collateral reserves to be sold by the protocol automatically.
With this patch, all of the excess collateral asset available using the ERC20 balanceOf function is implicitly considered part of collateral reserves. This means that accidentally transferring the ERC20 to the protocol will automatically become reserves. It also means that interest accrued implicitly, e.g. when the collateral is the token of another Compound III market, will automatically become part of reserves, which can be sold by the protocol and bought using buyCollateral.
This patch also formalizes the idea of collateral reserves in general, adding a getCollateralReserves(asset) function.
The associated forum post for this proposal can be found here.
Proposal
The proposal itself is to be made from this pull request.
The first step is to deploy a new CometFactory, using the patched version of the contract, which adds the Transfer event to absorb and modifies the total collateral accounting. This is done as a ‘prepare’ step of the migration script.
The first action of the proposal is to set the factory for cUSDCv3 to the newly deployed factory.
The second action is to deploy and upgrade to a new implementation of Comet, using the newly configured factory.
The third action is to transfer 10 COMP to ilemi.eth (0x2Ae8c972fB2E6c00ddED8986E2dc672ED190DA06), as a reward for identifying the issue and suggesting the Transfer event improvement.
03Mismatch analysis
A calldata-vs-description analysis is not generated yet. Review the decoded actions →
04Actions
- Target
- 0x316f…36e3
- Value
- 0 wei
- Function
- setFactory(address,address)
- Arguments
{ "0": "0xc3d688B66703497DAA19211EEdff47f25384cdc3", "1": "0xa7F7De6cCad4D83d81676717053883337aC2c1b4" }- Calldata
- Target
- 0x1ec6…8779
- Value
- 0 wei
- Function
- deployAndUpgradeTo(address,address)
- Arguments
{ "0": "0x316f9708bB98af7dA9c68C1C3b5e79039cD336E3", "1": "0xc3d688B66703497DAA19211EEdff47f25384cdc3" }- Calldata
- Target
- 0x3d98…cd3b
- Value
- 0 wei
- Function
- _grantComp(address,uint256)
- Arguments
{ "0": "0x2Ae8c972fB2E6c00ddED8986E2dc672ED190DA06", "1": "10000000000000000000" }- Calldata
05Tally
Summed from votes
06Voters
No votes recorded yet.
07Forum
- Liquidation Event Handling And Collateral Reserves ↗discourse · high confidence
Arguments for
- Adding a Transfer event log to the absorb function improves user experience on Etherscan and blockchain explorers and makes analytics easier.— jared, dakeshi
- The accounting change to calculate protocol reserves as total balance minus user-owned balances enables future governance tools including using Compound III markets as collateral in other deployments.— jared
- Bundling the event log and reserve accounting changes together minimizes governance burden by combining relatively small improvements needed for parity across upcoming market launches.— jared
Arguments against
None surfaced.
Notable participants
- jaredProposer who drafted the patch, led implementation, and oversaw OpenZeppelin audit and proposal creation.
- andrewhong5297Community developer who identified the missing event log in the absorb function and suggested the improvement.
- dakeshiDelegate who reviewed the proposal and voted in favor, highlighting its utility for on-chain analytics.
Generated by Kvorum
08Similar proposals
- compoundexecutedUpdate USDC, USDT and USDS Comets on Mainnet to support more collaterals73%
- compoundexecutedUpdate USDC, USDT and WETH Comets on Optimism to support more collaterals72%
- compoundexecutedUpdate USDC, USDT, WETH and USDC.e Comets on Arbitrum to support more collaterals72%
- compoundexecutedUpdate USDC Comet on Scroll to support more collaterals72%
- compoundexecutedUpdate USDe Comet on Mantle to support more collaterals72%
- compoundexecutedUpdate USDe Comet on Mantle to support more collaterals72%
- compoundexecutedUpdate AERO, USDC, WETH and USDbC Comets on Base to support more collaterals71%
- compoundexecutedUpdate USDC and USDT Comets on Polygon to support more collaterals71%
- compoundexecutedAdd deUSD as collateral into cUSDCv3 on Mainnet70%
- compoundexecutedAdd deUSD as collateral into cUSDTv3 on Mainnet70%