Math of BrownFi AMM: boosting Capital Efficiency

BrownFi AMM fills the gap between Uniswap V2 and V3, offering a high CE like Uniswap V3 with simple UX for retail LPs like Uniswap V2. This post presents math fundamentals and simulations of BrownFi AMM, showing it capital efficiency as high as Uniswap V3 and 100X better Uniswap V2.

The Math behind BrownFi AMM

For all spot exchanges, price discovery mechanism is the core function. Uniswap invented CPMM model x×y=k x\times y=k, making it the most popular and widely used pricing mechanism among AMMs. BrownFi AMM employs an elastic Parameterization of Limit Order-Book (PLOB) from a published research papers on IEEE Access to construct a novel pricing mechanism associated with a rectangle liquidity distribution.

  • Given a pair of tokens X and Y, where X is base token (e.g. ETH) and Y is quote token (e.g. USD), with corresponding token reserve (x,y)(x, y).

  • For any trade, e.g. an amount-OUT dxdx of token X (dx<x)(dx<x), we compute price impact R=K×dxxdx=K×δx1δxR= \frac{\Kappa \times dx}{x-dx}=\frac{\Kappa\times\delta x}{1-\delta x} which is directly proportional to the relative order size δx=dx/x\delta x=dx/x (rectangle-shape liquidity distribution) or δx=dx/x\delta x=\sqrt{dx/x} (V-shape liquidity distribution). Liquidity concentration parameter Kappa K(0<K2)\Kappa \quad (0<\Kappa\leq 2) offers low (or high) slippage if it is small (or large), respectively.

  • We compute the average trading price Pt=P0(1+αR)P_t = P_0(1 + \alpha R), where P0P_0 the current market price (possibly fed by external or internal oracle), and a reversal coefficientα=1/2\alpha = 1/2.

  • Finally, we compute the amount-IN dy=dx×Ptdy=dx\times P_t based on the amount-OUT and the computed average trading price, then execute swaption. Moreover, we update the new pool-internal price (if needed) as Pnew=P0(1+R)P_{new} = P_0(1 + R).

Mathematically, for K=2\Kappa=2, our elastic PLOB model is proven to be equivalent to Uniswap CPMM model x×y=k x\times y=k, hence Uniswap V2 is a special case of BrownFi's elastic PLOB model. When order size dxdx is large or close to the reserve xx, price impact (so is trading price) will be large or super-large (tending to infinity), formally, limdxxR(dx)=\lim_{dx \to x} R(dx)=\infty. This makes BrownFi elastic similar to Uniswap V2 (however, BrownFi doesn’t possess path-independence like the CPMM model), hence the liquidity is unbounded. Elasticity and simplicity of BrownFi mathematical model make it resilient to market volatility and simple retail LPs like Uniswap V2 while offering high capital efficiency like Uniswap V3.

Liquidity distribution transformed to LOB: BrownFi (concentrated) vs Uniswap V2 (infinitely spreaded)
Liquidity distribution transformed to LOB: BrownFi (concentrated) vs Uniswap V2 (infinitely spreaded)

Simulation

To compare capital efficiency between Uniswap V2, V3 and BrownFi AMM, the idea is simple: regarding the same trade and slippage, which AMM optimally requiring less capital is more efficient. Without loss of generality, we give simple conventions:

  • Consider the pair (ABC,USDT), price 1 ABC = PP USDT, taking P=1P=1.

  • Trade order: buying dx=10dx=10 ABC, and paying dydy USDT. Trading fee is zero.

  • Slippage 1%. This means the actual trading price is Pt=1.01P_t=1.01, higher 1% than the current price, hence the actual pay dy=(10P+0.1P)=10.1dy=(10P+0.1P)=10.1 USDT.

Now, we are going to find how much capital is needed by Uniswap V2 pool (x,y)(x,y) vs Uniswap V3 pool vs BrownFi AMM pool (x,y)(x',y').

Uniswap V2

The CPMM model gives (x10)(y+10.1P)=xy(x-10)(y+10.1P)=xy. Because P=y/x=1P=y/x=1, we have x=yx=y and (x10)(x10.1)=x2(x-10)(x-10.1)=x^2, hence x=1010x=1010. The Uniswap V2 pool capital is (1010, 1010).

Uniswap V3

