Table of Contents

The cryptocurrency theme of 2020 was DeFi, and despite the recent NFT mania, DeFi protocols are as relevant as ever in early 2021. In fact, new ones are popping up daily — giving investors an even greater wealth of choices than they had months ago.

Even after filtering out potential rug-pulls, there’s still a plethora of projects competing for your liquidity, and unfortunately, an abundance of different ways they calculate APY, often times misleading users. A couple of examples are not immediately informing the user about token locking, and not taking into account various fees.

Therefore liquidity providers would be wise to do the APY math themselves, and in this article, we will give you the most important guidelines.

## Lending vs Liquidity Provision

Lending platforms have the benefit of significantly simpler APY math — if Aave claims that you’ll receive 10% APY on your DAI, for example, this means that, given the current appreciation rate of deposited DAI remains stable for the next 365 days, your stack would increase by 10%.

The case for Uniswap clones offering liquidity mining rewards is not as simple, though, for three major reasons:

- For the most part, you are receiving your rewards in a token different than the ones you have deposited
- Your rewards do not automatically start mining, therefore there is no compound interest unless you manually sell the reward token and deposit periodically
- The actions of claiming a reward, selling it, and then depositing your returns in a liquidity pool are usually subject to a network fee and a liquidity provider fee

Due to all of these factors, APY calculations can become cumbersome and complicated to the point where exact calculations are not worth the time and effort. However, investors could benefit from taking multiple details into account in order to gain a good approximation — which would in turn benefit their yields substantially.

### Concrete Example

To make the statement clearer, let’s examine a hypothetical scenario: you are depositing 100,000 DAI and 100,000 USDC.

If we are to deposit them at 10% APY on Aave, and if the rates remain stable for a year, we would have 110,000 DAI and 110,000 USDC this time next year — pretty predictable.

However, things are a bit more complicated if we were to provide liquidity for a DAI-USDC pair on a Uniswap clone.

## The (Seemingly) Equivalent Liquidity Pool

Let us assume that the total liquidity of the pool is $2,000,000 (we are providing 10% of the entire liquidity). Let us also imagine that liquidity providers are being rewarded in Uniswap Clone Governance Tokens (UCGT) — with a total of 100 per day being split between them. At a price of $5.48 per UCGT, and if we only claim our rewards once per year, we’ll get:

365 days * 10 tokens per day * $5.48 per token = ~$20,000 or 10%, just like in Aave.

That being said, there are multiple fine details that were not taken into account in the above example. Most notably:

- We did not take advantage of the opportunity to reinvest our rewards
- We assumed a stable price for the UCGT token
- We assumed a stable amount of money in the pool
- We assumed that the amount of reward tokens being sent to users would remain stable throughout the year
- Thanks to our choice of two stablecoins, we faced no impermanent loss

## Reinvesting Rewards

Letting rewards accumulate and not doing anything with them is almost never a good idea, unless you are bullish on the price of the token itself. This exposes you to the risk of losing value as the price of the reward token goes down, and even if we assume some price stability, by not putting your rewards to work you are leaving money on the table. Here is a simple example.

Let’s take the above scenario with the USDC-DAI pool, and this time decide that we will dump our rewards every day, buying DAI and USDC with them, and reinvesting back into the pool. For the sake of simplicity, let us also presume that:

- For every new dollar we put in the pool, someone else withdraws a dollar, keeping the deposited amount in the pool at a stable $2,000,000
- The transactions to claim a reward, swap from UCGT to DAI and USDC, deposit into the DAI-USDC pool and stake the liquidity provider tokens are all fee-less

In this case, instead of 10% per year, we are calculating in terms of 10 tokens per day ($54.8 for our $200,000 deposit). This means that we are getting a daily portfolio appreciation of $200,054.8/$200,000, which is exactly a 1.000274 multiplier. So our (overly simplified) math this time is:

$200,000 * (1.000274 ^ 365)

In this case, the result is $221,033.37 (~10.5% APY).

So while on the surface we are faced with the same APY, this time instead of 10% we are getting 10.5% thanks to manually reinvesting our rewards every day. If it wasn’t obvious by now, hourly reinvestments in this case would be even more profitable and the more frequent our claims get, the higher the rewards we will end up receiving.

### Reinvesting Rewards in High APY Scenarios

