> For the complete documentation index, see [llms.txt](https://docs.lotry.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lotry.fun/what-is-this-tech-anyways/math.md).

# Math

Exprmnt0 or LLL (Limited Loss Lotry) employs a **bonding curve** model to dynamically determine the price of its native token based on supply and liquidity conditions. This section outlines the mathematical foundation governing token pricing, trading logic, and tax mechanisms.

***

#### **Key Variables**

| Variable         | Description                                    | Example Value                                  |
| ---------------- | ---------------------------------------------- | ---------------------------------------------- |
| `Virtual Tokens` | Simulated tokens used for curve initialization | 66,666,666.67                                  |
| `Virtual $LOTRY` | Simulated $LOTRY used for curve initialization | 13,333,333,333.33                              |
| `Initial Supply` | Tokens initially deposited in the contract     | 1,000,000,000                                  |
| `Tax`            | Buy and sell transaction tax                   | 11%                                            |
| `$LOTRY`         | This token is deployed through clanker         | 100,000,000,000 is the max supply from clanker |

***

#### **Token Pricing Formula**

The **price of the token** is determined by the ratio of total $LOTRY to total tokens held in the curve:

$$
\text{Token Price} = \frac{(\text{Virtual $LOTRY} + \text{$LOTRY in Contract})}{(\text{Virtual Tokens} + \text{Tokens in Contract})}
$$

***

#### **Market Capitalization**

The **market cap** represents the total circulating token value:

$$
\text{Market Cap} = \text{Token Price} \times (\text{Virtual Tokens} + \text{Tokens in Circulation})
$$

***

#### **Bonding Curve (Constant Product Equation)**

LLL follows a **constant product invariant**, ensuring that the product of total $LOTRY and total tokens remains constant during trades:

$$
(\text{Virtual $LOTRY} + \text{$LOTRY in Contract}) \times (\text{Virtual Tokens} + \text{Tokens in Contract}) = K
$$

Here, ( $K$ ) is the **constant product** that defines the curve’s balance.

***

#### **Buy Transaction**

When a user buys tokens with $LOTRY:

1. A **11% tax** is deducted and sent to the tax pool.
2. The remaining **89% of $LOTRY** contributes to the bonding curve.

$$
\text{$LOTRYtoCurve} = (1 - 0.11) \times \text{$LOTRYreceived}
$$

The number of tokens given to the buyer is computed as:

$$
\text{Tokens Given} = (\text{Virtual Tokens} + \text{Tokens in Contract}) - \frac{K}{(\text{Virtual $LOTRY} + \text{$LOTRY in Contract} + \text{$LOTRYtoCurve})}
$$

***

#### **Sell Transaction**

When a user sells tokens:

1. The system calculates the $LOTRY returned from the curve.
2. A 11\*\*% tax\*\* is applied on the $LOTRY before sending it to the seller.

$$
\text{$LOTRYfromCurve} = (\text{Virtual $LOTRY} + \text{$LOTRY in Contract}) - \frac{K}{(\text{Virtual Tokens} + \text{Tokens in Contract} + \text{TokensToCurve})}
$$

$$
\text{NetLOTRYsent} = (1 - 0.11) \times \text{$LOTRYfromCurve}
$$

The deducted 11% from `NetLotrysend` is routed to the **tax pool**.
