Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Balancer v3 #809

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft

Conversation

johngrantuk
Copy link
Contributor

@johngrantuk johngrantuk commented Oct 11, 2024

  • Add support for Balancer V3.
  • Currently we only have a Sepolia test deployment so some config has been added to help with debug, tests, etc but doesn't fully run as PS not deployed there.
  • Using Balancer Maths package which is typescript maths for Vault/Pool logic. Aims to be 100% accurate to Smart Contract logic and maths, written with bigint maths with no dependencies to be efficient. Will always include Balancer supported pools and hooks which makes adding new pools, etc scalable across integrations.
    • This is currently out of date vs latest testnet deploy so some tests are failing. Will be updated.
  • Boosted Pool support is added:
    • Balancer V3 has the concepts of Boosted Pools and ERC4626 Liquidity Buffers.
    • These enable highly capital efficient pools and gas efficient swaps.
    • To swap via a buffer we must provide the correct ""steps" to the router transaction.
      • Wrap: e.g. USDC>aUSDC
      • Unwrap: e.g. aUSDC>USDC
    • A full swap between USDC>DAI for an example bbausd pool consisting of aDAI/aUSDC/aUSDT would look like: USDC[wrap-buffer]aUSDC[swap-pool]aDAI[unwrap-buffer]USDC
    • See docs for further info:
    • BoostedPool
    • Buffer

Questions:

  • getAdapters: Should this be filled? And if yes what should it do?
  • getAdapterParam: Should this be filled? And if yes what should it do?

TODOs/Notes:

  • balancer-v3-integration.test.ts test is failing because there is a mismatch between math and testnet pool versions. Will be updated in near future to match.
  • other event tests need added but waiting for new test deployment
  • gasCost to be added once final profiling ready
  • nested pools to be added later
  • hook support to be added later
  • there are other todos being tracked inline

@KanievskyiDanylo
Copy link
Contributor

Fixes BACK-1746

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants