LI.FI & Rubic: Pushing Forward the Boundaries of Web3 Interoperability

Rubic
6 min readOct 3, 2022

--

On September 26th, Rubic started its anniversary five-week NFT giveaway, with each week dedicated to a specific Rubic provider. Several cross-chain providers, as well as Rubic’s beloved partners, are taking part in this event — compiling unique and brand-new NFTs for our users! This week goes out to LI.FI, which means that by swapping via LI.FI at https://lifi.rubic.exchange/ users will get our joint NFTs — a key to future benefits and airdrops! You can find the details of this promotion here.

So, what is LI.FI? How is LI.FI pushing the interoperable cross-chain future forward with Rubic? Find out right here!

LI.FI in Rubic’s Ecosystem

Since LI.FI was integrated into app.rubic.exchange in July 2022, Rubic has ramped up liquidity for users as well as for SDK and Widget integrators by adding new networks — Optimism, Cronos, OKExChain, Gnosis (xDAI), Fuse, Moonbeam, Celo, as well as the bridges — Connext, Multichain, Hyphen, Y Pool, Polygon PoS, Optimism Bridge, deBridge, Across, Avalanche Bridge, Arbitrum Bridge, Optimism Gateway, XY Finance, and Ethereum Bridge. As a bridge and DEX aggregator, LI.FI has not only expanded Rubic’s tokens’ assortment and network’s circle, but helped Rubic in optimizing asset routing between chains even further.

Transaction flow from Rubic through LI.FI’s smart contracts

Since day one, Rubic has generated more than $5.3M of cross-chain swap volume to LI.FI, which keeps its leading position in transaction volume on the Polygon, Avalanche, and Arbitrum chains.

LI.FI constitutes an essential part of Rubic’s infrastructure, facilitating cross-chain functionality with fast and secure swaps. We’re glad to have LI.FI among our cross-chain providers and partners, and hope for the best results in future collaboration.

What is LI.FI?

LI.FI (Linked Finance) is the advanced Bridge & DEX Aggregation protocol that supports any-token swaps by aggregating bridges and connecting them to DEXs and DEX aggregators. LI.FI allows dApps to drive their multi-chain strategy and enable cross-chain bridging, swapping, and messaging right in their interface.

With LI.FI, developers don’t have to choose which bridge to use, and they enjoy reduced maintenance overhead with an automatic fallback solution in case of a hack or drained liquidity.

LI.FI chooses the best bridge to move funds from one chain to another. Since bridges support stablecoins and a small number of tokens, LI.FI applies to DEXs on both sides of the bridges to swap before and after the bridge, thus facilitating any-token swaps across chains.

For example, to swap AAVE (Polygon) to SPELL (Avalanche), AAVE on Polygon is swapped into DAI on Polygon through Paraswap, and then to DAI on Avalanche using NXTP, which is finally exchanged into SPELL on Avalanche again, through Paraswap.

LI.FI aims to create a middle layer between the DeFi infrastructure and the application layer, facilitating cross-chain swaps by aggregating and abstracting away the most important bridges, connecting them to DEXs and DEX aggregators on each chain. For anyone who is considering going cross-chain, LI.FI features 3 cross-chain tools: SDK, Widget, and API.

Bridges: Implementation, Usage, and Security

To move forward with which bridge to implement, LI.FI proceeds in a three-step manner:

  1. Assess existing bridges on their capabilities (which chains are supported) and security.
  2. Check if all existing chains in LI.FI’s system are at least supported by the two bridges implemented into LI.FI. That way, it becomes certain if there is a fallback solution should liquidity be emptied, or if LI.FI has to turn a bridge off due to a hack, or something else.
  3. Either implement a bridge that backs up another or a bridge that expands LI.FI’s capabilities to bridge towards new chains.

