How to avoid getting Rekt with Yield Farming

De.Fi Guides
5 min readSep 15, 2020

--

“DeFi, with the combination of an assortment of digital funds, automation of key processes, and more complex incentive structures that work across protocols — each with their own rapidly changing tech and governance practices — make for new types of security risks,” said Liz Steininger of Least Authority, a crypto security auditor. “Yet, despite these risks, the high yields are undeniably attractive to draw more users.”

Though DeFi and Yield Farming, in particular, are pretty young and arguably immature, projects promising astronomical returns have already dragged thousands of people in. As with everything new and unknown, it’s best to apply an analytical approach and research the project you consider investing in beforehand. It is critical to identify the risks and opportunity costs associated with yield farming in order to be prepared for any possible losses.

📈 APY risks

In the field where high APYs are promising high rewards, it is easy to forget that in fact, your annual percentage yield is unstable and depends on the following variables:

- Deposited assets prices.

- Pool liquidity, and your respective share in the pool rewards allocation.

- Tokens prices.

The fact that all the above are variables, before investing you should weigh (i) the opportunity costs against (ii) the potential gains, should any of the variables changes.

💸 Liquidation Risk

If you are using collateralized loans on such platforms as Compound, MakerDAO or Aave, liquidations may occur. Liquidations happen when your collateral due to the volatility of either the borrowed asset, or the collateral, is no longer sufficient to cover the amount of your loan, triggering automated liquidation (sale) of collateral, and the additional related costs, i.e. penalties and liquidation discounts (when assets are urgently sold at lower than market prices).

In order to mitigate the risk of liquidation, make sure to maintain sufficient levels of collateral and monitor the price actions of both, the borrowed asset, and the currency of collateral. Depending on your strategy, you might wish to consider using the assets with relatively low volatility, like DAI, USDT, USDC, PAX etc. in the process.

If both the collateral and the loan are less volatile assets or stablecoins, such as borrowing USDC against DAI Collateral, your liquidation risk will be greatly reduced.

DeFiSaver’s Automation feature can save your MakerDAO Vault from Liquidation

If you are using MakerDAO to take out a collateralized loan, there is also an application that can save you from liquidation — DeFiSaver. DeFiSaver is an application which uses flash loans along with your collateral to automate the repayment of your loan. Just set a Boost point on the automation screen, and when DeFiSaver detects that your loan has reached that point, it will automatically start the repayment process.

As tempting as it is to borrow large sums, be careful. Try borrowing only healthy amounts, for instance Compound shows this as your loan being in the green zone. Always check and think about how much you can possibly lose without it being hard on your wallet.

📉 Impermanent Loss

When supplying your funds to any of the Automatic Market Makers (AMM) such as Uniswap, for example, you have to understand that if the price shifts too much, you can lose a lot of money.

Impermanent Loss on Uniswap- source: Uniswap documentation

This phenomenon is called impermanent loss and, to put it simply, it is a difference between holding tokens in an AMM, and holding them in your wallet. Why “impermanent”? Because as long as the relative prices of the tokens in the AMM return to their original state when you entered the AMM, the loss disappears and you earn 100% of the trading fees.

However, this is not always the case. Oftentimes, impermanent loss becomes permanent, leaving you with negative returns.

To avoid issues with impermanent loss, liquidity providers should choose the pools they enter, and, importantly, the timing, wisely, and also consider using protocols besides Unsiwap such as Curve or Balancer.

Curve only trades assets that trade within a tight band with each other. This includes low volatility coins (DAI, USDC, etc.) or “stable-pairs” such as WBTC with SBTC and renBTC. Since these assets generally do not move much in price relative to each other, impermanent loss is reduced to be almost negligible. Balancer is another project which also can be used to address impermanent loss. While Uniswap uses 50/50 pools, Balancer allows other weights. By constructing a heavily weighted 90/10 pool in favor of a single asset, you can retain most of the upside in case it shoots up in price.

🔪 Transaction fees

To anyone who’s been yield farming, gas costs are something you simply can’t ignore. A desire to start yield farming by supplying liquidity into a pool is oftentimes accompanied by a huge gas cost. At this point, you have to either wait for the commissions to decrease or make your peace with high transaction costs. This risk is predominant because most DeFi protocols operate in Ethereum Blockchain, and you can check the current gas prices with the ETHGasStation when considering your moves.

💣Smart Contract Risk

When you are intending to start your yield farming journey, it is important to understand that you basically supply your assets to smart contracts on Ethereum chain, and hold them there for long periods of time. The risk is a given — if anyone successfully attacks (or utilizes an exploit in) the contract, your funds’ safety could be compromised. E.g. Earlier this year, dForce, a lending platform, was attacked for $25M. MakerDAO had one huge mishap — “Black Thursday.” There was also the exploit against flash loan provider bZx.

🔮 Oracles Risk

One of the most substantial blockchain-related risks is The Oracle Problem. An oracle is a third-party service that fetches the external information and provides it to the blockchain. Respectively smart contracts execute their commands based on that data. If the oracle is in fact compromised, the smart contract relying on it is also compromised.

👮🏻‍♂️ Infinite Minting Risk

Apart from the hacking risk, there is always a possibility of a scam project. Some projects have infinite minting embedded in their code. This means that the project can mint their token infinitely, surpassing the token supply. The problem occurs when the owner of the smart contract can call this function. Eventually, the owner can sell this huge amount of such project’s tokens on exchanges like Uniswap or Balancer, in exchange for the assets that were basically added to a pool by liquidity providers.

That is why you have to be especially careful when investing in unaudited smart contracts. While an audit indeed provides some comfort, remember also, that even successful audits do not eliminate the risks completely.

In the end, remember yielding is super risky, and you will have to learn a lot in order to earn your passive income in a smart way. Check some words of wisdom from Vitalik Buterin:

--

--