The Carbon DeFi versus Uniswap V3 Invariant Functions
Last updated
Last updated
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.
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) terms:
𝒂
▪ Defined as the difference between the square roots of the marginal exchange rates at the 𝑦-intercept, and the 𝑥-intercept.
▪
𝒃
▪ Defined as the square root of the marginal exchange rate at the 𝑥- intercept, only.
▪
𝒛
▪ Defined as the value of the 𝑦-intercept.
▪
The Carbon DeFi invariant function can be written as:
Which has the same structure as the familiar Uniswap V3 invariant function, as written in its whitepaper:
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.
For further assistance, please join the Bancor Developer telegram group