Farming

From TON Wiki (En)

Farming is the practice of renting out crypto assets to earn rewards. The coin owner receives a reward for aiding in facilitating trading and lending on DeFi platforms.

Essentially, farming is one of the methods for passive earning in the world of cryptocurrencies.

Creation

Liquidity farming emerged in the summer of 2020 as an alternative to savings accounts during the Covid-19 pandemic. It became possible through the advent of smart contracts, which automate liquidity provision and management, as well as reward distribution.

How it works

The key component of farming is liquidity pools — repositories consisting of token pairs in equal proportions (for example, TON/USDT). Cryptocurrency owners become liquidity providers when they deposit assets into specific pools. Liquidity pools enable other users to trade with the provided assets.

To provide liquidity, the coin owner receives special tokens called Liquidity Provider (LP) tokens. LP tokens represent the user's share in the pool. The liquidity provider earns income in the form of fees for each transaction made in the pool they participate in. These fees are paid as a reward for providing liquidity: the higher the provider's share in the pool, the greater the rewards they receive.

Rewards

The rewards from farming can be withdrawn after a certain period or upon reaching a specific threshold. The withdrawal of rewards may also depend on the cryptocurrency or token used in farming and the conditions set for a particular pool.

The income level in farming is measured in APY (Annual Percentage Yield) — the percentage return on investment per year. APY takes into account not only the base interest rate but also the frequency of interest accrual and its compounding.

The formula for calculating APY:

𝐴𝑃𝑌 = ( 1 + 𝑟 /𝑛 )𝑛 − 1

Where:

  • r is the annual interest rate (in decimal form, for example, if the interest rate is 5%, then 𝑟 = 0.05);
  • n is the number of compounding periods per year.

Example:

Let's consider an example with a 10% interest rate with daily compounding (i.e., 𝑛 = 365).

𝐴𝑃𝑌 = ( 1 + 0.10365 )365 − 1

𝐴𝑃𝑌 = ( 1 + 0.0002739726 )365 − 1

𝐴𝑃𝑌 ≈ 0.1047

Thus, in this example, the APY is approximately 10.47%.

Risks

Farming can entail risks of fund loss due to theft or platform vulnerabilities. It is also important to consider the risks of impermanent loss — resulting from changes in the value of tokens involved in the liquidity pool.

For example, a user deposits 1 token A and 100 tokens B into a pool, where at the time of deposit, 1 A equals 100 B (and 1 B equals 1 USD). As the pool now holds a total of 10 A and 1000 B, the deposit comprises 10% of the pool's total value. Later, the value of A increases by 4 times, and the token is now worth 400 B. Meanwhile, the price of token B remains unchanged. To rebalance the token ratio according to the new prices, arbitrage traders will add more tokens B to the liquidity pool and remove tokens A, resulting in a new ratio of 5 A to 2000 B. If the user decides to withdraw their funds at this point, they will receive 0.5 A and 200 B (10% of the pool's total value).

Since now 1 A = 400 B = 400 USD (as the value of A has increased while B has not), the user will withdraw from the pool an amount equal to:

0,5 * 400 + 200 * 1 = 400 USD.

However, if the user had simply held the tokens in their wallet, the initial 200 USD would have grown by 300 dollars:

1 * 400 + 100 * 1= 500 USD.

Thus, the difference of 100 USD would be considered an impermanent loss. However, if the value of token A were to return to its initial state (at the time of deposit into the pool), then there would be no impermanent loss.

The approximate size of impermanent loss looks like this (for a more precise calculation of losses, you can use a calculator):

Change in price by 1.25x = loss of 0.6%

Change in price by 1.5x = loss of 2%

Change in price by 1.75x = loss of 3.8%

Change in price by 2x = loss of 5.7%

Change in price by 3x = loss of 13.4%

Change in price by 4x = loss of 20%

Change in price by 5x = loss of 25.5%

Therefore, before participating in farming, it is essential to carefully study the projects and assess the risks.

The difference between farming and staking

In staking, the token is not used in a liquidity pool but remains in a smart contract. Typically, staking guarantees the user a certain income at a lower rate compared to farming. Additionally, in staking, the user sends only one type of cryptocurrency at a time.

Farming in TON

In the TON ecosystem, farming is actively developing and supported by the community and the TON Foundation. As of May 2024, users can farm on DEX exchanges such as STON.fi and DeDust.

An example of sending tokens to farming on STON.fi:

  1. After connecting your wallet to the exchange, navigate to the 'Pools' tab — there, switch the toggle to "Farming available".
    Farming Pools on STON.fi
    Farming Pools on STON.fi
  2. If liquidity has not been provided yet (and LP tokens have not been received), you will need to click on "Add Liquidity" and deposit a token pair into the pool.
    Farming Pool TON/USDT on STON.fi
    Farming Pool TON/USDT on STON.fi
  3. Once the liquidity is provided, its volume will be displayed on the indicator. The "Farm" button will appear on the pool page.
  4. After clicking the "Farm" button, the pop-up window will indicate how many LP tokens can be sent to farming: you can manually decrease their quantity or leave it at maximum.
  5. Then, all that's left is to confirm the transaction in your wallet.

After sending tokens to farming, information about rewards and timelines will be available on the pool page. The duration after which tokens can be withdrawn depends on the specific farm.

Links

  1. What is yield farming on Coinmarketcap.com
  2. Liquidity farming on STON.fi
  3. What is farming on STON.fi
  4. What is liquidity pool on STON.fi
  5. Cryptocurrency farming on Ultima.io
  6. What is cryptocurrency farming on cryptonews.com
  7. Impermanent loss on STON.fi
  8. How to farm on STON.fi