safe-transaction-service icon indicating copy to clipboard operation
safe-transaction-service copied to clipboard

Add an oracle for Balancer V2 Pools

Open mmv08 opened this issue 2 years ago • 0 comments

What is needed?

Right now, fiat prices are only shown for Balancer V1 LP tokens. Because the V2 is quite big already, it makes sense to support V2 LP tokens too.

Background

Example: https://etherscan.io/address/0xA6F548DF93de924d73be7D25dC02554c6bD66dB5 Price on zerion: https://app.zerion.io/invest/asset/B-50WBTC-50WETH-0xa6f548df93de924d73be7d25dc02554c6bd66db5

How to calculate the price

  1. No idea
  2. It looks like the weighted pool contract doesn't expose token addresses, we'd have to retrieve them from the storage
  3. Docs on maths behind the pool https://docs.balancer.fi/concepts/math/weighted-math https://dev.balancer.fi/resources/pool-math/weighted-math

mmv08 avatar Jan 07 '22 16:01 mmv08