English Vesting Guide for TON Swap
The purpose of this article is to briefly introduce the concept of vesting, which was added to the TON Swap protocol on 9/3/21, and to explain how it operates.
What is Vesting?
First, you need to understand what vesting is and what it is used for.
Vesting is a market surplus management tool that has been created as a result of increased TVL and farming speed. The essence of vesting lies in its capability to reduce presure on the price of an asset and shift priority to the side of long-term investors.
After the addition of vesting, several new parameters were added to all farming pools, namely: Vesting ratio and Vesting period, as well as three new designations related to user data: Entitled, Unclaimed and Reward debt.
Let’s take a closer look at each of these concepts.
Vesting ratio refers to the percentage of remuneration that will be sent to vesting, and the Vesting period is the time frame in which it will be sent.
Reward debt is a parameter used on those rare occasions when there is not enough money in the pool to reward users for their liquidity contributions. In this case, the tokens that should have been received during the claiming period will be written into the pool’s debt, and the next time you claim a reward you will receive them along with a new farm reward (provided the required amount of reward tokens appears in the pool during this time).
As before, the number of tokens farmed depends on the farm speed and your percentage of the total number of LP tokens. In this regard, everything on the DEX has remained unchanged. However, the farmed reward is now locked in vesting first. The Entitled reward parameter indicates the number of tokens under vesting. Then the tokens are gradually unlocked and become available for receipt. The number of these tokens can be seen in the Unclaimed reward column, and you can withdraw them using the Claim button.
The process of unlocking a reward (Unclaimed reward), locked in Vesting (Entitled reward), begins immediately after its receipt and ends within 120 days, if the Vesting period is set to 120 days.
For example, if the Vesting ratio is 100%, and the Vesting period is 120 days, this means that 50% of all tokens farmed during this time will be sent to you within 110 days and will be displayed in the Unclaimed reward, and the rest will be sent to you within the next 130 days. Rewards that are not yet available and will be unlocked within these 120 days are displayed in the Entitled reward section. Let’s take a look below at why this is the case.
Simply put, every day 1/120 of your rewards sent to your Entitled reward balance go to your Unclaimed reward balance. Accordingly, every second 1 / (60 * 60 * 24 * 120) is unlocked from your Entitled reward. Importantly, the share of unlocked funds is calculated from the current balance of your Entitled Reward while your LP tokens are in farming, but as soon as you withdraw them from farming, the remaining balance of your Entitled reward is unlocked in equal shares every second. To summarize, your entire Entitled reward balance will be transferred to your Unclaimed reward balance in equal shares within 120 days from the moment LP tokens are withdrawn from farming.
Note that Vesting before (the point at which the entire entitled amount will be available for unlocking) will constantly change until you withdraw funds from the farming pool. This happens because the reward received every second (and this is how the TON Swap farming pools work) is instantly locked and sent to your Entitled reward address, for subsequent uniform unlocking over the next 120 days.
When you cease to farm (by withdrawing LP tokens from the farming pool), the locked reward (Entitled reward) will continue to be evenly unlocked and transferred to your Unclaimed reward balance within 120 days, but Entitled will not receive new rewards.
Example 1: your LP tokens are in a farming pool and you get 1 WTON per second. Then your total reward in the 1st second is 1 WTON, in the 2nd second 2 WTON and in the 3rd 3 WTON.
Accordingly, your Unclaimed balance, which is unlocked, in the 2nd second is equal to:
and the total Unclaimed, after the 4th second, is (1) + (2) + (3)
Let’s say you took your LP tokens out of the farming pool, and at that time you had an Entitled reward of 10 WTON. Since you have withdrawn funds, your Entitled reward total will no longer be replenished, which means that every second you will receive 10 / (60 * 60 * 24 * 120) WTON and receive the remaining reward evenly over 120 days.
Here is an indicative graph:
This is a vesting chart with a Vesting ratio of 100% and a Vesting period of 120. The chart shows a situation in which farming occurs for 120 days, then after 120 days, LP tokens are withdrawn, and the tokens earned in Entitled reward will continue to be unlocked and transferred to Unclaimed reward.
At any given time, we have 2 parameters:
1. Entitled reward — accumulated locked reward
2. Unclaimed reward — accumulated unlocked reward
To calculate Unclaimed, we need several parameters:
- now: current time
- lCT: last claim time
- vP: vesting period
- pVI: partly vested interval
- fVI: full vested interval
Depending on how much time has passed since the last claim, we have 2 cases: one when more of the vesting period has passed and one when less of the period has passed.
If less has passed, calculations must be made using F1.
If more has passed, you need to calculate the required value using the F2 system, in fact, simply cutting off a part of the amount that was completely unlocked, and for the remaining amount, we use the function from F1.
Claim and Withdraw
As you may have noticed, now there are several ways to withdraw funds from the pool. Let’s introduce specifics:
The Claim button displays rewards without withdrawing LP tokens.
The Withdraw button withdraws from the pool both a user’s reward in tokens and all LP tokens invested in the farming pool.
Still have questions? Check out our Broxus chat on Telegram and we will do our best to help you. There you can also chat with the friendly FreeTon community, who will be happy to answer your questions.