SpiritSwap V2
Balanced AMM (V2.1)
The balanced AMM is a fork of the Balancer AMM architecture. This enables better trade pricing and peg maintenance of stable pairs and offers the ability to offer weighted pools.
First of all, SpiritSwap would like to give credit to the team at Balancer for architecting this supreme piece of technology. SpiritSwap aims to curate the best bits of DeFi available and house them in a central hub that supports the SpiritSwap ecosystem, this portion of innovation was a must have for our V2 hybrid model.
A balanced AMM utilizes both weighted math to facilitate swaps within "weighted pools" and stable math for swaps within "stable pools".

The purpose of weighted math is to facilitate swaps across a wide variety of asset types, irrespective of their price correlation. In this scenario price of assets are resolved by three factors
  • Balances within pools
  • Weights within pools
  • The volume of tokens being swapped
The weighted math formula used by Balancer is a iteration of the
CPF (Constant Product Formula) The iteration accounts for cases where by
nโ‰ฅ2n \geq2
(number of tokens within the pool are greater than two) thus allow for index style pools, while accounting for the fact that the weights of these tokens are not your standard 50/50 allocation like the traditional vAMM. The desired weight of value attributed to each token is maintained while the price of each asset changes by virtue of trades made within the pool by arbitrageurs, if effect rebalancing the pool.

The stable math equation is quite complex and utilized for asset classes that are required to remain at a trade value parity (i.e. as close to peg with one an other that the market will allow). With the employment of stable math these pools are expected to allow the facilitation of trades, for these asset classes, without the trader experiencing high slippage on larger volume trades. For a greater level of insight as to how the invariant is determined in this formula, we recommend referencing the original Balancer documentation.
Copy link
On this page
Weighted Math
Stable Math