# Bonding Curve Math

We apply a constant product formula like

$$
y = k \cdot x
$$

but with virtual ETH and virtual tokens. This is done because a constant product formula doesn't work when one reserve is 0. And as the bonding curve starts with 0 ETH (and can also finish with 0) we needed to add some virtual reserves to it. This means that the actual formula to calculate how many tokens we receive for how many ETH is following:

$$
T = \frac{T\_v \cdot E}{E\_v + E}
$$

where  *T* are the Tokens we receive, ( T\_v ) are the virtual Tokens, ( E\_v ) the virtual ETH, and *E* the actual input ETH (after fee deduction).

Similarily for a sell you update the forumula simply to:

$$
E = \frac{E\_v \cdot T}{T\_v + T}
$$

In our case we start with a virtual supply of 1,073,000,000 tokens and 30 virtual ETH. The ETH and virtual ETH are multiplied with following numbers:

```remix-solidity
            (priceETH < 3450):
            E_mul0 = 49044814340589;
            E_mul1 = 4000000000000;
            
            (priceETH >= 3450) && (priceETH < 6900):
            E_mul0 = 1259469696969697;
            E_mul1 = 62500000000000;
            
            else:
            E_mul0 = 8060606060606061;
            E_mul1 = 200000000000000;
```

as&#x20;

$$
E\_{mul} = \frac{E \cdot E\_{mul0}}{E\_{mul1}}
$$


---

# 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://lfg-club.gitbook.io/lfgclub/bonding-curve/bonding-curve-math.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.
