DeFi Mini Course: Part 4, Decentralized Hedge Funds

Before You Get Started on Part 4.

In this part, you’ll learn how to buy tokens in a decentralized hedge fund and then stake those tokens so you can vote as well as earn rewards. If you’ve missed Parts 1 – 3 of this course, here are the links – all prerequisites for this Part 4:

  1. Part 1, Wallet Setup for DeFi.
  2. Part 2, Uniswap, a Decentralized Currency Exchange.
  3. Part 3, Lending Platforms.

At a minimum, you’ll need a MetaMask wallet with about $50 worth of Ether to do this part of the course. Skip back to Part 1 for guidance on how to add to your wallet.

This course is priced at $9.99. If you find the course helpful – but don’t have the money to spend right now – I’d appreciate if you could instead share the course on social media or with two friends.

Disclaimer: Crypto is still in its infancy and very high risk. I recommend setting the expectation that you will lose all of the money you invest as you’re learning and treat it as an education. Throughout the mini-course, I will indicate the cryptos I hold myself, so at least – if you do copy me – I’ll lose money if you do! This course is not investing advice, it is intended to teach you how DeFi works! You are reading these materials and taking any guided steps at your own risk. Crypto is technical and funds are easily lost if you are not careful with passwords as well as sending and receiving money to/from the right wallet addresses – not to mind bugs in nascent software platforms or bad actors. Learn with small amounts to minimise your risk.

Part 4, Decentralised Hedge Funds

The problem of fees when earning crypto income

You’ll recall from Parts 2 and 3 that transaction costs for moving, exchanging or lending cryptos are high. As of Jan 2021, it can cost $20 per transaction just to move crypto from one wallet to another. Here are two the two basic transaction costs in DeFi – through the lens of a lending example:

  1. Depositing crypto into smart contracts. You’ll recall, from Part 3, lending out some USDC on Compound or Aave. Depositing the crypto will have cost you Ether to pay for gas.
  2. Withdrawing crypto from smart contracts. Once done lending, you’ll have to withdraw your crypto from the lending platform, again costing you gas.

Unfortunately, it’s worse than that because currently – in the early stages of DeFi – significant returns are earned not only through interest but also by receiving platform tokens as rewards. As a specific example, lenders and borrowers on the Compound platform earn Compound tokens for their participation, in proportion to interest earned/paid. This leads to a third transaction cost:

3. Rewards token withdrawals/conversions. You earn Compound tokens as you lend on the platform. At some point, you’ll want to convert these compound tokens into another crypto – likely back into USDC if you are engaged in a USDC strategy.

So you have this cycle where you earn Compound and then have to pay to convert it into USDC and then pay again to lend that USDC out.

Decentralized hedge funds as aggregators

Given the high cost of gas (transaction fees – which are largely flat fees per transaction), it makes sense that individuals might pool their funds together in order to reduce gas costs as a percentage of their funds. This is where platforms like and emerged.

A group of yield “farmers” pull together and write some smart contracts that allow them to invest in strategies (such as lending on Compound) together. Here is how one such strategy might work:

  1. A USDC lending strategy is set up that invests USDC on Compound.
  2. Compound tokens that are earned are automatically converted – using Uniswap or similar – for more USDC tokens, and this USDC is then reinvested in the USDC strategy.

This is called auto-compounding. The Harvest smart contracts automatically do the work of reinvesting profits. If you want to withdraw your funds from the pool, you get back your initial asset plus your proportional share of compounded profits.

The fees charged by Harvest

In return for this smart contract service, Harvest takes 30% of any profits made by investments (liquidity pools) on the platform.

That might seem like a lot! It is! However, gas fees are so high that investors still find it cheaper and easier to invest via Harvest and pay that 30% fee. As of Jan 2021 there is over $500M invested on the platform.

Where do the Harvest fees go?

They go to… yet another governance token – called FARM!

So the owners of FARM earn 30% of all profits earned by the liquidity pools on the Harvest platform.

Now, the platform offers all sorts of earning opportunities (lending, exchange pools etc.), so by owning FARM you own 30% of the profits across a wide variety of diversified yield farming strategies. Tasty! (also Risky!)

