# Rewards Distribution

Every day, a new prize pool is created. Prize pools are capitalized based on the platform activity, and topped up with community incentives. Users earn experience points (XP) when completing taks. At the end of each period (day) users are ranked based on their XP gains. The prize pool is then distributed to users according to [these rules](/ta-da-platform/user-rewards/prize-pools.md). The remainder of this page outlines the main steps involved in calculating the rewards distributed to users.

## Parameters

* $$to\_distribute$$: The amount of money to be distributed
* $$percent\_to\_win$$: The percentage of winning users
* $$decay\_factor$$: The exponential decay factor

## Invariants

* A task completed by a user of rank 𝑥 should be better rewarded than a task completed by a user of rank 𝑥 + 1.

## Algorithm

* Get the users selected to win the prize pool $$winners=users\_number \* percent\_to\_win$$.
* For each user $$i$$, compute his exponential factor $$factor\_i=factor(len(winners), decay\_factor, i)$$.
* For each user $$i$$, compute his score $$score\_i=factor\_i\*nb\_{tasks\_i}$$.
* Compute the sum of the scores $$sum\_{score}=\Sigma score\_i$$.
* For each user $$i$$, compute his score ratio $$ratio\_i=score\_i/sum\_{score}$$.
* For each user $$i$$, compute his rewards $$reward\_i=ratio\_i\*to\_distribute$$.

## TADA vs Gems

The distribution of TADA and Gems uses exactly the same algorithm. \
However, the quantity of Gems distributed and the number of winners are much higher.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ta-da.io/token/economy/rewards-distribution.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