To determine which bridge to use for swapping, the algorithm adjusts its decision-making based on qualitative factors (trust assumptions & attack vectors) and quantitative factors (speed, fees, gas costs, & reliability) and generally acts after the default prioritization pattern, which is security > speed > costs. This pattern provides the most responsible and sustainable user experience. Anyone implementing LI.FI’s bridge aggregation protocol or SDK can adjust or change the prioritization pattern, by putting a certain bridge into whitelists or blacklists.

If a certain bridge gets hacked, LI.FI utilizes two kill switches: 1. On the API level where their route calculation starts ignoring the bridge and 2. On the smart contract level, where we also provide the option to ignore kill switch checks for the protocol that has deeply integrated LI.FI.

LI.FI’s Smart Contracts

LI.FI’s API is open source, while its smart contracts are open-source and decentralized as well.

Architecture

The LI.FI Contract is built using the EIP-2535 (Multi-facet Proxy) standard. The contract logic lives behind a single contract that in turn uses DELEGATECALL to call facet contracts which contain business logic. All business logic is built using facet contracts that live in src/Facets.

For more information on EIP-2535, you can view the entire EIP here.

Contract Flow

A basic example would be a user bridging from one chain to another using Hop Protocol. The user would interact with the LI.FIDiamond contract which would pass the Hop-specific call to the HopFacet, which then passes required calls + parameters to Hop Protocol’s contracts.

The basic flow is illustrated below.

Diamond Helper Contracts

The LiFiDiamond contract is deployed along with some helper contracts that facilitate things like upgrading facet contracts, look-ups for methods on facet contracts, ownership checking, and withdrawals of funds. For specific details, please check out EIP-2535.

Moving Forward with LI.FI into the Interoperable Future

Constantly adding more chains along with bridges to these chains and exchanges, LI.FI is growing fast, with more and more dApps starting to utilize its services.

Today, LI.FI features 19 blockchains, 21 DEXs, and 11 bridges, with this number being constantly increased. LI.FI already has more than $251.1M of swapping volume and more than 206,000 transactions made.

LI.FI is the project that is pushing the boundaries of cross-chain Web3:

  • It provides a data mesh of cross-chain liquidity sources: cross-chain liquidity networks, bridges, DEXs, and lending protocols.
  • As a bridge and DEX aggregator, LI.FI can route any asset on any chain to the desired asset on the desired chain, thus providing a remarkable UX to its users.
  • All of this will be made available on the API/Contract level, which comes as an SDK, an iFrame solution, and as a widget; for other developers to plug directly into their products.

You can stay updated about LI.FI and its community through the following:

Twitter

Telegram

Medium

YouTube

LinkedIn

Reddit

LI.FI aggregation and abstraction solutions are paving the way for cross-chain and interoperability mass adoption, providing high-quality services for any dApp that strives to go cross-chain and keep up with the newest movements of the market. We’re happy to have such a prosperous project among Rubic’s partners.

About Rubic

Rubic is a One-Click Cross-Chain Aggregator which allows users to swap any of 15,500+ tokens, on and between 19 blockchains and receive the best rates from all leading trading providers. Rubic includes On-Chain & Cross-Chain swaps for Ethereum, BNB Chain, Polygon, Avalanche, Fantom, Arbitrum, Gnosis, Fuse, Celo, Optimism, Moonbeam, OKC, Boba, Tron, Moonriver, Cronos, and Bitcoin; with seamless fiat on-ramps and more!

Rubic provides the tools for crypto projects to become fully interoperable between blockchains, with an easy-to-install widget and a fully-customizable SDK. Rubic is already servicing more than 90 projects! Installation of Rubic’s SDK or Widget unlocks DeFi for any project, with access to over 15,500+ tokens across 18 blockchains, all available right on your website or inside your app.

--

--

Rubic
Rubic

Written by Rubic

Rubic's Best Rate Finder tool for crypto swaps aggregates 90+ blockchains, 220+ DEXs and bridges, and 15,500+ crypto assets.

No responses yet