Introducing Multi-chain Liquidity Aggregation

Ref Finance
4 min readApr 19, 2022

--

Access to Aurora’s liquidity from Ref Finance

Introduction

Aurora is an EVM-compatible chain built on top of the Near protocol. Composability and liquidity on Aurora have grown significantly over the last three months. TVL has increased from $500m+ to almost a billion and DeFi is now well-established, with over twenty applications building the legos of money.

Although Aurora and the Near-native chain provide a different user experience, both take advantage of the scalability and speed of the sharding design.

As a multi-chain future is on the horizon, the ability to create a simple and frictionless experience, taking the best out of different environments, will be key.

The Aurora Liquidity Aggregator is a first step into this multi-chain future.

Solution

The aggregator is a built-in function on Ref Finance that aggregates data across Decentralised Exchanges on Aurora and Near. In addition to the aggregation of hundreds of trading pairs, the solution leverages the Auto Router, which is now able to find the optimal route combining all liquidity pools from Aurora and Near.

Simply put, users will be able to trade between any existing pair on both environments, without the need to leave Ref!

Behind the scenes

The solution goes through the following logic:

  1. Query trading data (price, slippage, fee, etc.) on Aurora using the Aurora’s Software Development Kits (SDKs)
  2. Find optimal route (best price) for a specified amount of Token A to Token B accross all liquidity pools on Near and Aurora
  3. Swap — Action that combines:
  • Transfer of tokens to a mapping address on Aurora via a cross-network contract call (credit to Evgeny and Vadim: https://github.com/NearDeFi/hub)
  • Swap on Aurora using the user’s Near account keys
  • Transfer of tokens from the mapping address on Aurora to the user’s Near wallet

Note: a mapping address is a “proxy address” which maps one’s Near account onto Aurora with a corresponding ETH address. It is generated by the user’s Near account ID, and triggers/generates all the actions on the Aurora network on behalf of the user. In other words, the user signs all transactions on Aurora from the mapping address using their Near wallet, removing the need to set up a separate ETH wallet to use Aurora.

Liquidity Aggregation: High-level Abstract

Key advantages

  • Better prices
  • Deeper liquidity and improved price impact
  • Lower trading slippage
  • Improved token accessibility/visibility

And all the above without the need to use a Metamask wallet and the Rainbow Bridge!

Example 1: better price

Alice wants to swap 1 ETH for NEAR. The current price is 1 ETH for 187.63 NEAR on Ref vs. 1 ETH for 188.55 NEAR on Trisolaris.

Today, Alice would:

  1. Bridge ETH over to Aurora
  2. Swap ETH for NEAR on Trisolaris
  3. Bridge NEAR back to NEAR native

This process requires Alice to set up her Metamask wallet, and to complete the relevant DeFi actions.

With Ref’s Liquidity Aggregator, Alice can now swap ETH for NEAR using Trisolaris’ liquidity pools, without ever leaving Ref.

Example 2: improved token accessibility

Ben wants to buy some TRI with his SKYWARD, but there is no TRI/SKYWARD pool on Ref or Trisolaris.

Today, Ben would:

  1. Swap SKYWARD for NEAR on Ref
  2. Bridge NEAR over to Aurora
  3. Swap NEAR for TRI on Trisolaris

With Ref’s liquidity aggregator, Ben only has to select SKYWARD as the token in and TRI as the token out on Ref, then click on Swap.

Please note that the token MUST be whitelisted on both; the Rainbow Bridge and Trisolaris.

Next step

The feature will be deployed on testnet on the 23rd of April. The week of the 25th will be dedicated to the testing phase.

The feature is planned to be live on mainnet at the beginning of May.

Acknowledgments

Special thanks to Evgeny and Vadim, for their early research and implementation of the ‘mapping addr’.

For more details, please check the following link: https://defihub.pages.dev/

About Ref Finance

Ref Finance is a community-led, multi-purpose DeFi platform built on Near protocol.

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

In addition to the advantages of being built on top of Near, Ref Finance provides:

  • Multiple pools in one contract
  • Atomic transactions
  • Customisable pool fee

For more information, please refer to our documentation.

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

Written by Ref Finance

The gateway of #NEAR DeFi - Top 1 DEX on Near

Responses (3)