How to Maximize Security While Yield Farming on DeFi Protocols

The decentralized finance (DeFi) space is growing at an astounding pace, partly thanks to yield farmers. DeFi now has over $32 billion in total value locked, up from $1 billion a year ago. While some farmers are making healthy profits on the market, others have lost thousands in DeFi.

It’s important to know how to maximize security while yield farming. First, it’s important to understand that yield farming – or liquidity mining as some refer to it – involves generating rewards with your cryptocurrency holdings by locking them up on smart contracts, more often than not on the Ethereum network.                                             

Yield Farming Rewards

The rewards are above-average to say the least, with annual percentage yields (APYs) often surpassing 1,000% for short periods of time. In a recent release, Defi Yield Protocol (DYP) revealed that since launch 2,575.63 ETH worth $4.2 million were paid out to liquidity providers.

In the 24 hours ahead of that release, 106 ETH (over $170,000) were earned. To start providing liquidity and earning ETH rewards, users must deposit liquidity provider tokens (Uniswap LP tokens) into a corresponding initial list of pools. Each pool has four different staking options, with rewards starting from 30,000 DYP up to 100,000 DYP each month, depending on the lock time from a minimum of three days up to 90 days.

DYP’s decentralized application includes a referral system, and each pool has four different staking options, with rewards starting from 20% APR up to 35% APR, depending on the lock time from a minimum of thirty days up to 120 days.

On other decentralized finance protocols, including Compound, Uniswap, and Curve, earning tokens involves the same method: locking up funds to earn interest on your cryptocurrency holdings, while also earning rewards in the platform’s governance token. Some of these projects have over $3 billion in total value locked.

Interest is earned as your funds are lent out to other traders borrowing funds. It’s also possible to farm yield by borrowing the funds yourself, although it’s necessary to post enough collateral to cover your loan, acting as insurance.

This leads us to our first risk associated with DeFi yield farming: liquidation.

Avoiding Liquidation

Let’s say you deposit wrapped bitcoin (wBTC) onto a DeFi platform to take out a loan in the DAI stablecoin. Assuming wBTC is trading at $35,000 and you deposit 1 wBTC, you may be able to take a loan for, for example, 20,000 DAI on this specific platform.

The loan allows you to maintain your BTC exposure while having access to funds you can move to other platforms. Yield farming can get extremely complex, as farmers use loaned funds on other yield farming platforms, and create chains of loaned funds to maximize yield.

In our scenario, if the price of wBTC tanks and the collateral’s value falls below the threshold required by the protocol, it will liquidate your funds on the open market to cover the loan. There are two strategies you can use to avoid liquidation, with the first being the most obvious: add more collateral.

The crypto market can be rather volatile and unpredictable, however, and as such the best way to avoid liquidation is to set your own collateralization ratio rules, above those of the DeFi platform you are using.

If a lending protocol requires a collateralization ratio of 200%, upping it to 300% may be an option, as it will reduce the risk of violent market crashes leading to a liquidation event. There are tools like DeFiSaver out there, which reduce the chance of liquidation by using flash loans to automate the repayment of your loan. It’s not, however, a guarantee of safety.

Impermanent loss

Impermanent loss occurs when liquidity providers on Uniswap or other automated market markets can lose money by supplying the funds to the platform to earn interest, when compared to just holding the underlying assets.

In the example given in the first article used to describe impermanent loss Pintail pointed to 1 ETH and 100 DAI being supplied to the ETH-DAI pool on Uniswap, giving the provider 1% of the pool’s total. This would mean the pool contains 10,000 DAI and 100 ETH in total liquidity (k), and implies the price of 1 ETH at the time is 100 DAI.

Leaving fees aside, if the price of 1 ETH moves up to 120 DAI, the total amount of funds in the pool will shift to 91.2971 ETH and 10,954.4511 DAI. The 1% stake in the pool is now 0.9129 ETH and 109.54 DAI. Our liquidity is now worth $219.09 in total.

While the liquidity provider is in the green, if they had held onto the 1 ETH and 100 DAI without putting them on Uniswap, the value of their holdings would be $220.  Essentially, the liquidity provider could lose out on potential opportunities using Uniswap. So in this case the impermanent loss is $220 - $219.09 = $0.91, which might not seem like a lot but it adds up as the liquidity size and price change in the pool assets increases.

The impermanent loss effect occurs whether the price of cryptoassets goes up or down. The loss is impermanent, however, as the price of the pooled funds could fluctuate back to when they were first added to the pool. In this case, the effect is mitigated and the liquidity provider earns fees.

Liquidity providers are looking for low volatility markets but as we all know that is not likely in crypto! The best way to avoid impermanent loss is to use pools on platforms like Curve, which include stablecoins or tokenized versions of BTC. These assets generally do not move much in price relative to each other, making a potential loss negligible.

Smart contracts and composability

Yield farming involves locking your assets on smart contracts, which often aren’t fail-proof. If a smart contract is attacked and your funds are locked in it, they may be at risk. Several attacks have occurred in the past using flash loans and other exploits.

Smart contract risk becomes worse when we add the compatibility factor. Each DeFi protocol can be combined with other protocols to build new applications that are greater than the sum of their parts. This is because DeFi apps are built using publicly available code that lives on the blockchain.

DeFi applications often leverage other applications for additional functionalities. It’s possible to earn interest on Compound, which hands users cTokens they can redeem, and use these cTokens elsewhere to earn interest.

This means the farmer is not just trusting Compound’s smart contracts, but also those of the other protocol they use. This increases risk while maximizing reward. The best way to mitigate these risks is to avoid using unsecured platforms.

Looking for projects using audited smart contracts with a good track record is the key here.

Related guides

DeFi Yield Protocol Liquidity Providers Earn $25,000 in ETH per Day Staking DYP DeFi Yield Protocol Could Be a Massive Boost for Yield Farmers and the DeFi Space. Don-Key Capitalizes Social Yield Farming Platform With $2.2 Million From Leading Blockchain Funds DYP.Finance: A Unique Yield Farming Platform What is Decentralized Finance (DeFi)? A Complete Guide Beyond the Token Economy – How Convergence Brings Private Investment Into DeFi DeFi Has Fueled the Ether Boom — Could a Crash Be Coming?

Popular guides

Ariva Receives a Significant Boost With the Listing of ARV on Gate.io Sponsored Get Instant Crypto Loans in 3 Easy Steps What is a Bitcoin ETF? A Basic Overview of the Best Privacy Coins What Is the Binance Coin (BNB)? How to buy on Amazon with Bitcoin What is El Petro and What Does it Mean for the World