Chances are, you are not impressed by a further 0.5% on top of your APY, especially if you are a small holder. However, keep in mind that unlike lending platforms such as Aave, most liquidity mining programs at the moment offer upwards of 50% APY, with some exceeding 100%. So let us run the calculations again, except this time, instead of 100 tokens per day, let’s say that the liquidity mining program is for a total of 1,000 tokens daily, distributed to liquidity providers.

In this case we will be making $548 per day, and withdrawing once per year would result in 100% APY (with a 1.00274 multiplier). If high school math is a distant memory, you might mistakenly think that based on the above example you’ll receive around 105% APY through daily reinvestments. And while 5% on top is already a good enough reason to get excited, the real math looks even better.

1.00274 ^ 365 = 2.71483821055

With this multiplier, re-staking the rewards every day would raise our APY from 100% to upwards of 171%.

This is a dramatic difference, and in the current (admittedly unsustainable) state of liquidity mining profitability in DeFi, this is the more realistic scenario, which we will stick to in the following examples.

The high APY assumption is better at accurately representing the current state of DeFi liquidity mining. However, we did start with a number of fairly unrealistic assumptions so let us remove them next.

## Adding Fees to The Calculation

Unless you are trading on QuickSwap (which utilises Polygon/Matic), or some other layer 2 solution with subsidised fees, chances are the number of transactions required to restake your rewards is substantial, as is the amount paid in network fees and trading fees.

Of course, fees vary from platform to platform. On Ethereum, we would be lucky to only pay $50 in fees for the privilege. On Pangolin (running on Avalanche) we might get away with as little as $3 (although $10 is more realistic at present). Still, Ethereum layer 1 solutions are by far the most popular in the industry, so users will likely have to settle for a massive pay cut. Let us assume stable fees of $50 and go back to our example.

Similarly to the fee-less situation above we are getting a stable reward every day. This time, however, instead of $548 per day for a $200,000 investment, we will have to accept that our rewards have shrunk down to $498 because of network costs. So instead we have a multiplier of $200,498/$200,000 or 1.00249. This results in a yearly multiplication of:

1.00249 ^ 365 = 2.47866561417

… or an APY of 147% (instead of 171%) – a difference of $48,000 or almost a quarter of our initial investment. This time we cannot claim that the more frequent our withdrawals are, the more we make overall. Instead, there is a sweet spot, and every deviation in frequency would lower our profits.

### Finding The Sweet Spot

In order to pinpoint the most suitable restaking frequency, we will have to improve our precision — instead of using whole days as the smallest possible timeframe, we will need to dive deeper and calculate for number of blocks.

On average, Ethereum miners find 6,500 blocks per day, 2,372,500 a year. An APY of 100% when only withdrawn once per year would be equivalent to a multiplier of 1.0000004214963 (or 1/2,372,500 + 1) per block.

We are left with the following formula (with X being the number of blocks):

((200,000(1+1/2,372,500x)- 50)/200,000)^(2,372,500/x)

We politely ask Wolfram Alpha to plot this function so we can examine it closely, and are left with this function graph. As you can see from the form input, the function ends with “x=1to650000”, meaning we have asked Wolfram Alpha to plot us the expected returns yearly multiplier as long as we reinvest from anywhere to one Ethereum block to 100 days of Ethereum blocks (which is what 650,000 stands for).

As a user, you are free to change those values, and indeed if you turn the “x=1to650000” to a “x=53500to56000” you will see a zoomed edition, which will more accurately show you that our “sweet spot” is located somewhere around the 54000 block mark which is slightly more than 8 days.

We are not being specific about the block number because the reason for plotting the function is not to receive a definitive answer, but to give us a good guideline. Now that we know that 8 to 9 days would be perfect in the presence of static gas fees and reward token prices, we know a good approximate timeframe.

## The Uselessness of Specific Calculations

The examples so far were based on a number of assumptions in order to get the point across in an incremental fashion. It is still far from exact math, however, and the deeper we go, the less precise we can get, since at this point external factors beyond our control and capability to predict are more powerful than the data we have at our hands.

For example, our math is still far from perfect — it assumes that even though we are adding more money to the pool, the total deposited amount remains stable (which is only possible if someone immediately withdraws a sum equivalent to the sum we deposit every time we do so). While thanks to tools such as Wolfram Alpha it is trivial to incorporate changing APY into our formula, this wouldn’t do us any justice either.

