Were they interested in befriending her? Yeah, maybe. She looked at them thinking one of them would look back. And one ofcourse did. Even if in sheer disgust of having someone eavesdrop on her…
AlpacaSwap is an evolution of automated market maker protocols that provides optimal liquidity by consolidating all assets into a single pool. This ensures that liquidity of popular assets is not fragmented across a number of pairs, creating the first viable, plug-and-play liquidity pool for DApps.
Aggregating all liquidity in a single pool confers significant benefits to traders compared to fragmented liquidity pools in the form of reduced slippage, reduced gas, and reduced fees.
In this article, we illustrate how Alpaca reduces slippage, even in comparison to the theoretically optimal liquidity “aggregator” in a world of fragmented liquidity.
The math proving that Alpaca provides optimal liquidity gets extremely cumbersome very quickly in any non-trivial scenario. So for the purposes of this article, we’ll restrict ourselves to a relatively general comparison that will illustrate how Alpaca saves fees.
Our comparison universe will have three assets, A, B, and C, with the same amount of each asset deposited into liquidity pools in all scenarios. Let’s imagine the hero of this article wants to trade an amount DA of asset A for an amount DB of asset B. We’ll compare two scenarios — one where the liquidity is fragmented (e.g. Uniswap) and one where the liquidity is consolidated (Alpaca).
We’ll see that our hero receives less of asset B out in the first scenario when compared to the second scenario.
In this scenario, all liquidity is consolidated into a single pool (the Mother Of All Pools). By definition, the amount of asset A in the MOAP is equal to the total amount of asset A in all pools in scenario 1, and likewise for assets B and C.
The hero of our tale wishes to trade DA and maximize the amount he receives, DB. It is hopefully obvious to the reader that trading entirely in pool 1 (comprised of A and B) would be highly suboptimal compared to the second scenario where all of A and B are in a single pool. Instead, let us assume our precocious protagonist observes that he can execute part of his trade by trading A for C in pool 2 and C for B in pool 3 with the aim of minimizing slippage and overall trading costs. This is the basic function of a liquidity aggregator.
Finding the optimal combination of leg 1 and leg 2 is an optimization problem:
Let’s say our trader is making a healthy sized trade of DA = 3/100 n. This size trade wouldn’t be crazy for a DApp migration, for example. Under this scenario, the total amount he recieves, DB, is
Now let’s see how that compares to the results he would see using Alpaca instead.
In the world of Alpaca, our hero doesn’t need to worry about optimization across multiple pools. Instead, trading any pair is as simple as trading against the Alpaca pool. To make the comparison apples-to-apples, instead of having pairs of n for each possible pair, as in our simplified scenario 1, we instead have 2n of each asset in the Alpaca pool for the same total asset base.
Alpaca’s trading curve invariant reduces to the Uniswap constant product curve when looking at any given pair. Let’s see how much the trader receives of asset B (DB) when he swaps in DA = 3/100 n.
Let us compare the amount our fearless trader received in the two scenarios:
So in scenario 1, he receives 0.5% less of asset B for his efforts — an increase in slippage of 50 basis points! That is an extraordinarily high amount for a trade.
But that’s not all! I’ve been quite generous to scenario 1 thus far and excluded things like gas and fees. Let’s take a realistic tally of the additional costs that fragmented liquidity impose on our poor trader:
The bottom line: Our trader is easily paying more than 1% in additional fees solely because of how inefficiently capital is deployed when liquidity is fragmented across pairs. That’s a disaster.
The general result: For any given asset base, Alpaca strictly dominates the fragmented alternative. You can take that to the bank.
Every 30 minutes I offer my grandchildren food because I simply MUST. I am called to — I feel the blood rush through me like a siren call, but instead of calling for lovers upon my shores, it’s for…
I have to be frank with you, I hate tittles that over promise like that one just here. I can’t stand on-line courses or content that promises you the moon with one simple swoosh of a magic wand. If…