Constant Product
We start by defining a simple constant product market, commonly used to trade tokens.
The market is composed of two reserves (R0​,R1​) of token0 and token1 respectively, and a constraint:
(R0​+x)⋅(R1​−y)=R0​⋅R1​ 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=R1​−R0​+xR0​⋅R1​​ From this, we can derive the market trading function κ:(R0​,R1​,x)−>(R0​′,R1​′):
R0​′=R0​+x R1​′=R0​+xR0​⋅R1​​ that describes market dynamics when traded.
KIRU Bonding Curve
We instantiate token0= ETH and token1= KIRU.
We introduce a scale parameter α:[0,1]
α(t)=1−(α(0)∗R1​(0)R1​(t)​) The parameter decrease in intensity as KIRU reserves deplete to ensure gradual smoothing of the scaling effect.
We can then introduce the trading function Γ+:(R0​,R1​,α,x)−>(R0​′,R1​′) for buy orders, defined as:
(αR0​′,αR1​′)=κ(α⋅R0​,α⋅R1​,x) R0​′=R0​+x R1​′=αR0​′αR1​′​⋅R0​′ The new KIRU reserve is computed using the virtual reserves ratio, and used to compute the amount out y:
y=R1​−αR1​′ 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=R0​/R1​ Applying it to the trading functions.
For κ:
spotκ=R0​⋅R1​(R0​+x)2​ and Γ:
spotΓ=α2R0​⋅R1​(αR0​+x)2​ To study price action between trading functions, we simplify spotκspotΓ​:
(αR0​+αxαR0​+x​)2 Expressing the difference of the two terms in terms of x and α:
Numerator−Denominator​=(αR0​+x)−(αR0​+αx)=x−αx=x(1−α)​ We notice that the difference increases as α decreases from 1 to 0.
Denominator−Numerator​=(αR0​+αx)−(αR0​+x)=αx−x=x(α−1)​ Since x>0 and α≤1, the ratio is always positive, proving that over equal volume, Γ+ implies a greater price increase than the classical constant-product, scaled by α.