Every single one of our deposits lowers the APY for all depositors. As we increase our stake, it is not *too* unreasonable to assume that others will be decreasing theirs, because as profitability in a specific pool goes down, other opportunities are arising elsewhere. By how much, at what rate — these are all questions that we cannot answer without some serious crystal ball skills.

There are multiple other factors that could also move the “sweet spot” which are not worth going into detail for.

The purpose of the examples given up until this point were to simply illustrate the following points:

- The APY calculations of your liquidity mining program are likely inaccurate approximations
- Selling a reward token and reinvesting the proceeds into the pool can massively increase your profitability
- Selling and restaking too frequently might not be the most profitable strategy due to high fees

## Important Considerations

Now that we have squeezed the most out of nerdy function plotting, it is time to finalise our profitability optimisation strategy.

### Ethereum

Most pools currently offer an APY between 30% and 200%. Gas fees for reinvesting in those pools using the first layer of the Ethereum network have once again recently risen to upwards of $100.

Rough math given the circumstances shows that at $100,000 invested in liquidity pools, there is absolutely no need to claim and reinvest rewards more frequently than once a week. Millionaires might benefit from daily withdrawals, and while I wish every single reader to join this group, in reality these investors are a very small minority. People with less than $10,000 in such pools should refrain from scheduling their withdrawals and opting for “low gas fee hunting” instead.

### Competing Chains

If your money is providing liquidity on another network — Binance Smart Chain, Polygon (Matic) or Avalanche — then daily reinvestments might be more beneficial. It is up to you whether the time spent to do so is worth it, as at the end of the day weekly withdrawals offer comparable APY.

This is especially true for users of QuickSwap (running on Polygon) as for the time being network fees are essentially non-existent there.

On Avalanche, and more specifically Pangolin, the fee to claim a reward, to sell half of it for one coin and the other half for another, to add liquidity to a pool and to then stake the liquidity tokens, is currently worth upwards of 0.33 AVAX, which is more than $10, so proceed with caution. That being said, Pangolin developers have hinted towards lower gas fees in the near future.

### Reward Token Price

Many people are being lured into liquidity mining because of their risk aversion. Unfortunately as with most cryptocurrency-related issues, you cannot fully escape speculation.

Managing to sell your reward tokens at their highest possible price will always give you better profitability than calculating the perfect time period between reinvestments. Of course, there is no way to know what that price is, but “as soon as possible” happens to be a foolproof plan almost every time, unless you believe that billion-dollar valuations for governance tokens are sustainable.

While holding UNI tokens gives access to a new airdrop of another governance token every few days, which might justify its high price, some of the valuations of tokens for competing products appear highly inflated, and having more to do with hype surrounding the product than any reasonable tokenomics. And often times the hype surrounding the product is caused by the high valuation of the token, which results in high yields for liquidity mining — a chain that once broken could cause frenzied market panic.

Obviously details vary from token to token, but I strongly advise you to take into account the tokenomics of the token you are being rewarded with. You will often see that a high valuation is unsustainable in its case, which should prompt you to be consistent with your selling.

### Low Gas Fee Hunting

Apart from complex computations and nerve-wrecking price feeds, there is one very simple way to optimise your profitability — patiently waiting for gas fees to drop.

Even if weekly reinvestments turn out to be the most profitable in the case of constant gas fees, selling your tokens two days early or two days late is a better option, if the alternative is to put up with 200 gwei for your transactions.

So if your planned token sale event is approaching, you should probably open a new tab for Eth Gas Station and start tracking it. Alternatively, you can make use of some of the ETH Gas Price alerting software tools available.

## Summary

We are currently in a transitional period in DeFi, where multiple projects are competing for their users’ liquidity through lucrative liquidity mining programs, the yields for which significantly exceed those for lending. Even profits from trading fees typically pale in comparison.

Therefore mastering the ability to optimise liquidity mining gains could prove more lucrative than researching new cryptocurrency products and other activities that previously filled up the time of the average crypto trader. Knowing how to compound gains, when to sell, and how to save on fees are invaluable skills for any cryptocurrency enthusiast serious about making profits.

## Discussion