Aggregating DEX Liquidity

Magpie Protocol
7 min readFeb 15, 2023

--

Large amounts of liquidity is one of the most needed components for DeFi to compete with Centralized exchanges.

Research shows Magpies like to store food to eat later, creating stashes in multiple places in order to eat when they can’t find food elsewhere or just when they need it. That’s kind of like what we’re doing with DEX liquidity, we’re pooling resources from as many places as we can so that all of our friendly birds (users) out there have plenty of sources (liquidity) to eat from (trade). We don’t want anyone going hungry, or to get a bad price, so that’s why we do it.

First off, what is DEX liquidity aggregation? To keep it brief, it means that liquidity pools across all sorts of automated market makers (AMMs). This means that not only do you not have to search them all to find a token you want, as Magpie does it for you, it also means that a larger reservoir of assets to pull so you get a better price.

Aggregation makes life easier, the ability to have your best options provided to you is a service pretty much anyone can get behind. Most birds don’t want to dig up a bunch of yummy worms for a meal, they want to be brought the best ones for a meal, like the cool, fancy birds have done. Well, Magpie makes sure that all the birds feel cool and fancy, as we provide you with a huge plate and selection of the biggest and tastiest of worms for a meal, sorry, got carried away with the worm talk, we meant we aggregate hundreds of DEXs liquidity to make sure all our users are getting the best price possible and we fly around at light speed searching for the best possible price, from the DEXs with the most liquidity in order to be sure that you get it.

DEX liquidity aggregation is the only way DeFi is going to take over global finance when it needs to compete with both centralized exchanges and traditional finance. Without it, along with some other issues we’ve discussed in past blog posts, such as ease-of-use, user experience, speed, pricing, and more, there are just too many options for most people to search through. With that in mind, many people, especially retail users using centralized exchanges or people not in crypto, will simply not adopt it, and the numbers show it.

Where are DEXs at now?

As of today, according to The Block, only 13% of spot trading is done on DEXs, leaving the remaining 87% for centralized exchanges. Roughly 25% of that is on Binance, who has historically halted withdrawals of Ethereum and Ethereum based tokens multiple times. The last time they halted, there were over 150,000 transactions trying to get off of Binance to Ethereum to try and take part in DeFi. This isn’t the only time they’ve done it and we can see from some recent events surrounding the collapse of centralized exchange FTX and their token FTT, the mantra of not your keys not your crypto is more accurate than ever. If you’re not in control of what you can do with your crypto, when you want to, it’s not really yours.

How do we get these users over to DeFi? People want to trade, but they want it to get the best price and want it to be simple, and these are the areas in which DEXs need to be able to compete with centralized exchanges (CEXs). Using CEXs is like being a bird in a cage, you get a lot provided for you and you feel safe, but you’re not actually free to do what you want or go where you want to go, and we can see from the numbers that a huge majority of people are willing to take on the risks of using them for that experience. But sometimes they will prevent you from leaving that cage, with your money, to fly where you’d like, and in other cases, you may just lose it all as the third party in charge halts buying/selling and sometimes even loses everything. In a decentralized system, that won’t happen, and we believe that Magpie can provide that amazing and freeing experience for DeFi, while adhering to all the most important principles of DeFi.

The Future of DEX aggregation in DeFi: Magpie

Magpie is non-custodial, meaning your assets are always in your control. We’re user friendly, easy-to-use, secure, we’re going to save you time, and get you an amazing price, everything you want from the aforementioned CEXs, but more, and in DeFi!

If you weren’t aware, Magpie aggregates liquidity from the top DEXs and AMMs across all of the blockchains we’re on. This allows our unique aggregator to provide you with fast execution, fast response times, high order throughput, and the best prices both inter- and cross-chain. Here’s a quick breakdown of how we’re able to do it.

Fast Execution

Our friends the Peregrine falcons are the fastest birds on the planet, so we modeled our transfers after them by utilizing Wormhole bridge for cross-chain communication with a 5 consistency level. Meaning we wait for 5 confirmations on source chain before generating a VAA for cross-chain communication means that our relayer can swap for your tokens on the destination chain as soon as we receive these confirmations and receive the funds on the source chain. This results in much faster execution when compared to needing to bridge your tokens.

Fast Response

Magpies love collecting things, especially things of value, so that’s exactly what the back office birdies are doing, gathering all of the information for us. Our infrastructure consists of many microservices, one of which collects on-chain liquidity information of all of our supported pools in the pool explorer (one of the microservices) any time a liquidity event occurs such as an add, remove liquidity, or swap. Keeping Magpie updated on every single change.

As the aggregator service has all of the supported AMMs and DEXs logic implemented within it, along with routes discovery and distribution logic, this means that we can calculate how much you’ll get with how much you’re paying without needing to wait for a response from the chain contracts, resulting in a faster response time when compared to pretty much anyone else.

Best Price

We’re dedicated to getting you the best price you can get on an asset, but the real magic is being done behind the scenes as our birds are routing the orders. Unlike most aggregators, who use predetermined intermediary tokens, such as USDT, USDC, Ethereum to route your order, Magpie will route through any token, as our birds know all the routes, not just the popular ones, which allows Magpie to automatically capture market inefficiencies. What that means is that through our aggregator, having all of the information about all liquidity and price changes on all of the AMMs we aggregate, will find the fastest and best route possible to get you the best deal.

How about this, did you know that throughout our internal and Alpha testing, Magpie aggregator has shown to provide users with the best prices a large majority of the time on any chosen token when compared to other aggregators like 0x and 1inch.

High Order Throughput

In order to make a lot of transfers at the same time, you need a lot of liquidity all at once, which is why we brought in our pelican buddies, as they can bring us tons of fish all at once, not just one at a time. As more and more users need liquidity to use the app simultaneously for swaps and transfers, it’s not enough to just bring enough to help one at a time, a ton is needed. When dealing with one chain for an on-chain swap, Magpie aggregates liquidity from all the largest AMMs, and for cross-chain swaps, we have integrated Stargate, which has over $400M in TVL. Doing so allows us to easily have high throughput where users can perform any swap they’d like both on or cross-chain, utilizing as much liquidity as possible.

Magpie will continue to aggressively add new AMMs and DEXs as they are created and across all of the blockchains we’re a part of, so be sure to check us out on Twitter so you can stay up to date. We’re currently working on adding multiple new chains to Magpie, including Optimism, zkSync, and Arbitrum to name a few and we’ll be making sure all of the best liquidity providers are aggregated into it.

DEX liquidity aggregation is important to creating the DeFi that we all want, a decentralized finance system where you’re in control of your money.

For more news and updates about Magpie, join our Discord, Twitter, and Telegram.

--

--

Magpie Protocol

Future of cross-chain exchange infrastructure. Chain-Agnostic & Non-custodial liquidity aggregation protocol.