MIP30: Farmable cUSDC Adapter (CropJoin)

MIP30: Farmable cUSDC Adapter (CropJoin)


MIP#: 30
Title: Farmable cUSDC Adapter (`CropJoin`)
Author(s): Lev Livnev (@equivrel), 🌧️ McRainface
Contributors: n/a
Type: Technical
Status: Formal Submission
Date Proposed: 2020-11-16
Date Ratified: <yyyy-mm-dd>
Dependencies: n/a
Replaces: n/a
License: AGPL3+


Sentence summary

This is a proposal for the technical implementation of a USDC collateral type which would allow a CDP user to benefit from the COMP “farming” reward, by depositing the collateral into Compound and optimising its COMP yield through “tactical resupply”.

Paragraph summary

COMP farming offers an attractive yield on USDC with very little risk, and the ability to receive additional leverage from a CDP is likely to present an attractive opportunity for a yield-seeking investor, so this collateral type could be expected to produce very high dai issuance, while generating significantly higher fees for MakerDAO than what is currently collected on MakerDAO’s significant stablecoin exposure. We propose a new USDC based collateral adapter that performs COMP farming on behalf of depositors.

Component summary

MIP30c1: Proposed code: contains snippet of proposed implementation.

MIP30c2: Test cases: lists existing test cases, including integration tests

MIP30c3: Security considerations: comments on the security implications of using CropJoin

MIP30c4: Economic / Governance considerations: discusses insolvency and liquidity risks, governance and example parameters

MIP30c5: Formal verification/audit information: comments on the amenability of the proposed code to formal verification, even though formal specification, audit, or code review have yet to be conducted.

MIP30c6: Licensing: states the license under which the proposal and code are distributed.



Since Black Thursday, the MakerDAO governance community has faced issues with managing the supply and demand of dai, with dai trading on the market consistently above the target price of $1.00. In July, the market demand for dai began to increase significantly, due to dai becoming the dominant asset for “COMP farming”. Further to that, other “farming”/“liquidity mining” schemes emerged, similarly boosting dai demand.

With interest rates near the zero lower bound, governance was left with limited options for scaling supply to meet the new demand. Measures that have been considered to address this problem have included:

with the first of these being the current status quo policy (at the time of writing there is around 406MM DAI issued against USDC-A, 57MM against TUSD-A, and 21MM against PAX-A).

The case for farmable collateral

Since July, dai supply has struggled to keep up with the seemingly insatiable demand created by yield farming opportunities in Defi. One way to think of the effect this has on the dai market is to consider the farming yields as an artificial, “exogenous DSR” which is very high, (perceived to be) low risk, and beyond the control of MakerDAO governance, which has the expected effect of exerting a strong positive influence on dai demand. Another way to view the problem is that a large portion of the dai supply is locked away, and taken off the market by contracts offering depositors an attractive yield for depositing their dai. Most prominently:

  • 363MM DAI sitting inside Compound
  • 197MM DAI in the Uniswap ETH/DAI pool (though the liquidity mining
    incentive is expected to end on the 17th of November)
  • 34MM DAI deposited in Curve

Currently, collateral tokens (such as USDC) that are deposited in a CDP to generate dai cannot be further deployed to generate yield for the system or for the user. This means that users borrowing dai against USDC collateral are subject to a significant opportunity cost by forgoing yield on USDC, which decreases the incentive to sell the dai on the market (and it is only when dai is sold on the market that increasing supply has the desired effect on the peg). As a result, stablecoin collateral types are now only effective due to their very low collateral requirement, with the 101% collateral ratio acting as an effective ceiling on the DAI/USD premium, by arbitrage.

If instead the CDP user could benefit from a farming yield on their deposited collateral, then dai borrowing could present an attractive way to lever up on that yield and generate an attractive carry. For example, if a yield farm is currently paying 10% APY on USDC deposits, and a CDP can be used to borrow DAI at 5% against those deposits, up to a 110% collateralisation, then a user can earn (10 - 5) * 11 = 55% APY at maximum leverage. In doing so, they would have borrowed and sold onto the market 10 DAI for every 1 USDC they deposit, and the system would be earning a material interest rate of 5% on this DAI issuance.

We believe that the introduction of farmable collateral types presents the most effective avenue in the short term for scaling up DAI supply in a way which rewards the system adequately for risk taking, by directly leveraging the underlying source of the dai demand.

The case for farmable cUSDC

The technical implementation underlying this proposal aims to support arbitrary collateral rehypothecation, meaning that in the future it could be adapted to deploy farming collateral adapters for yield farms other than Compound.

Compound is currently the largest “yield farm” on the market, and probably also the one perceived to carry the lowest risk for depositors. Indeed, depositors who simply deposit and borrow USDC face no price risk, liquidation risk (provided the position is prudently managed) or “impermanent loss” risk, and the Compound platform has been live with very large amounts of locked capital for a long period of time, having undergone numerous audits. The MIP6 for cUSDC collateral has already been decisively green-lit by governance.

