Compound Governance Proposal 11: COMP Distribution Patch

Arr00
5 min readJun 29, 2020

Addressed Issues:

The Compound protocol started the distribution of the COMP governance token about two weeks ago now. With the value of the token far exceeding all expectations, “liquidity farming” for COMP has gotten out of hand. The supply of BAT in Compound is currently $319 mm which is almost equal to the entire supply of BAT. This is widely considered risky in the community due to the inability to source enough BAT to liquidate in worst case scenario situations. Other side effects of “liquidity farming” is significant changes to the interest rates across all assets.

Currently, the rate at which COMP is distributed to each market is determined by the amount of interest paid by each market. Essentially, this means that more interest paid = more COMP. This causes users to drive certain markets to very high utilization causing high interest rates and a high rate of COMP distribution in that market.

Another issue addressed in this proposal is the ability for a smart contract to call refreshCompRates. This function analyzes the markets and sets the rate at which COMP is distributed to each market. Someone could potentially take out flashloans (uncollateralized loans worth up to millions of dollars) and alter markets significantly before calling refreshCompRates. They would benefit from the new rates until refreshCompRates is called again.

Proposed Solution:

The proposed solution for COMP liquidity farming is changing the method for calculating utility of each market (distribution rates are then set relative to all other market utilities). The new proposal calculates utility based on the total borrow amount of the market. COMP is still distributed 50/50 to lenders and borrowers in each market.

To solve the issue with flashloans, the function ensures that smart contracts can not call it.

Implementation:

I will work my way down through the github commit explaining the code changes.

Here, we see that the refreshCompSpeeds function is changed to disallow smart contract calls. The first line requires that msg.sender (the eth address calling this specific function) equals tx.origin (the address of the origin of the transaction). If these are not equal, there must be a smart contract as msg.sender and we do not want this. If it is equal, we call our new internal refreshCompSpeedsInternal function which does the actual changes (an internal function cannot be called from other smart contracts or users).

Here, the new code for setting utility is defined. Instead of it being the eth value of interest per block, it is now the eth value of the total borrows for that asset. To get eth value, we multiply the quantity of the underlying asset by the asset price in eth. Simple!

In this screenshot, you can see the changes made to the become function. These have been made just to simplify the governance proposal in order to activate it. The idea is that since no new markets are being added, the new Comptroller can just rely on existing storage.

Additionally, the refreshCompSpeeds function has been changed to refreshCompSpeedsInternal for admin functions such as when new markets are added. In these situations, we need to call the internal function because all admin functions are called through a smart contract (timelock).

These code changes are relatively simple as far as smart contracts go. Significant logic changes were intentionally avoided to allow for quick deployment and eliminate the need for an external audit. I believe that this contract can be deployed without an audit.

Governance Calls:

The newly deployed Comptroller is set as the pending implementation comptroller and then becomes the comptroller.

End Results:

The COMP distribution between markets will be based on total value of borrows in that market instead of interest paid in that market (this COMP distribution is still split 50/50 between lenders and borrowers). Initially, BAT will still be the largest recipient of COMP; however, users will quickly move out of BAT because paying interest will no longer be incentivized and the high reserve factor on BAT cuts into farming profits.

While I do not know what will happen, I predict that the interest rates across all markets will almost equalize (not quite though because the market is a bit erratic and there are different reserve factors). This is because borrowing is still encouraged for COMP farming but users will try to pay minimal interest. I don’t believe that this is the ideal situation (different assets have different inherent time value and should be reward as such), but it will cause the protocol to have safer utilization rates and lower interest rates. Our risk as a community will be mitigated and we will be able to think our next steps over more thoroughly and slowly.

This proposal comes as a quick fix with limited logic changes in order to get us out of an unideal situation. As such, it can be deployed quickly without audits and with limited risks. I support this proposal.

Governance Proposal
Comradery Discussion

I hope to continue writing up a post for each Compound Governance proposal to help the community digest the information easily. I’ll probably get better at writing this concisely and clearly… just give me some time. If you are a Defi user and don’t understand some code or terminology I used, tell me so I know to explain more! If you have any recommendations or questions, please post them below.

PS: If you want to delegate some COMP to me, that’d be greatly appreciated: 0x2B384212EDc04Ae8bB41738D05BA20E33277bf33. For now, I vote for security and normality of rates.

--

--