Introducing Parallel Swap

Ref Finance
3 min readJan 6, 2022

--

Context

Today, only the most liquid pools benefit from trading activities. At least it is true for traders who execute through our user interface.

For example, REF <> wNEAR pair has today 100+ pools. Only the pool with the biggest TVL is used to execute swaps. As a result, for each pair, only Liquidity Providers in the most liquid pool generate trading fee revenue.

Problem

New Liquidity Providers (LPs) are pushed to ‘comply’ with the swap fee initially set for the pool, wiping out the advantages of our Customizable LP fee per pool. Depending on the pair, LPs might want to offer a higher or lower swap fee rate.

For traders, executing through the most liquid pools does not guarantee the best prices. Depending on trade size and number of non-empty pools for the same pair, better prices could be delivered.

Parallel Swap

Think about it as our own kind of aggregator. The Parallel Swap is an algorithm to optimize a swap of two tokens. For a given swap-in amount of Token A, the algorithm maximizes the swap-out value of Token B, taking into account the liquidity and swap fees of the various A-B liquidity pools.

For example, if someone wants to swap 10 Token A for Token B, and that there are 5 A-B equally distributed liquidity pools, it is expected that the swap transaction will contain 5 swap actions, taking advantage of all liquidity and ultimately creating a win-win situation:

  • Traders: better prices
  • Liquidity Providers (LPs): fairer model (vs winner-takes-all market)

Finally, Ref Finance has been working in collaboration with Giddy and Dave, creators of the Parallel Swap algorithm and winning team of the OpenDeFi Hackathon.

By Didier, Product Manager

About Ref Finance

Ref Finance is a community-led, multi-purpose Decentralized Finance (DeFi) platform built on NEAR Protocol.

Ref takes full advantage of NEAR’s low fees ($0.005 per swap), one-to-two second finality, and WebAssembly-based runtime (hello, Rust smart contracts!).

Using the Rainbow Bridge (NEAR <> ETH), traders can utilize the billions of dollars in ERC-20-compliant assets from Ethereum, and eventually, from any chain (BSC, Polygon/Matic, Cosmos/IBC, and others) on NEAR.

Ref Finance’s first product is an automated market maker (AMM). It is similar to Uniswap, with a few changes (not limited to):

  • Multiple pools in a single contract
  • Ability to trade across pools atomically in a single transaction
  • Customizable swap fee per pool, giving to LPs the possibility to charge higher fees for volatile tokens

Make sure you are following us on Twitter for the latest news and announcements, and do make sure you join our Discord or Telegram for deeper levels of engagement with our Team and Community!

Disclaimer

Ref Finance does not endorse or promote any of the projects, platforms or cryptocurrencies mentioned in this blogpost. Any descriptions of functionality and services provided are for information only. Ref Finance is not responsible for any loss of funds or other damages caused as a result of using the projects, platforms or cryptocurrencies described above.

--

--

Ref Finance

Ref Finance is the starting point to the NEAR Ecosystem with a leading AMM & a synchronous #DeFi Shard.