Additional reasons to start with cUSDC farming include:

  • Compound is arguably the most well respected, battle-tested, and thoroughly-audited smart contract system that offers yield farming
  • MakerDAO already has significant exposure to USDC, and it is the collateral asset with the largest amount of DAI issued
  • Compound currently sets the COMP yield on each asset proportionally to the total amount borrowed, meaning there is a 2nd order effect by which an increase in USDC farming would reduce the COMP yield on DAI farming, potentially helping to reduce DAI demand

Farmable cUSDC collateral can be viewed as an alternative to other solutions which involve fiat stablecoin exposure (such as the current stablecoin collateral types, or the PSM), and compared directly from a risk, reward, and effectiveness perspective.


MIP30c1: Proposed code

See crop.sol for the core adapter implementation, and wind.sol for the Compound leverage optimisation.

Rewards distribution

In CropJoin we implement a general purpose farming rewards adapter, that distributes income from a given token proportionally. This adapter can be used for a variety of income generating tokens, e.g. cTokens, UNI-LP, SNXRewards, and will also distribute income from direct token transfers.

To specialise to a given token, a single method must be overridden to implement the claim logic for the given token (e.g. .getReward(), .claimComp(...)).

Existing approaches to this problem were considered (e.g. SNXRewards aka UniPool, and Sushi’s MasterChef), but were unsuitable due to reliance on specified reward rates and Maker contract idiosyncrasies. In particular, designing a reward contract for Maker requires solving the “double reward” problem posed by Maker collateral always being transferable within the system (see the crop README for more information).

Levered COMP Farming

COMP rewards are determined by the total assets that a user has supplied and borrowed from Compound. Effective COMP farming requires “leverage”: a cToken is supplied, and the underlying is then borrowed and resupplied again. This is repeated to maximise the total amount that a user has supplied / borrowed, up to four times the initial amount in the case of USDC¹. This repeated supply / borrow method is in use by the majority of large Compound Dai deposits today, and is the reason why the total supply of cDai greatly exceeds the real supply of Dai.

¹ The upper limit of supply s = s0 / (1 - cf), where cf is the maximum utilisation allowed by Compound (e.g. cf=0.75 for USDC, i.e. s = 4 * s0).

In wind.sol we extend the rewards adapter described above, specialising it to receiving COMP rewards for supplying / borrowing cUSDC, via an iterative method with optional user-provided loans. There are two methods:

  • wind supplies adapter USDC to Compound and maximises leverage up to a given target.
  • unwind reduces leverage when over the target, and allows for USDC to be redeemed from Compound prior to user exit.

MIP30c2: Test cases

Tests can be found in crop.t.sol. The basic rewards adapter is covered for a mock token reward and this base is extended to test against mock and real Compound behaviour (via RPC). The effect of flash loans on gas costs and collateral reachability is explored, and a number of more complex scenarios are tested against on-chain Compound, e.g. interest accumulation, liquidation, and arbitrary seizure. The mathematical behaviour of Compound is considered in depth in the documentation and tests.

MIP30c3: Security considerations

Security risks of cUSDC-CROP include:

Compound technical risk

Errors or security vulnerabilities in the Compound system could cause the cUSDC-CROP adapter to behave unexpectedly, or could result in the underlying USDC deposits to be lost or stolen.

CropJoin implementation technical risk

In addition to the technical risk inherent to Compound, the adapter implementation itself is non-trivial and could increase the attack/error surface.

Due to the design of multi-collateral DAI, worst-case losses should be limited to the collateral deposited in the adapter, and the debt ceiling should be set with this in mind.

MIP30c4: Economic / Governance considerations

MIP30c4A: Economic risks

It is fair to say that cUSDC-CROP collateral inherits the risks of USDC, and includes the following additional risks, as a minimum:

Compound insolvency contagion risk

If the value of collateral/outstanding borrows in the Compound system drops/rises (respectively) too quickly before collateral can be liquidated to cover debts, it is possible for the system to become insolvent (similarly to how underwater CDPs in MakerDAO can exhaust the surplus buffer and eventually lead to insolvency). In that case, users of this adapter may take a loss, and if the loss is great enough, cUSDC-CROP CDPs may become underwater too, resulting in Compound insolvency spreading to MakerDAO.

Compound liquidity risk

Even if the Compound system is solvent, there is no theoretical guarantee that it is possible at any time to withdraw a supplied asset, since the reserves of the supplied asset may be tied up in outstanding borrows. In that case, it may be impossible to withdraw USDC from the adapter until a USDC reserve is accumulated in the contract, either through repaid borrows or additional supply. In order to prevent illiquidity events, Compound adjusts supply and borrow rates dynamically based on utilisation, incentivising supply and repayment with very high interest rates when reserves run low. Historically, the Compound platform has been successful at managing liquidity with this technique.

