BPT Oracle
Methodology and implementation of Balancer Pool LP token (BPT) pricing
The LP share pricing on this page describes constant product pools (ordinary Balancer pools). Coming documentation will describe how to similarly price a wide variety of other LP tokens.
To price LP tokens, it is not enough to simply add the values of all assets in the pool as this is easily manipulated. We use a more robust procedure for calculating Balancer LP token values.
For a given Balancer pool containing assets 1, ..., n, define the following:
wi=weight of asset iri=amount (in # tokens) of asset ipi=price of asset iS=total # BPT tokensw_i = \text{weight of asset } i \\ r_i = \text{amount (in \# tokens) of asset } i \\ p_i = \text{price of asset } i \\ S = \text{total \# BPT tokens}
The constant product of the Balancer pool is
k=i=1nriwik = \prod_{i=1}^{n} r_i^{w_i}
Note that the amounts
are easily manipulatable, but the product
is not. And, as we require asset pricing oracles elsewhere, we can presume that the prices
are also not easily manipulatable (controls to assure against this will be discussed elsewhere).
To make the manipulation-resistant BPT oracles, it will be enough to express the pricing of BPT tokens in terms of solely manipulation-resistant variables
wi,pi,k,Sw_i, p_i, k, S
The portfolio value of the Balancer pool can be calculated as
BPT total value=ki=1n(piwi)wi\text{BPT total value} = k \prod_{i=1}^n \left( \frac{p_i}{w_i} \right)^{w_i}
Then, in turn, the BPT price can be calculated as
pBPT=BPT total valueS=ki=1n(piwi)wiSp_{BPT} = \frac{\text{BPT total value}}{S} = \frac{k \prod_{i=1}^n \left( \frac{p_i}{w_i} \right)^{w_i} }{S}
Copy link