[Strategy] yDai - Leveraged COMP farming - added yUSDC & yUNI


Use Dai in the yDai Vault to supply and borrow Dai on Compound and sell COMP for yield and to pay the fees. Instead of a simple supply and borrow we can maximise yield by leveraging both positions up to the collateral factor.


The vault uses recursion (or flashloans or other means) to supply Compound with dai_vault * 1/(1-collatoral_factor) and borrows dai_vault * (1/(1-collatoral_factor)-1). The position should not be liquidatable because the collateral token and the borrowed token are the same and the ratio is fixed when setting up the position. A safety margin should be applied to the collateral factor, which would decrease yield slightly.

Example with current Compound rates:

100 Dai in Vault
Collateral Factor for Dai is currently 75%
100 Dai * 1/0.25 -> 400 Dai supplied with 5.86% APY
(2.82% supply rate + 3.04% COMP)
100 Dai * 1/0.25-1 -> 300 Dai borrowed with 0.10% APY 
   (-3.90% borrow rate + 4.00% COMP)
23.744% APY total
300 Dai borrowed is exactly 75% of the 400

With a safetly margin of 5% (using only a collateral ratio of 70%) we still get 19.7% APY.


Get better yield than currently. This Strategy can also be used for yUSDC vaults (or others e.g yUNI) and for usage in the yETH vault. Once implemented we can use it in v2 Vaults as an alternative strategy for many vaults (basically any profitable token on Compound). Currently there are 1200 million Dai supplied in Compound and about 960 million Dai borrowed out. Imo some 100 million more or less should not impact rates too much - especially since both supply and borrow amout in compound raise in similar proportion.


Supply 1/(1-scf) #token_in_vault to COMP and Borrow 1/(1-scf)-1 #token_in_vault from COMP to farm COMP with leverage.
collateral_factor (short cf) is defined by COMP per token_type.
safe_collateral_factor (short scf) is defined by Yearn to ensure no liquidation takes place.
scf = cf - safety_margin

cf = 0.75
scf = 0.7 (proposed - to be discussed)
For UNI:
cf = 0.6
scf = 0.55 (proposed - to be discussed)

There are multiple options to go into leveraged positions in COMP:

  1. Recursion
  2. Flashloan
  3. Pseudo-Flashloan

Recursion is illustrated in the diagram:

recursive_token (1)
Flashloan utilizes Aaves flashloans for providing the target supply according to the formula without iterating. The borrowed assets are used to pay back the flashloan.

Pseudo-Flashloans could use other funds as collateral (e.g. YFI) to borrow the funds from a lending platform (probably Aave) to reach target supply without paying the fees for a regular flashloan. The debt could be payed back subsequently (even in the same transaction) with the borrowed asset.


  • Better yield than current vault
  • Usable for other Vaults
  • great addition to v2 Vaults as an additional strategy


  • With large volume it might impact Compounds rates
  • Need to track collateral ratio if Compound community decides to change ratio


Should we add this Strategy to out Vaults
  • Cool let’s do it
  • Nah this sucks
0 voters

if you open the position exactly at the liquidation ratio, won’t it be vulnerable the second it starts accruing interest, since the borrow rate is higher than the supply rate?

1 Like

How does 400 DAI with a 5.86% APY and 300 DAI with 0.10% APY equal a total of 23.74% APY specified in your example?

Initial investment is 100 Dai - you get 400 Dai with 5,86% and 300 Dai with 0.10% from it.

1 Like

Absolutely! There probably needs to be a safety margin! There is a safety margin in Compound of 5% additional to the collateral ratio, but I’m not sure it would apply in this case.

safe_collateral_factor = collateral_factor - safety_margin

I added a sentence about a safety margin. With a safetly margin of 5% we still get 19.7% APY.

1 Like

The APY will be reduced with the volume we would provide, not sure you will be able to leverage yourself that much.

Though, given V2 vault will allow up to 20 strategies, it sounds reasonable to have this one running with limited funds.

I’m currently working on a strategy extremely similar to this with @macarse right now. The relevant forum post is attached.

We decided to start building on Compound instead of Aave at the moment due to the added yield from COMP - but the core concept is nearly identical.

Note: this is all out of date. Apologies. Please ignore!
One important note: You cannot supply and borrow the same asset on Compound. If you supplied DAI you couldn’t borrow it - so this won’t work as written. You’d need to take out a different stablecoin for the leveraging. This introduces liquidation risk to the vault in the unlikely scenario that DAI falls in value compared to the other stablecoin, e.g. USDC.

Edit: it is possible to supply/borrow the same asset on Compound. I was wrong. Womp womp.


It was possible before if you interacted with the smartcontract before - did they fix this?
Personally I borrowed tether and deposited usdc/dai (depending on the rates) switched via SWERVE/CURVE.

Are you absolutely sure its not possible anymore? Because the risk is much higher if you use different stablecoins…

1 Like

Nope, I was wrong. It looks like you can now! Will edit my previous post.

You can use Instadapp as a second layer to be able to supply the borrowed asset again into comp.

I guess this is where I am still confused. How does 100 DAI get you 400 DAI.

How does 5.86% + 0.10% = 23.74% APY.

Can you break it down step by step?

Can you elaborate on the comp airdrop trigger? Is it not a function of time?
I won’t be the one implementing it - but I guess sharing is caring :slight_smile: and I’m curious about your contract.

1 Like

@gspoosi Why don’t you send those wrapped coins into the compound curve pool on top of your leverage?
The CRV distribution is currently appealing

Pickle already implemented this strategy…

So we just too slow on the strategy front - imo we should still use it, since yearn is not anon…


This thread would probably help : Request for "Knowledge Base" howto - learning steps for becoming a strategy writer

Even if Pickle already released this strategy, I still think most people would rather deposit their funds on yearn. Single assets strategies are very much needed in our products range and COMP is a great starting point.

1 Like

Even if Pickle already released this strategy, I still think most people would rather deposit their funds on yearn

Totally agreed

1 Like

I agree yearn should have it too. I highlighted that Pickle already has it and lately has been faster in implementing new vaults (they call them jars)

1 Like

Can’t we just farm pickle jar instead? Earn pickle PLUS comp.