The concentrated liquidity formula of Uniswap V3 allows us to find a curve limited by a price range such that it can serve the trade with optimal capital, reading (x+LpB)(y+Lpa)=L2(x'+\frac{L}{\sqrt{p_B}})(y'+L\sqrt{p_a})=L^2, where L=xy,L2=xyL=\sqrt{xy}, L^2=xy.

Choosing a narrow price range [pa,pb][p_a,p_b] where pa=1.00012000.9802,pb=1.0001200=1.0202p_a=1.0001^{-200}\approx 0.9802, p_b= 1.0001^{200}= 1.0202 (volatility ±2%\pm 2\% around the market price), and we replace P=1,x=y=1010,pa=1/pbP=1, x=y=1010, \sqrt{p_a}=1/\sqrt{p_b} and x=yx'=y' to obtain: (x+10101.0001100)2=10102x10.05(x'+\frac{1010}{1.0001^{100}})^{2}=1010^2 \Leftrightarrow x \approx 10.05The Uniswap V3 bin capital is (10.05, 10.05), satisfying buying amount.

BrownFi AMM

Regarding the conventions of amount-OUT dx=10dx=10 ABC and amount-IN dy=10.1dy=10.1 USDT, we consider three liquidity compression/concentration K=2,K=1K=2, K=1 and K=0.001K=0.001.

Liquidity concentration K=1

  • dy=dx×PtPt=10.1/10=1.01dy=dx \times P_t \Rightarrow P_t=10.1/10=1.01

  • Pt=1+R/2R=0.02P_t=1+R/2 \Rightarrow R = 0.02

  • R=K×dxxdx10x10=0.02x=510R=\frac{K\times dx}{x-dx} \Leftrightarrow \frac{10}{x-10}=0.02 \Leftrightarrow x = 510

The BrownFi pool capital is (510, 510).

Liquidity concentration K=0.01

  • R=0.02R = 0.02

  • R=K×dxxdx0.1x10=0.02x=15R=\frac{K\times dx}{x-dx} \Leftrightarrow \frac{0.1}{x-10}=0.02 \Leftrightarrow x = 15

The BrownFi pool capital is (15, 15).

Liquidity concentration K=0.001

  • R=0.02R = 0.02

  • R=K×dxxdx0.01x10=0.02x=10.5R=\frac{K\times dx}{x-dx} \Leftrightarrow \frac{0.01}{x-10}=0.02 \Leftrightarrow x = 10.5

The BrownFi pool capital is (10.5, 10.5).

Comparing capital efficiency

For any price, to compare the capital between the two pools, we compute the ratio of their capital amounts. For the given trade, we summarize the capital amounts of the computed pools:

  • Uniswap V2 pool (1010, 1010) = 2020

  • Uniswap V3 bin (10.05, 10.05) = 20.1

  • BrownFi K=0.001K=0.001 pool (10.5, 10.5) = 21

  • BrownFi K=0.01K=0.01 pool (15, 15) = 30

  • BrownFi K=1K=1 pool (510, 510) = 1020

Capital efficiency comparison between BrownFi vs Uniswap V2, V3
Capital efficiency comparison between BrownFi vs Uniswap V2, V3

Conclusion

We conclude with some advantages of BrownFi AMM.

  • BrownFi (K=0.001)(K=0.001) is as capital-efficient as Uniswap V3 (range ±2% \pm 2\%) and 100X better than Uniswap V2.

  • BrownFi AMM always concentrates liquidity around market price, hence LPs always get trading fee (LPs on Uniswap V3 suffer out-of-price-range). On the other side, thank to price impact, our AMM is still elastic to large orders, thus, offers unbounded liquidity (i.e. traders cannot draw out token reserve).

  • BrownFi AMM offers simple UX for retail LPs like Uniswap V2. Furthermore, LPs can adjust their liquidity concentration parameter KK according to their prediction on market volatility, no need to specify price range, so more flexible than Uniswap V3 and V2.

Two limitations those BrownFi AMM requires oracle price-feeding to operate smoothly against malicious price manipulation/arbitrage, and our model is not path-independent. Overall, BrownFi AMM fills the gap between Uniswap V2 and V3, offering a complementary solution to unlock high capital efficiency with flexible market making strategies and simplicity. Imagine that $1M liquidity on BrownFi AMM is equivalent to $100M liquidity on Uniswap V2. Thus, BrownFi AMM fits liquidity-boosting demand of new ecosystems and new tokens with very limited capital.

Readers refer to a conceptual introduction of BrownFi.

Contact us

Website, Twitter, Telegram

Subscribe to BrownFi AMM
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.