Now, before diving in with a DIY step, some risks with diversified hedge funds:

Risks of diversified hedge funds like

As with any DeFi initiative, there is smart contract risk involved in diversified hedge funds, only this time you’re taking on multiple layers of smart contract risk. There are the smart contracts for the earning platforms (e.g. Compound or Aave), but now you’re taking on a further layer of risk by investing via the layer of smart contract. There’s actually a third layer of smart contracts as well, if you’re to earn FARM rewards, which we’ll get into in the DIY section below.

Things can go very wrong indeed on DeFi platforms. Take a look at when the Harvest platform itself was subjected to an attack in October 2020 with over $30M made by the attacker at the expense of the platform. In understanding the attack, it may be of help for you to read on further and then come back to this section where I’ll give a high level overview.

In October 2020, the USDC and USDT pools on Harvest were attacked. Each pool was investing assets on the platform. Essentially, the attacker used a large amount of money (~17M) to move the price of USDC vs USDT on Curve, and then swooped in and out of the USDC pool on Harvest with ~$50M – taking advantage of the price mismatch cause on . The attacker made over $500k each time doing this and repeated the attack over ten times on the USDC pool in Harvest, and then on the USDT pool – sucking out over $30M in value from Harvest in the process.

Why did this happen and how could it be stopped? At a high level, this happened because the attacker was able to do a lot of transactions very quickly. Flash loans (where you simultaneously buy and sell at the same time) were allowed. Flash loans were subsequently disabled on Harvest, and the Harvest smart contracts broken down into more steps – which increases transaction costs (gas) – but improves security.

Harvest even then pulled together a reparations program for those who lost money and created a token called Grain to work towards making them whole. Still, FARM trades at a huge discount (over 10X) to Yearn – a competing hedge fund platform that has a similar level of assets invested.

When it comes to DeFi – particularly multi layered contracts – Caveat Emptor!

Investing with FARM and in FARM

There are two different ways to make money with or in Harvest.

  1. Investing in liquidity pools – which is just pooling your money with other investors into third party strategies (e.g. on Compound or Aave or Uniswap liquidity pools).
  2. Investing in FARM token itself – which is like taking ownership in a hedge fund and earning a share of the platform’s profits.
  1. *Investing in Liquidity Pools

*Navigate to, connect your Metamask wallet and swap $10 worth of Ether for $10 worth of USDC (you’ll have to pay for gas as usual using additional Ether in your wallet).

*Navigate to Harvest.Finance and hook up your metamask wallet.

*Scroll down to “Stablecoins”, click the dropdown and seek out USDC.

You can see USDC at the bottom, put 10 in the USDC box. Notice, to the right of the USDC symbol you can see the annualised return on the asset (based on recent returns – not guaranteed annual returns!). You can also see how much USDC is in the pool ($18.71M here), and you can see how much you’ve already deposited (I’ve got 20.227… deposited). You can also see some symbols for Compound, Idle, and Farm – the cryptos involved in the strategy.

So what’s happening here? In this USDC strategy, your USDC is going into a pool of $18.71 worth of USDC and invested into an Idle smart contract. Idle is a platform that moves money between lending platforms (like Compound and Aave) depending on where the best interest rate can be received. Idle has a platform token called Idle that you earn for using the platform. So Idle then takes the USDC and further invests it – in this case – using Compound’s platform, where the USDC earns interest but also Compound tokens

It’s a very multi layered strategy, the overall effect of which is that you lend USDC and receive interest (paid in USDC), Compound and Idle in return. Furthermore, the smart contracts sell off any Compound and Idle tokens earned and use the proceeds to buy more USDC. This means you are auto-compounding USDC to the tune of 28.56% on an annualised basis (measured based on recent returns, not a guaranteed return!).

*Scroll down and click “Deposit and Stake”:

“Deposit and Stake” button at the bottom right

Which leads to the question – what’s the difference between Deposit and “Deposit and Stake”?

