# The Carbon DeFi versus Uniswap V3 Invariant Functions

Carbon DeFi makes use of the same geometric price sequences that have governed AMM behavior since its first realization in 2017. While Carbon DeFi is not an AMM, the majority of the underlying theory is indistinguishable from that of conventional “concentrated liquidity” AMM designs. However, rather than let the price curves be determined by one and the same invariant curve (which, traditionally described two different token balances), instead, each token balance is given its own implicit curve (i.e. one “bonding curve” per token). This allows for arbitrary separation of bidding and asking prices characterized by irreversible token swaps, from which emerges a trading “strategy” – the core object of Carbon DeFi.

### Naming Conventions and Nomenclature

The implicit curves of the invariant function used by Carbon Defi adhere to the following conventions:

* Assume the implicit curves are drawn on a Cartesian plane.
* The available token balance is always depicted on the y axis, whereas the x axis does ***not*** refer to a token balance.
* Therefore, during a token swap, the tokens sent from the swapper to the contract is always Δx, and the tokens sent from the contract to the swapper is always Δy.
* The marginal price quote, -∂y/∂x, refers to the rate of y tokens purchased during a swap relative to the x tokens sold by the swapper; therefore large -∂y/∂x values represent a higher valuation of the x token relative to the y token and small -∂y/∂x values represent a lower valuation of the x token relative to the y token.
* Carbon DeFi’s “liquidity providers” choose two separate price quotes or price quote ranges: one supports trades of TKN1 → TKN2, and the other supports trades TKN2 → TKN1. Since both tokens are featured independently on their own y axis, and owing to the swap conventions described above, both price quotes are expressed in the form - ∂y/∂x.
* Each token’s implicit real curve is parametrized by three (3) constant[^1] terms:
  1. 𝒂

     ▪ Defined as the **difference between the square roots of the marginal exchange rates** at the 𝑦-intercept, and the 𝑥-intercept.&#x20;

     ▪ $$\normalsize 𝑎 = \sqrt{𝑃\_{high}} − \sqrt{𝑃\_{low}} = \left( -\frac{𝜕𝑦}{𝜕𝑥}|*{𝑥=0}\right)^\frac{1}{2} − \left(− \frac{𝜕𝑦}{𝜕𝑥}|*{𝑦=0}\right)^\frac{1}{2}$$
  2. 𝒃&#x20;

     ▪ Defined as the **square root of the marginal exchange rate** at the 𝑥- intercept, only.&#x20;

     ▪ $$\normalsize b = \sqrt{𝑃\_{low}} = \left( -\frac{𝜕𝑦}{𝜕𝑥}|\_{y=0}\right)^\frac{1}{2}$$
  3. 𝒛&#x20;

     ▪ Defined as the value of the 𝑦-intercept.&#x20;

     ▪ $$\normalsize 𝑧 = y|\_{x=0}$$

### The Carbon DeFi versus Uniswap V3 Invariant Functions

The Carbon DeFi invariant function can be written as:

$$
\Large \left(x + \textcolor{#ffa2a1}{ \frac{z}{a \cdot (a+b)}}\right) \cdot \left( y + \textcolor{#dc70fa}{  \frac{z \cdot b}{a}}\right) = \textcolor{#90f597}{\frac{z^2}{a^2}}
$$

Which has the same structure as the familiar Uniswap V3 invariant function, as written in its whitepaper:

$$
\Large \left( x + \textcolor{#ffa2a1}{\frac{L}{\sqrt{P\_{high}}}}\right) \cdot \left( y + \textcolor{#dc70fa}{L \cdot \sqrt{P\_{low}}}\right) = \textcolor{#90f597}{L^2}
$$

Both Carbon DeFi’s and Uniswap V3’s invariant functions refer to the same underlying mathematical and geometric objects, and the terms highlighted above are equivalent to each other.

$$
\Large \textcolor{#ffa2a1}{\frac{z}{a \cdot (a+b)}} = \textcolor{#ffa2a1}{\frac{L}{\sqrt{P\_{high}}}}
$$

$$
\Large \textcolor{#dc70fa}{\frac{z \cdot b}{a}} = \textcolor{#dc70fa}{L \cdot \sqrt{P\_{low}}}
$$

$$
\Large \textcolor{#90f597}{\frac{z^2}{a^2}} = \textcolor{#90f597}{L^2}
$$

{% hint style="info" %}
For further assistance, please join the [Bancor Developer telegram](https://t.me/BancorDevelopers) group
{% endhint %}

[^1]: The 𝑍 parameter is always constant on a curve being traded upon; however, the 𝑍 parameter on its counterpart curve (the

    spectator) may be increased.


---

# 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.carbondefi.xyz/developer-guides/the-carbon-defi-versus-uniswap-v3-invariant-functions.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.
