Unveiling the Multiswap Router

0
18

Our multiswap router is finally complete and available on the Ethereum, Binance Smart Chain, Polygon, and Avalanche mainnets!

You can find the contract at 0x8e0c9e7a4b9285a2c671942ece944175a52874a7 on all the above networks.

In addition to the networks above, we plan to support Arbitrum in the near future. We encourage our community to share other layer 2 / secondary blockchains which they would like us to support.

What’s the motivation?

In QFinance V1, the swap functionality was built directly into the pool contract. This meant pool contracts were costly to deploy and could only be used alone.

Separating the multiswap functionality that the pools already had (with major improvements) provides the same functionality to the investment pools at a fraction of the deployment cost. In addition, it can be used by other contracts or directly by users.

Our goal is to build a modular, extensible DeFi suite. Separating the multiswap contract from the investment pools was step 1 in this path.

Subscribe to Coinmonks Youtube Channel to get daily crypto news.

What’s the benefit?

  • Batch multiple swaps into one transaction, saving time and effort required waiting for multiple DEX swaps to settle individually.
  • Save gas when making multiple swaps at once. Swaps are cheaper when bundled together and the gas savings increase with the amount of swaps.
  • Submit transactions to take advantage of short-term gas price blips. If gas unexpectedly drops, you could make multiple swaps much faster than if you had to sign and broadcast each one separately.

About gas savings

Gas savings are found by bundling multiple transactions into one, thereby saving on the base gas costs of additional transactions. With one token, the gas savings are null. You can see savings with two swaps. As you start adding more tokens, the gas savings are more pronounced.

This image shows a two token swap using the multiswap router. Note the gas used: 237,122.

Now see here for a direct Uniswap transaction of an individual swap for QFI:

Direct swap for QFI on Uniswap. Note gas used: 118,918.

Here is a direct swap for UNI on Sushiswap. Sushiswap and Uniswap v2 have the same code and therefore can be compared fairly:

Swap on Sushiswap ETH — UNI. Note gas used: 128,096.

Performing the same action on Uniswap twice would equal gas costs of 247,014, above the 237,122 used by the multiswap router. This margin will increase for each swap.

What are the limitations of the contract?

The contract isn’t magic. Gas fees still suck, and this doesn’t “solve” Ethereum transaction fees. It is a tool that will help you maximize value within the current gas situation if you need to make multiple token swaps.

It is designed solely for the leading DEXes of the network it is on (Uniswap, Pancakeswap, QuickSwap, and Pangolin). Our plan is to build our own aggregator in the future with gas savings as a primary concern. This way our users will get the best pricing and gas savings at the same time. For 99% of tokens, the current contract will return the best possible price, but we recommend doublechecking if you are trading a small-cap coin.

What about that audit?

We’ll have another post about the audit shortly so we can discuss it in more depth. Our audit is complete and our contract is safe to use.


Unveiling the Multiswap Router was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.