> For the complete documentation index, see [llms.txt](https://tidal-flats.gitbook.io/tidal-flats-whitepaper-en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tidal-flats.gitbook.io/tidal-flats-whitepaper-en/whitepaper/black-market-2-road-to-fidelia/procurement/atd-automated-token-distributor.md).

# ATD (Automated Token Distributor)

## Overview

The Automated Token Distributor (ATD) is a core component of VALOR's token distribution strategy. This document explains the ATD’s budget distribution mechanisms.

{% hint style="info" %}
The below models can be updated due to the balance update
{% endhint %}

## 1. Budget Distribution

ATD’s budget distribution framework employs a probabilistic approach based on a standard normal distribution to allocate resources effectively across various tokens and market segments.

### Key Definitions and Variables

* **Normal Distribution (PDF)**: A probability distribution function used to allocate budgets fairly, with a mean of 0 and a standard deviation of 1.
* **Budget Allocation Ratios**: Ratios are derived from the PDF to determine the portion of the total budget allocated to each token.
* **Total Budget**: It is set at 110% of the inflow over 12 hours. It is rounded down to 9 decimal places, and the remainder is discarded.

### Process Explanation

1. **Total Budget Calculation**:
   1. Case 1 (Accumulated Inflow < Accumulated Outflow):
      * The total budget is set at 110% of the inflow over the past 12 hours plus any carried-over budget&#x20;

        $$
        B\_{total} = \left\lfloor (1.1 \times Inflow) \times 10^9 \right\rfloor / 10^9
        $$

        * Here, $$Inflow$$ is the inflow over the past 12 hours.
   2. Case 2 (Accumulated Inflow > Accumulated Outflow):
      * The total budget is set at sum of each sSPL supply and ideal price.

        $$
        B\_{total} = \sum S \times P\_{idl}
        $$
      * Maximum budget = (Accumulated Inflow - Accumulated Outflow) \* 1.1

2. **Random Factor Generation**:
   * Generate a random number within the range of \[-0.5, 0.5] from a normal distribution with a mean of 0 and a standard deviation of 1. This controls the variability in budget allocation.
   * Calculate the probability density $$p(x\_i)$$ for each random factor $$x\_i$$. This density influences how the budget is divided. The probability density function is:

     $$
     p(x\_i) = \frac{1}{\sqrt{2\pi}} e^{-\frac{x\_i^2}{2}}
     $$

3. **Budget Allocation**:
   * Convert these densities into budget allocation ratios:

     $$
     R\_i = \frac{p(x\_i)}{\sum\_{j=1}^{9} p(x\_j)}
     $$
   * Allocate the total budget to various tokens using these ratios:

     $$
     B\_i = \left\lfloor R\_i \times B\_{total} \times 10^9 \right\rfloor / 10^9
     $$

## 2. Price Setting

The ATD's price-setting mechanism dynamically adjusts token prices around an ideal price to reflect market values.

### Key Definitions and Variables

* **Ideal Price (**$$P\_{idl}$$**)**: The target price for the tokens.
* **Reference Price (**$$P\_{ref}$$**)**: The market price of the token in Black Market.
* **Next Price (**$$P\_{nxt}$$**)**: The price of the token after adjustment.
* **Standard Deviation (**$$\sigma$$**)**: Controls the spread of price values around $$P\_{idl}$$.

{% hint style="success" %}
These variables will be initialized on the procurement creation
{% endhint %}

### Standard Deviation Calculation

The standard deviation $$\sigma$$ is calculated as:

$$
\sigma = \sqrt{\frac{P\_{idl}^2}{2 \ln(10)}}
$$

This calculation determines the range of price fluctuations around the ideal price $$P\_{idl}$$, adjusting for market volatility.

### Price Determination Model

#### Random Price Determination Model

This model dynamically calculates the next token price using a probability distribution function centered on $$P\_{idl}$$.

**Detailed Process**

1. **Define Price Range**:
   * Establish the effective price range for the next pricing cycle:

     $$
     \text{Effective Price Range} = \[P\_{ref} \times 0.9, P\_{ref} \times 1.4]
     $$
2. **Generate PDF**:
   * Create a normal distribution centered on $$P\_{idl}$$ with the calculated $$\sigma$$.
3. **Calculate Area Under Curve**:
   * Determine the total probability area under the PDF within the defined range:

     $$
     A = \int\_{P\_{ref} \times 0.9}^{P\_{ref} \times 1.4} f(x) , dx
     $$
4. **Generate Random Factor and Set Next Price**:
   * Select a random value within the range \[0, A], and determine the corresponding price using the inverse cumulative distribution function (CDF):

     $$
     P\_{nxt} = f^{-1}(r)
     $$
   * Here, $$f^{-1}$$ is the inverse function of the CDF, accurately determining the price corresponding to the random value $$r$$.
5. **Final Quantity Adjustment**:

   * Calculate the maximum quantity that can be purchased with the allocated budget:

     $$
     Q\_i = \left\lfloor \frac{B\_i}{P\_{nxt}} \right\rfloor
     $$
   * Round down to ensure accurate quantity calculation. (If $$Q\_i < 1$$, set $$Q\_i$$ to 1)
   * Adjust the final price using the actual quantity purchased:

     $$
     P\_{final} = \left\lfloor \frac{B\_i}{Q\_i} \times 10^3 \right\rfloor / 10^3
     $$
   * The final price $$P\_{final}$$ is rounded down to 3 decimal places.

   $$
   B\_i^\text{new} = B\_i - (Q\_i \times P\_{final})
   $$

## Data

| Token                   | Ideal Price ($VALOR) |
| ----------------------- | -------------------- |
| Voodoo Doll ($VD)       | 5.5515               |
| Gold Teeth ($GT)        | 6.8204               |
| JB Whiskey ($JBW)       | 10.3219              |
| Canteen ($CT)           | 11.2677              |
| G Badge ($GB)           | 13.2835              |
| Holy Water ($HW)        | 21.7118              |
| Used Engine ($UE)       | 35.9697              |
| Enhanced Bullet ($EB)   | 57.8595              |
| Oil Lighter Case ($OLC) | 72.0052              |

## Examples

### PDF and simulation when the ideal price is 2.28

<figure><img src="/files/LjBT1hC4tNXM6nogi2j9" alt=""><figcaption></figcaption></figure>

<div><figure><img src="/files/f7sTq1GKwgfZyqm1q3Q0" alt=""><figcaption></figcaption></figure> <figure><img src="/files/wJHqlerf9MqOC6azk2Qo" alt=""><figcaption></figcaption></figure> <figure><img src="/files/AdVdp8fI92O7e6CnkCaL" alt=""><figcaption></figcaption></figure></div>

### PDF and simulation when the ideal price is 50.4

<figure><img src="/files/5PNNVgbuWGJNkPTk1dhp" alt=""><figcaption></figcaption></figure>

<div><figure><img src="/files/kI5Z10dtw3xjSlrIoJx7" alt=""><figcaption></figcaption></figure> <figure><img src="/files/RCyxEvZwKQaN0adV0RwK" alt=""><figcaption></figcaption></figure> <figure><img src="/files/D03oqzfholSCZNknyzLJ" alt=""><figcaption></figcaption></figure></div>
