LogoLogo
  • Welcome
  • Getting Started
    • Quickstart
  • Use Cases
    • Multi Token LP
    • Single Pair Stable LP
    • LP Money Market
  • Technicals
    • Multi-Pool High-Level Architecture
    • Multi-Pool Details
      • Closure
      • Value Accounting
      • Vertex
        • Vault Proxy
        • Reserve
      • Risks
    • Single-Pool Architecture
    • Risk Assessment
  • Community
    • šŸŽŖ Welcome to the Troupe
Powered by GitBook
On this page
  • The Value Function
  • Accounting
Export as PDF
  1. Technicals
  2. Multi-Pool Details

Value Accounting

We use value accounting instead of constant product math. It's effectively a bonding curve that ascribes a value to a token based on its current balance, a target balance, and an efficiency factor. Closures maintain a certain amount of value in them which grows on deposits, shrinks on withdraws, and remains constant across swaps.

As a balance deviates from its target balance, the value of the token also deviates to reflect slippage. Excess balance causes the token to be worth less than one unit of value and a deficit of tokens causes the token to be more valuable.

The Value Function

V(x)=(e+2)tāˆ’(e+1)2t2(x+et)V(x) = (e+2) t - \frac{(e+1)^2t^2}{(x + et)}V(x)=(e+2)tāˆ’(x+et)(e+1)2t2​

Given x, which is the balance of the token in question, t (the target balance) and e (the efficiency factor) this gives us the value of the balance. You can see that when x is equal to t, v is also equal to t. That is the equilibrium state in a closure, where all tokens are at the target balance.

We take the derivative of this with respect to x to get the price of v in terms of x.

Pv(x)=dVdx=(e+1)2t2(x+et)2P_v(x) = \frac{dV}{dx} = \frac{(e+1)^2t^2}{(x + et)^2} Pv​(x)=dxdV​=(x+et)2(e+1)2t2​

This has the desirable property of being at 1 when x is at the target, and since we limit x from zero (or near zero) to 2t2t2t, the price has a range of (e+1)2e2\frac{(e+1)^2}{e^2}e2(e+1)2​ to (e+1)2(e+2)2\frac{(e+1)^2}{(e+2)^2}(e+2)2(e+1)2​. For example, if e is 10, then the full range of x would allow for prices to go from $0.84 to $1.21. Therefore the liquidity is effectively concentrated around the price of one and we can adjust the level of concentration simply by updating e.

Compare this to the price function implied by the classic constant product setup for a concentrated position.

PconstProd(x,y,L)=y+LPax+LPb=L2(x+LPb)2P_{constProd}(x, y, L) = \frac{y + L\sqrt{P_a}}{x + \frac{L}{\sqrt{P_b}}} = \frac{L^2}{(x + \frac{L}{\sqrt{P_b}})^2}PconstProd​(x,y,L)=x+Pb​​L​y+LPa​​​=(x+Pb​​L​)2L2​

We can see how they are effectively the same form, but we don't need to deal in square roots. Our efficiency factor also lends itself to a more human-readable interpretation which is that each unit of x acts like e units of x in a regular constant product AMM.

Accounting

We use that value function, its inverse, and Newton's method to ensure all changes to the pool's value are accurate and all balances changes leave the pool's value constant.

Any implicit swap from adding/removing a single token from the pool needs to be taxed just like a swap would or else people could synthetically swap for free by adding in one token and removing liquidity in another.

These units of value can roughly be interpreted as one unit in the base token and are thus uniform across pools. Therefore it allows users to exchange units of value between pools without cost. This is because aside from exchanging value they would still have to add and remove liq to get their desired tokens which would charge a fee similar to a swap.

.

PreviousClosureNextVertex

Last updated 1 month ago