Well, by depositing, you are simply pooling your USDC and investing in the strategy as described above. Technically, what happens here is that you lock your USDC into a smart contract, and the Harvest platform gives you back a fUSDC token in return. (if you locked in USDT instead, you could get back fUSDT). This fUSDC token just serves as your receipt for your investment.

However! You can take that receipt (the fUSDC) and further entrust that to a Harvest contract in return for earning some FARM rewards. This is called staking, and means you trust the platform in holding your receipt.

Actually, the 28.56% return mentioned above includes all forms of return – interest, Compound, Idle and FARM. So if you don’t stake your fAssets (the collective term for assets like fUSDC, fTUSD etc) then you won’t get quite as high of a return.

2. Investing in FARM itself

Alright, so we’ve seen above how you can earn auto-compounding interest on specific assets using You can alternatively get exposure to the whole platform of assets on harvest by buying the FARM token – which earns 30% of any profits made on the platform. This is a different kind of risk profile than providing liquidity to pools – as described with USDC above – in particular because there are no assets underlying FARM tokens. Specifically, if you invest USDC in a liquidity pool, you are entitled to withdraw that USDC at any time (absent any smart contract issues). By buying FARM you are not committing assets to a smart contract that earns a return, but rather just buying an asset.

*Navigate to, connect with Metamask, and convert $10 worth of Ether for $10 worth of FARM (you’ll need to do some back of the envelope maths to figure this exchange rate out.

*Navigate to and click on FARM Profit Sharing.

*Now enter the number of FARM that you have and click stake:

Use the bottom fields to stake farm. At the top, you can see that I have 10.6 FARM staked at the moment.

A recap on what you get from staking FARM

  1. The ability to vote on FARM governance matters
  2. Profitshare of 30% of liquidity pools (you get this indirectly because the platform uses those profits to buy FARM on the open market).
  3. Emissions! Yes, Harvest is still in the early phases and they are giving out FARM tokens every week to different groups, including those who have staked FARM (and USDC as in the last example).

Some Parting Technical Thoughts

Where do platform rewards come from – such as Compound or FARM? As mentioned above, by using certain platforms you can earn rewards (e.g. FARM tokens earned for using Harvest.Finance). When a platform is getting set up, those initiating the platform often decide to mint platform tokens and distribute them in certain amounts over a certain period of time. The total supply of tokens to be printed may be limited (such as Celo Gold, CGLD), or may be at the discretion of a majority vote of the platform tokens (also known as governance tokens). The ways in which tokens are distributed also varies widely, but often is designed to reward the platform founders and/or incentivise the use of the platform by early adopters. In short, platform tokens serve at least two purposes:

  1. Governance – with a majority vote of the tokens allowing changes to be made to the smart contracts.
  2. Rewards – to incentivise certain behaviours on the platform.

Interestingly – some of these tokens have no intrinsic value in themselves, other than the ability to govern the platform. Some examples:

The Farm token is entitled to 30% of the profits from liquidity pools on the platform.

The Uniswap token is not entitled to any profits, but there is a provision that 0.05% of the 0.3% transaction fee can be redirected to the protocol at some point in the future.

The Compound token does not earn anything at the moment, but it does govern the platform, so its value accrues from the right to divert earnings to the token at some point in the future. Yes, interesting…

Where do the 30% of profits actually flow – are they directly paid to FARM holders? Actually, no. Profits are used to buy FARM tokens on the open market, which puts an upward effect on the price of FARM – it’s kind of like a company buying back its own stock.

Almost done with Part 4 on Decentralized Hedge Funds!

So you now have a way to invest in liquidity pools and strategies while mitigating fees and automating the selling and reinvestment of any platform tokens received.

You also have a way to earn a share of profits from a diversified range of strategies.

That brings us to the Part 4 quiz and the end of this introductory DeFi course. If you enjoyed it, consider letting one or two more friends know about it, and also signing up for my monthly newsletter so you don’t miss out on any more DeFi updates from me.

Once you’ve clicked Submit on the quiz, scroll up to see your answers!

Published by Ronan McGovern

CEO at Sandymount Technologies

2 thoughts on “DeFi Mini Course: Part 4, Decentralized Hedge Funds

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s