balancer-v2-monorepo
balancer-v2-monorepo copied to clipboard
Derivation of stable spot price
I'm trying to ascertain the correctness of the function that calculates the stable spot price. Referring to the code here.
- how is this equation derived?
- why is that
S(sum of balances) is 0?
paging @nventuro, could I trouble you take a quick look at this?
Hey @xenide,
We've never really used this code in production, and it's been 4 years since its implementation. The spot price is the slope of the invariant function evaluated at the current pool balances, so I assume the formula comes from deriving the implicit invariant function for stable pools. I can't really assure it's correctness at this point though.