The figure above denotes the custom bonding curve that Xave uses for each liquidity pool in our FX AMM. When an FX swap is executed the corresponding proportion of tokens that remain within the liquidity pool after the swap is reflected on the black line (above).
FX Swaps can occur in one of two “regions” of the bonding curve:
The “beta” region (points colored in yellow), allows for one currency to be exchanged for another at expected real world rates (“FX accurate”). Within this region, trades will be charged a constant fixed fee paid to LPs, as with classic AMM behavior. It is important to note that in the beta region, there is no price slippage and the total amount of assets in the pool obeys a linear relationship – a constant sum invariant behavior.
Outside of this “FX accurate” beta region, however, trades will be priced depending on the LP ratio of the pool and not depending on the FX price provided by Chainlink oracles. Additionally, the swap fees paid to LPs will be dynamic, wherein a trade that moves the token ratio away from “FX rate” or beta region will be charged a higher fee, and a trade that moves the token ratio towards the beta region will be charged a lesser fee.
When the liquidity composition crosses beyond the beta region price slippage will occur. As seen from the diagram above, once the composition of tokens in a pool crosses point J the graph curves horizontally.
In this region we observe that the pool is more heavily weighted towards Token B. Since the gradient of the slope determines the price of Token A in terms of Token B, this means that the price of Token A decreases between point J to K. Conversely, when the composition of liquidity is more heavily weighted towards Token A (HI), the graph curves vertically. This means that the price of Token A generally increases between point I to H, providing an opportunity for arbitrage.
Given the dynamically increasing trading fees as users trade further away from the beta region coupled with the arbitrage opportunity, users are likely to trade towards the region where there is no price slippage. However, to further safeguard liquidity pools from being completely drained, Xave’s FXPools have a minimum and maximum allocation parameter which restricts trades from continuing beyond a specific point – Points H and K.