Rewards
In addition to trading fees, liquidity providers can earn extra incentives known as Rewards. Rewards can be any supported asset (TON or Jetton) and are distributed proportionally to LPs based on their share of the pool's total liquidity.
The protocol supports multiple simultaneous reward programs for a single pool.
Funding Rewards
Anyone can fund a reward program for a pool, provided the asset is in the pool's allowedRewards list (configured
during pool creation).
Funding is performed via a Payment carrying the reward asset and a FundReward payload.
FundReward Payload
The payload specifies the duration of the distribution by setting an end timestamp (till).
struct (0x2eb87df9) FundReward {
till: uint40
}| Parameter | Description |
|---|---|
till | Unix timestamp indicating when the distribution should end. |
Distribution Logic
- New Distribution: If the reward program is currently inactive, the sent amount is distributed evenly from the
current time until
till. - Top-up: If the program is already active, the new amount is added to the remaining budget. The duration may be
extended by updating
till, but the new distribution rate (rewards per second) cannot be lower than the current one (to prevent dilution attacks).
Example Flow (Funding with Jettons)
Claiming Rewards
Rewards accumulate in the user's Position contract. They are not sent automatically to the user's wallet to save gas. Users must explicitly claim them.
Claim Flow
To claim rewards, a user sends a ClaimReward message to the Pool.
- User sends
ClaimRewardto Pool. - Pool forwards the request to the user's Position via
ClaimPositionReward. - Position calculates the accrued rewards based on the latest rates and sends a
PayoutRewardrequest back to the Pool. - Pool transfers the reward assets to the User.
ClaimReward Message
struct (0x909fdb65) ClaimReward {
queryId: uint64
rewardIndex: uint2
excessesTo: address
}| Parameter | Description |
|---|---|
rewardIndex | The index of the reward program in the pool's allowedRewards list. |
excessesTo | Address to receive remaining gas. |
Reward Calculation
Rewards are distributed using a Reward per Token algorithm, similar to the MasterChef contract in DeFi.
- Global Index (
rewardsPerToken): The Pool tracks the cumulative rewards emitted per 1 unit of liquidity since the beginning. This value increases every time the pool is touched (swaps, deposits, etc.) based on the time elapsed. - User Checkpoint: The Position contract stores a snapshot of the global index (
rewardsPerTokenCheckpoint) from the last time the user interacted with the pool. - Pending Reward:
This ensures that users only earn rewards for the time intervals during which they held liquidity.