LogoLogo
  • Welcome
  • Getting Started
    • Quickstart
  • Use Cases
    • Multi Token LP
    • Single Pair Stable LP
    • LP Money Market
  • Technicals
    • Multi-Pool High-Level Architecture
    • Multi-Pool Details
      • Closure
      • Value Accounting
      • Vertex
        • Vault Proxy
        • Reserve
      • Risks
    • Single-Pool Architecture
    • Risk Assessment
  • Community
    • 🎪 Welcome to the Troupe
Powered by GitBook
On this page
  • The Multi-Pool Diamond
  • Adjustor
  • BGTExchanger
Export as PDF
  1. Technicals

Multi-Pool High-Level Architecture

PreviousLP Money MarketNextMulti-Pool Details

Last updated 1 month ago

The multi-pool is composed of 3 independent pieces:

  • The pool itself, which is a Diamond (EIP-2535), handles multi-swap behavior for a base token.

  • An Adjustor which normalizes denominations.

  • BGTExchanger, a proxy for Bera Reward Vaults the pool uses to collect BGT in real-time.

The Multi-Pool Diamond

This is the workhorse of the protocol, and contains multiple mini-pools called Closures within in as well as vault-wrappers for each token in the multi-swap called Vertices. Each Multi-Pool is designed around one base token (e.g. USDC, BGT, ETH, BTC, BERA, SOL, etc.).

For one base token, the multi-pool can register up to 16 tokens (including the base token itself) that are closely pegged in price. For any combination of these tokens, there is one Closure (a mini-pool). When depositing liquidity, users pick which Closure to use which allows them to LP for just that token combination, and avoid the risks of any unwanted tokens out of those 16. Closures operate as a classic AMM by itself, allowing users to provide/remove liquidity and traders to swap between two tokens in its token combination. The Closures are linked together through a value staking system (explained later).

Each token registered within the Pool is registered with a vault and gets an associated Vertex. The Vertex is a proxy for that vault (which can be hot-swapped) and tokens are always deposited in their respective vault, continually earning.

Finally, all user positions and fees earned by tracked by the Asset Book.

Adjustor

The adjustor simply converts a token balance into a new balance that should match 1-to-1 with the base token's balance. For example, USDC has 6 decimals but MIM, another stable has 18 decimals. So we adjust the USDC balance by multiplying it with 1e12 so that it can be traded one to one with MIM. After the trade we divide out the 1e12 to get back the real USDC balance.

This is especially useful for LSTs which are pegged with a conversion ratio to the base token (e.g. stETH to ETH). So since 1 stETH might be worth 1.05 ETH, we multiply the stETH balance by 1.05 to get an artificial balance we can swap 1 to 1 against ETH with, and then we divide to recover the real balance in stETH. Furthermore, this helps prevent IL from moving pegs. Normally when the peg moves on a regular AMM, someone gets to arbitrage the pool when moving the price accordingly. Because it happens automatically with Adjustors on Burve, the "arbitrage value" is instead kept by the depositors. We use a combination of different adjustors (through the MixedAdjustor) to get the right adjustment on a per token basis.

BGTExchanger

Because users can deposit into different Closures, , we can't issue a single ERC20 LP token for all depositors in the Multi-Pool since each closure earns fees at a different rate and should thus earn different amounts of BGT. There are also a lot of closures (256 for 8 tokens, >64,000 for 16 tokens) so it's impossible to register and maintain all those BGT-earning LP tokens.

Instead, the Pool itself handles earning BGT for users, circumventing the LP Reward Vault. When users deposit into the protocol, which decide what percent of their fee earnings they wish to exchange for BGT instead. Now a user can opt to convert 100% of their fee earnings into BGT, or 0%, or somewhere in between. This happens through the "value" system described later in Closure Details. In short, a portion of the fee earnings of the pool are sent to the BGTExchanger contract which stores exchange rates for a liquid BGT wrapper which it then gives to the pool in return for those fees.

High-Level Architecture