Hashflow & Magpie: A match made for DeFi

Magpie Protocol
5 min readDec 21, 2022

--

While we’ve gone over many of the big issues that we’re tackling in DeFi, we haven’t yet talked about some of the issues that are just really annoying when they come up, such as slippage and MEV attacks.

We are sure you’ve been there, waiting for your perfect moment to use those claws to snatch up a token you’ve been waiting for, only for it to fail due to slippage being too low, and losing out on the price you wanted.

Or perhaps you decided to finally put a lot of money into a token only to be subject to an MEV attack (also referred to as a sandwich attack), causing you to buy the token multiple percentage points higher in price than intended, on some low liquidity tokens you’ve probably seen some as high as ten to fifteen percent.

Let’s look into both of these real quick and then talk about how we’re here to help solve them.

It’s icy out here in DeFi, be careful!

Slippage is an important aspect of every single trade on an AMM, and it has its positives and negatives, but what is it? It’s essentially the difference between the expected price of the trade and the actual price it ends up at when it goes through.

What does that mean?

Each trade requires gas to process, and there could be zero, one, ten, or a hundred people trying to swap that token ahead of yours when you click the “swap” button, each resulting in a change of price in the token from the AMM, and remember that your swap will also change the price of the asset.

Now, if the price impact percentage of a swap or the change in price of the asset is higher than your slippage, the transaction will not complete, costing you a bit of money in failed transaction fees. That could also be considered an upside in some scenarios, as it guarantees that your swap won’t go through if the price changes too much.

Slipping on the Ice.

So you set your slippage to a high percentage like 5–15% to make sure you get that trade in while a token is really popping off, or possibly dropping off and you want to sell. What are the risks?

One of the biggest is that of MEV (or sandwich/frontrunning) attacks. To keep it short and sweet, this refers to the extraction of value from Ethereum users by reordering or inserting transactions within blocks before and after other transactions.

Ex. Token is priced at $100, user has slippage at 15% and swaps $500 for five of them, but is subject to a MEV attack, which places a huge buy transaction directly before theirs, and an equal sell directly after, causing them to lose 15% value immediately, and only receive 4.35 tokens instead of the 5 they wanted, as the attack caused them to buy at a price of $115 each, and then the attack sold, making them go back down to around $100 directly after.

Now the user is already down 15% on their token, essentially losing $65 on top of gas fees.

Hashflow: Protecting you from Attacks.

Hashflow is a project that directly tackles these issues (and more!) and is a decentralized exchange designed around providing users MEV-protected trades at zero slippage, as well as facilitating users going cross-chain. What this means is that the price you see is exactly what you’re going to get!

How do they do this?

They don’t rely on AMMs, but rather use a request-for-quote (RFQ) model in which professional market makers manage liquidity pools.

Using this method, market makers can use more advanced pricing strategies compared to AMMs, factoring in off-chain data such as volatility, historic asset prices, and more, all backed by cryptographic signatures, which makes frontrunning impossible, as well as making certain that your trade is executed at the displayed price, rather than an estimate.

Additionally, you’re able to swap stablecoins and a few of the top tokens such as ETH, MKR, CRV, WBTC, and more, all on-chain or cross-chain, with the same benefits as above, as well as being much faster and more secure than bridging (when going cross-chain).

Magpie x Hashflow: No need to walk on ice when you can fly!

We here at Magpie are thrilled to announce that we’re integrating Hashflow directly into our already amazing order routing algorithm, so you get the best of both worlds!

Using Magpie on top of Hashflow you can swap using ANY asset to ANY connected chain, while not being limited to stablecoins and major tokens. Additionally, when you swap, our aggregator will instantly calculate the best route possible to get you the best price, no matter what it takes!

Magpie and Hashflow are here to make DeFi a better, more efficient, more secure experience and we hope you all join us!

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.