[ToC]
Definition# underlying: base asset of a interest-bearing token interest-bearing token: IOU like cDAI, eUSDC x x x : Underlying reserve in Pool y y y : Zero-coupon bond reserve in Pool
Previous Work# Constant reserve: V r s v ( x , y ) = x + y V_{rsv}(x, y) = x + y V rs v ( x , y ) = x + y , the sum value function. Constant product: V p r o d ( x , y ) = x y V_{prod}(x, y) = \sqrt{xy} V p ro d ( x , y ) = x y , the product value function.
2-asset# before and after the swap, the following is invariant.
x 1 − t + y 1 − t = k (1) x^{1-t}+y^{1-t} = k \tag{1} x 1 − t + y 1 − t = k ( 1 ) Marginal price and Impliedt rate (IR)# In general, IR can be expressed:
r = ( 1 / p ) 1 / t − 1 r = (1/p)^{1/t} -1 r = ( 1/ p ) 1/ t − 1 r r r : IR p p p : Bond price in underlying.
p = ( x y ) t p = \left(\frac{x}{y}\right)^t p = ( y x ) t r = y / x − 1 r = y/x -1 r = y / x − 1 Value Function# V ( x , y , t ) = ( x 1 − t + y 1 − t ) 1 / ( 1 − t ) (2) V(x,y,t) = (x^{1-t}+y^{1-t})^{1/(1-t)} \tag{2} V ( x , y , t ) = ( x 1 − t + y 1 − t ) 1/ ( 1 − t ) ( 2 ) Lemma# I f t → 0 , t h e n V ( x , y , 1 ) → V r s v If \;\; t \to 0,\; then\;\; V(x,y,1) \to V_{rsv} I f t → 0 , t h e n V ( x , y , 1 ) → V rs v : mStable I f t → 1 , t h e n V ( x , y , 1 ) → V p r o d If \;\; t \to 1,\; then\;\; V(x,y,1) \to V_{prod} I f t → 1 , t h e n V ( x , y , 1 ) → V p ro d : Balancer 2-asset
3-asset# x 1 − t + y 1 − t + z 1 − t = k (3) x^{1-t}+y^{1-t} + z^{1-t} = k \tag{3} x 1 − t + y 1 − t + z 1 − t = k ( 3 ) V ( x , y , z , t ) = ( x 1 − t + y 1 − t + z 1 − t ) 1 / ( 1 − t ) (4) V(x,y,z,t) = (x^{1-t}+y^{1-t}+z^{1-t})^{1/(1-t)} \tag{4} V ( x , y , z , t ) = ( x 1 − t + y 1 − t + z 1 − t ) 1/ ( 1 − t ) ( 4 ) I f t → 0 , t h e n V ( x , y , 1 ) → x + y + z If \;\; t \to 0,\; then\;\; V(x,y,1) \to x+y+z I f t → 0 , t h e n V ( x , y , 1 ) → x + y + z になるはず。 I f t → 1 , t h e n V ( x , y , z , 1 ) → ( x y z ) 1 / 3 If \;\; t \to 1,\; then\;\; V(x,y,z,1) \to (xyz)^{1/3} I f t → 1 , t h e n V ( x , y , z , 1 ) → ( x yz ) 1/3 3-asset BalancerのValue Funcになるはず。
P r o o f . Proof. P roo f .
lim t → 1 ( x 1 − t + y 1 − t + z 1 − t ) 1 / ( 1 − t ) = exp ln lim t → 1 ( x 1 − t + y 1 − t + z 1 − t ) 1 / ( 1 − t ) = exp lim t → 1 ln ( x 1 − t + y 1 − t + z 1 − t ) 1 − t \lim_{t \to 1}{(x^{1-t}+y^{1-t}+z^{1-t})^{1/(1-t)}}\\ = \exp{\ln \; \lim_{t\to 1}{(x^{1-t}+y^{1-t}+z^{1-t})^{1/(1-t)}}} \\ =\exp{\lim_{t\to 1}{ \ln(x^{1-t}+y^{1-t}+z^{1-t})\over {1-t}}} \\ t → 1 lim ( x 1 − t + y 1 − t + z 1 − t ) 1/ ( 1 − t ) = exp ln t → 1 lim ( x 1 − t + y 1 − t + z 1 − t ) 1/ ( 1 − t ) = exp t → 1 lim 1 − t ln ( x 1 − t + y 1 − t + z 1 − t ) Here, we can apply L’Hopital’s rule. so,
lim t → 1 ln ( x 1 − t + y 1 − t + z 1 − t ) 1 − t = lim t → 1 ∂ ln ( x 1 − t + y 1 − t + z 1 − t ) ∂ t ∂ ( 1 − t ) ∂ t = − ln ( x y z ) 3 − 1 = ln ( x y z ) 3 \lim_{t\to 1}{ \ln(x^{1-t}+y^{1-t}+z^{1-t})\over {1-t}}\\ = \lim_{t\to 1}{ \frac{ \frac{\partial \ln(x^{1-t}+y^{1-t}+z^{1-t})}{\partial t} }{ \frac{\partial (1-t)}{\partial t} } }\\ = \frac{\frac{-\ln(xyz)}{3}}{-1}\\ = {\ln(xyz) \over 3} t → 1 lim 1 − t ln ( x 1 − t + y 1 − t + z 1 − t ) = t → 1 lim ∂ t ∂ ( 1 − t ) ∂ t ∂ l n ( x 1 − t + y 1 − t + z 1 − t ) = − 1 3 − l n ( x yz ) = 3 ln ( x yz ) as a reference,
Therefore,
lim t → 1 V ( x , y , z , t ) = exp ln ( x y z ) 3 = ( x y z ) 1 / 3 \lim_{t\to 1 }V(x,y,z,t) = \exp{\ln(xyz) \over 3} = (xyz)^{1/3} t → 1 lim V ( x , y , z , t ) = exp 3 ln ( x yz ) = ( x yz ) 1/3 This is exactly same Value Function of Balancer 3-asset with all weights 1/3.
n-asset# Let B i B_i B i denote balance of asset i i i in a pool and B \mathbf{B} B be vector of balances [ B 1 , B 2 . . . B n ] [B_1, B_2...B_n] [ B 1 , B 2 ... B n ] .
Trading Function f f f :
f ( B ) = ∑ B i 1 − t (5) f(\mathbf{B}) = \sum{B_i^{1-t}} \tag{5} f ( B ) = ∑ B i 1 − t ( 5 ) Value Function V V V :
V ( B , t ) = ( ∑ B i 1 − t ) 1 / ( 1 − t ) (6) V(\mathbf{B},t) =(\sum{B_i^{1-t}} )^{1/(1-t)} \tag{6} V ( B , t ) = ( ∑ B i 1 − t ) 1/ ( 1 − t ) ( 6 ) Marginal Price p i p_i p i :
p i = ( B i B o ) t (7) p_i = \left({B_i \over B_o}\right)^t \tag{7} p i = ( B o B i ) t ( 7 ) Proof# Let B o B_o B o denote balance of token o o o bought by a trader and B i B_i B i denote balance of token o o o sold by the trader.
By denition, p i p_i p i is minus the partial derivative of B i B_i B i in function of B o B_o B o :
p i = − ∂ B i ∂ B o (8) p_i = - \frac{\partial B_i}{\partial B_o} \tag{8} p i = − ∂ B o ∂ B i ( 8 ) From the value function denition we can isolate B i B_i B i :
B i = { V 1 − t − ∑ k ≠ i B k 1 − t − B o 1 − t } 1 / ( 1 − t ) (9) B_i = \left \{ V^{1-t} - \sum_{k\ne i}B_k^{1-t} - B_o^{1-t} \right\}^{1/(1-t)} \tag{9} B i = ⎩ ⎨ ⎧ V 1 − t − k = i ∑ B k 1 − t − B o 1 − t ⎭ ⎬ ⎫ 1/ ( 1 − t ) ( 9 ) Now Eq8 becomes:
p i = − ∂ B i ∂ B o = − ∂ ∂ B o { V 1 − t − ∑ k ≠ i B k 1 − t − B o 1 − t } 1 / ( 1 − t ) = ( V 1 − t − ∑ k ≠ i B k 1 − t − B o 1 − t ) 1 / ( 1 − t ) − 1 B o − t = ( B i 1 − t ) 1 / ( 1 − t ) − 1 B o − t = ( B i B o ) t p_i = - \frac{\partial B_i}{\partial B_o} \\ = - \frac{\partial}{\partial B_o} \left \{ V^{1-t} - \sum_{k\ne i}B_k^{1-t} - B_o^{1-t} \right\}^{1/(1-t)} \\ = \left (V^{1-t} - \sum_{k\ne i}B_k^{1-t} - B_o^{1-t} \right)^{1/(1-t)-1} B_o^{-t} \\ = (B_i^{1-t})^{1/(1-t)-1} B_o^{-t} \\ = \left({B_i \over B_o}\right)^t \\ p i = − ∂ B o ∂ B i = − ∂ B o ∂ ⎩ ⎨ ⎧ V 1 − t − k = i ∑ B k 1 − t − B o 1 − t ⎭ ⎬ ⎫ 1/ ( 1 − t ) = V 1 − t − k = i ∑ B k 1 − t − B o 1 − t 1/ ( 1 − t ) − 1 B o − t = ( B i 1 − t ) 1/ ( 1 − t ) − 1 B o − t = ( B o B i ) t References# Constant Power Root Market Makers
Balancer Whitepaper