MIP30c4B: Governance considerations

In order for the cUSDC-CROP collateral type to stay competitive relative to other Defi yield opportunities, while maximising returns for MakerDAO, it may be necessary to periodically adjust the stability fee to reflect prevailing market rates and the Compound COMP-adjusted yield on USDC.

In the future, the same mechanism can be used to deploy adapters for leveraging other “yield farming” schemes.

MIP30c4C: Example parameters

n.b. see predictions.exchange or stat.farm for useful COMP-adjusted yield calculators

At the time of writing, a “levered” Compound USDC deposit (with LTV of 67.4%) yielded a COMP-adjust APY of about 14.6%.

We consider some example risk parameters to illustrate the economics: with a liquidation ratio of 110%, and stability fee of 10%, a user maintaining a collateral ratio of 111% will have levered up around 10x on their net interest of 14.6% - 10.0%, earning a net carry of around 46% APY.

From the perspective of the user, this is well above the USDC yield on most established “yield farms”. From the perspective of MakerDAO, the stability fee is much higher than that of any existing major collateral type, and the high collateralisation ratio of 110% allows liquidations to be initially disabled (similarly to the status quo with USDC-A) with interest still being effectively collectable for at least one year following the opening of a CDP.

MIP30c5: Formal verification/audit information

The proposed contract is written in a way which is amenable to formal specification and verification, in accordance with the style and practices of the core multi-collateral DAI contracts, though it has not been formally specified. Full formal specification would be a challenge due to the dependence on Compound supply / borrow / reward logic, which is non-trivial compared to a simple token transfer as it would require modelling of much of Compound.

No audit or code review has taken place yet.

MIP30c6: Licensing


@equivrel love the detail of work on this right to the code. You are a beast on these because of that one quality.

Two questions:

At some point compound was considering limiting the borrow to some % of deposits did this ever happen or can the borrow still approach 100%?

In the case that cUSDC can’t be redeemed is there a thought what trying to auction cUSDC would look like in this case. I have never seen that cUSDC or other cToken markets have gotten any significant liqjuidity. What is the thinking about selling cUSDC assets in liquidation here vs. just keeping them on the books until compound gets liquidity for redemptions?

What is the thinking on cUSDC oracle price with this?


Can you walk me through the UX from the end user? So lets say I go to oasis and deposit USDC into this new vault type. Would I then receive DAI and COMP over time? How would my COMP rewards be presented? Simply put, what would my output be after inputing USDC and how would I interact with it?


PS. Great work, this looks very exciting.


I really like the idea, however what worries me is that we are really entering into new kinds of risks not seen before. The debt ceiling must be determined in basis of any compound risks not having a material impact on us, with that in mind we could not be talking of any substantial debt ceiling and if we were, if anything significant were to happen within compound the impact would make black thursday look like a sunny afternoon.

Having said that I’m no developer so I don’t know the likelyhood of that event (only that if it does happen probabilities are irrelevant). Just even though it is a really tempting and well written proposal I’m frankly worried of the potential risks if things go south.


The UX for the adapter is pretty similar to the UX for COMP-farming on Compound. After the user deposits USDC in the adapter, any time that they again interact with the adapter they will receive the COMP reward accrued since the last interaction. The COMP reward is paid directly to the user, in-kind (in COMP) and not converted to DAI or USDC, etc.

It is possible to simply deposit into the adapter and earn the COMP reward, but most users will probably want to borrow DAI against their deposited USDC, and use it to buy more USDC to deposit into the adapter to multiply their yield. As they do this, they will be selling DAI on the market for USDC which of course helps with the supply side of the peg.


Great proposal @equivrel and Rain. I’m happy to see you making good use of the motivation section. You lay out some strong arguments.

I do have some questions around liquidations and emergency shutdown.

  • Is it possible to liquidate these vaults? Do they need to be unwound first? Who pays the gas cost for this?
  • How do these behave in emergency shutdown? What token do DAI Holders receive from these vaults when redeeming DAI against the collateral portfolio?
  • What happens if you need to unwind these vaults and are not able to due to Compound liquidity?

I also have questions of this kind. In particular because I think (but I could be wrong) that, unlike Uniswap or Curve, Compound does not have guaranteed liquidity/withdraw, right?

Source: https://compound.finance/documents/Compound.Whitepaper.pdf

1 Like

@LongForWisdom @MakerMan liquidations could be disabled for this collateral type, with the same justification as USDC-A. The collateral here is more risky, but follows a very predictable and slow interest accumulation on the compound side. You can think of this as a USDC adapter with an added investment strategy, cUSDC is just an implementation detail.

