# Deep Dive

### Constant Product

We start by defining a simple constant product market, commonly used to trade tokens.\
\
The market is composed of two reserves  $$(R\_0, R\_1)$$ of $$token0$$ and $$token1$$ respectively, and a constraint:

$$
(R\_0 + x) \cdot (R\_1 - y) = R\_0 ⋅ R\_1
$$

When $$x$$ amount of $$token0$$ is inputted to the market, $$y$$ $$token1$$ comes out, constrained by the product of the reserves.

solving for y gives us the amount out:

$$
y = R\_1 - \frac{R\_0 \cdot R\_1}{R\_0 + x}
$$

From this, we can derive the market trading function $$\kappa : (R\_0, R\_1, x) -> (R\_0′, R\_1′)$$:

$$
R\_0′ = R\_0 + x
$$

$$
R\_1′ = \frac{R\_0 \cdot R\_1}{R\_0 + x}
$$

that describes market dynamics when traded.&#x20;

### KIRU Bonding Curve

*We instantiate* $$token0 =$$ *ETH and* $$token1 =$$ *KIRU.*

We introduce a scale parameter $$α: \[0, 1]$$

$$
α(t) = 1 - (α(0) \* \frac{R\_1(t)}{R\_1(0)})
$$

The parameter decrease in intensity as KIRU reserves deplete to ensure gradual smoothing of the scaling effect.

We can then introduce the trading function $$Γ^+ : (R\_0, R\_1, α, x) -> (R\_0′, R\_1′)$$ for buy orders, defined as:

$$
(αR\_0′, αR\_1′) = \kappa(α \cdot R\_0, α \cdot R\_1, x)
$$

$$
R\_0′ = R\_0 + x
$$

$$
R\_1′ = \frac{αR\_1′}{αR\_0′} ⋅ R\_0′
$$

The new KIRU reserve is computed using the virtual reserves ratio, and used to compute the amount out $$y$$:

$$
y = R\_1 - \alpha R\_1\prime
$$

The excess KIRU coming from the difference between the virtual effective price and the effective price is then burned.

The transition function for sell orders stay the same, enjoying full liquidity when exiting.

### Spot price

We introduce the spot price formula:

$$
spot = R\_0 / R\_1
$$

Applying it to the trading functions.

For $$\kappa$$:

$$
spot^\kappa = \dfrac{ (R\_0 + x)^2 }{ R\_0 \cdot R\_1 }
$$

and $$\Gamma$$:

$$
spot^\Gamma = \dfrac{ ( \alpha R\_0 + x )^2 }{ \alpha^2 R\_0 \cdot R\_1}
$$

To study price action between trading functions, we simplify $$\frac{spot\Gamma}{spot\kappa}$$:

$$
\left( \frac{ \alpha R\_0 + x }{ \alpha R\_0 + \alpha x } \right)^2
$$

Expressing the difference of the two terms in terms of $$x$$ and $$\alpha$$:

$$
\begin{align\*}
\text{Numerator} - \text{Denominator}
&= ( \alpha R\_0 + x ) - ( \alpha R\_0 + \alpha x ) \\
&= x - \alpha x \\
&= x ( 1 - \alpha )
\end{align\*}
$$

We notice that the difference **increases** as $$\alpha$$ **decreases** from 1 to 0.

$$
\begin{align\*}
\text{Denominator} - \text{Numerator} &= ( \alpha R\_0 + \alpha x ) - ( \alpha R\_0 + x ) \\
&= \alpha x - x \\
&= x ( \alpha - 1 )
\end{align\*}
$$

Since $$x > 0$$ and $$\alpha \le 1$$, the ratio is always positive, proving that over equal volume, $$\Gamma^+$$ implies a greater price increase than the classical constant-product, scaled by $$\alpha$$.
