# Auto Compounding explained

In this article we will explain in detail how our auto-compounding works.

The first part consists of a more technical look at the mathematics, which is then followed by a more general explanation.
At the end, you will find some FAQs.

# 🧮 The Math

The annual percentage rate (APR) represents yearly interest. It can be used as a part of a simple interest formula to find the future value (F) of an investment based on its present value (P):

where t represents the number of years your investment is held. Our simple interest formula assumes no compounding, which is, in fact, why it’s given the name simple.

For example, suppose you invest \$500 (P) with an apr of 20%. After 1 year (t), you would find your future value as follows:

Now let’s look at the annual percentage yield (APY) which represents yearly compound interest. It can be calculated from the apr and the number of yearly compounding periods (n) using the formula below:

The higher the apr and the more compounding periods, the higher the APY will be. For example, let’s find the APY given an apr of 100% and 365 compounding periods per year (daily compounding):

So now you might be wondering, how many compounding periods are there for KingDeFi’s auto-compounding KROWN farm? Well, we’ve specially engineered the smart contract so that everyone’s rewards compound each time there is some user interaction with the contract. The auto-compounding farm has been live now for a few days and we’ve had almost 6000 contract interactions so far!

For those wondering what entails a user interaction, depositing, withdrawing and harvesting are all user interactions which will trigger a compound event.

So how do we calculate the farm’s APY, if the number of compounding periods varies based on the number of user interactions? Let’s dive a little deeper…

There exists quite a neat mathematical approximation, relating to Euler’s number, e ≈ 2.718. We’re using some fancy mathematical notation below, but it essentially tells us that if the number of yearly compounding periods (n) is sufficiently large, the left and right hand sides of the equation are approximately equal.

Due to the high frequency of user interactions with the farm, this approximation allows us to rewrite our formula for APY more concisely as:

In a very similar manner, and again using the approximation, we can find a nice formula for the APY for a single day:

Let’s do some calculations. Suppose an APR of 365%.

# 🧑‍🦯 General explanation

Many of you may have wondered why there is still a Harvest button despite the auto-compounding.
We decided to leave the invested capital separate from the accrued interest. This way we also give you the possibility to harvest only the accrued interest, as well as having an immediate overview of the capital invested and the interest accrued.
The amount of accrued interest continues to be considered for auto-compounding. So you do NOT have to harvest and deposit in the pool again. You will only pay unnecessary fees.

So to give an example, if you have \$1000 deposited in the Vault and have accrued interest of \$100, the total amount considered for auto-compounding will be \$1100.

Precisely for this reason you will no longer find the words Pending on the front-end, but Autocompounded Rewards.

# ❓FAQs

## Why does your auto-compounding work differently from others I have seen on other sites?

In this article, we’ve seen that the more times you compound, the higher the APY. This is why we developed a contract that compounds at each interaction (every time someone deposits, harvests or withdraws).

We know most of you are used to other models, but we hope you can see we have opted for a different unique approach in the name of optimisation and cost efficiency.

## Why shouldn’t I manually Harvest and Deposit?

Harvesting and Depositing will each incur a gas fee. Since your rewards automatically compound in the auto-compounding farm, there’s no need for users to do this.

## Are there any transaction fees?

With our methodology we’ve optimised the compounding process. But logically we did not want you to pay fees for compounding the stakes of other users. This is why we have decided to leave the interest separate from the capital. This allows us to internally compound each user’s rewards for the usual low fee.