Auction participants deal in internal Maker collateral balances, rather than the external asset. The winner of an auction would have an internal collateral balance which they would have to exit to real collateral, likely preceded by an unwind to make the liquidity available, just like any other holder of balances in this adapter. Available compound liquidity is a risk, as noted in the MIP.

The oracle price is given by nps * usdc_price, the net assets per internal collateral unit multipled by the usdc/dai price (currently 1, as in USDC-A). The code for this will be added soon.

Emergency shutdown is the same as for other collateral types - we reason in terms of internal collateral balances, with a price given at the time of ES. Holders of this collateral after ES then have to unwind and exit via this adapter.


Yep, I read this in the MIP, which is fine. I think it makes sense. I’m more concerned that people might let them drop below the ratio, at which point we need to liquidate manually. In this situation, what does the liquidation process look like?

I guess my question is what does the internal collateral balance represent in this case? A share of the recycled USDC position on Compound? I guess I don’t understand how this position is divided, it doesn’t have it’s own token, right? cUSDC represents the supplied portion, but not the recycled borrows?


There wouldn’t be anything special about the liquidation. It would be the same as if USDC-A liquidations were to occur. However, we can just have liquidation enabled from the outset.

The internal collateral balance represents your share of the net asset valuation of the adapter. The nav is given by the outstanding Compound supply less the outstanding Compound borrows, plus any unused USDC in the adapter. The value of your adapter balance will change over time, depending on the Compound borrow-supply spread.

Usually the nav will slowly decrease in terms of USDC, although sometimes (like now) it can increase if Compound is paying more for supply than it is taking for borrowing.


Okay, am I correct in assuming that the auction winner would be the one to unwind the vault and claim the USDC collateral (leaving some for the owner, assuming the auction performs well enough)?

Okay, so in an ES situation at redemption an entity would presumably accumulate a reasonable amount of the collateral share for this collateral, and then call unwind on the vault so they could access their share of the USDC?

Okay, am I correct in assuming that the auction winner would be the one to unwind the vault and claim the USDC collateral (leaving some for the owner, assuming the auction performs well enough)?

Yes, there is an exit_ argument to unwind, which lets them specify exactly how much USDC should be released from Compound, for them to then exit with.

Okay, so in an ES situation at redemption an entity would presumably accumulate a reasonable amount of the collateral share for this collateral, and then call unwind on the vault so they could access their share of the USDC?

I’m not sure what you mean by “reasonable”, but they would want to have at least enough to make the gas fees worth it and then unwind with an appropriate exit_ as above.

1 Like

Hah, this is what I meant. Perhaps reasonable was a poor choice of words. An amount that makes it net-beneficial to pay the gas fees.

I’ll note here that the gas costs of using this adapter can be substantial, due to the Compound interactions. Worst case, which would be exiting a huge position with no loan support, wind and unwind can cost 1.9M and 2.3M gas each. More normally we could expect 800k / 1M. The wind cost doesn’t matter so much as callers can wait until there is sufficient collateral to be worth calling, but the unwind cost is intrinsic to the cost of exiting.


Is this vault to be plug to the PSM?

This vault type is entirely separate from the PSM. You can view farmable assets as desirable collateral much like ETH / BTC where people will primarily be using it for leverage. These are assets we can continue to charge Stability Fees on.

The PSM on the other hand should be viewed as a safety net to keep the peg in line. We would prefer these other assets, but worst case we still want the peg to be stable.

That being said, we could use a farmable join adapter like this on the PSM as well to earn revenue for the protocol.


Yes sorry,
I meant convert USDC to CUSDC in the PSM on the gemToDai using the Cusdc vault.
and in return CUSDC to USDC on daiToGem.

Compound contract :
function mint(uint mintAmount) external returns (uint) {}
function redeem(uint redeemTokens) external returns (uint) {}

The only issue here is to get the exact amount on the redeem.

1 Like

Why not use YFI instead?

I don’t think anyone else mentioned it, but the proposed crop.sol breaks compatibility of API behavior.
Applications that are using the low level vat.flux, will have to add vat.tack in some cases (otherwise they will not be able to call gemjoin.exit().

Take DssProxyActions as a very simple example, the freeGem would revert if a malicious actor sent 1 wei of cUSDC to the user CDP (via the vat system) prior to the call (and/or while the tx is pending).

It is not unthinkable that others dapps at the very least will not be able to support the new collateral without a change in their smart contract code, even in the absence of a malicious actor.
In some cases it might even cause dapp funds to get stuck, but this is just a speculation.

  • Given cUSDC is not an existing collateral in any current dapp, maybe it is not a deal breaker, but maybe something worth noticing.

** I only took a quick look at the code, I could be wrong.


I am formally submitting MIP30 (CropJoin) for the January governance cycle.