# Liquidity, Fragmentation & Bridges

## Cross-chain Liquidity Aggregation

![](https://1583521455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOvyj00f2eKRTyvXdtMz4%2Fuploads%2FLLinDMbaM0OaBQ9pI1cG%2FArtboard.jpeg?alt=media\&token=93ac13c6-d19b-46ff-b925-34b8e08d5c48)

To demonstrate how the Swing aggregator works, lets go over an example:

**Assume the user wants to swap 10 UNI on Ethereum to USDC on Polygon.**&#x20;

1\) Swing aggregator will check liquidity pools on Ethereum and other EVM-compatible chains e.g. Polygon, Arbitrum, Avalanche, and BSC.

2\) The aggregator will consider not only UNI to USDC pools from various DEXes both on Ethereum and cross-chain blockchains but it will also include intermediate pools, e.g. UNI to USDT then USDT to USDC.&#x20;

3\) As demonstrated in the figure below, assets are nodes while the expected returns from liquidity pools are the distance between each asset.&#x20;

4\) To find the best path from UNI to USDC, the aggregation algorithm will divide the input amount through linear interpolation, and fetch the price based on these input amounts on both Ethereum and cross-chain blockchains.&#x20;

5\) It will then combine the paths together and output a final price for each chain. After comparing the price across chains, the aggregation algorithm will return the expected return with the recommended chain.

## Fragmentation & Bridges

![](https://1583521455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOvyj00f2eKRTyvXdtMz4%2Fuploads%2FFFoWxeMaNvmo3IH3DzdI%2Fimage.png?alt=media\&token=8c9420fc-2857-484f-a582-7c0a67ff8679)

Fragmentation of liquidity is an interesting problem in DeFi. There are two levels of liquidity fragmentation: single-chain fragmentation and multi-chain fragmentation.

### **Single-chain Fragmentation**

On a blockchain like Ethereum, there are multiple exchanges such as Uniswap, Sushiswap, Balancer, etc, each of which contains its own liquidity without any sharing mechanism. That’s when dex aggregators like 1inch come into picture, which aggregate all the liquidity on Ethereum. In this way, users can use one interface to get access to combined liquidity to achieve smaller trading slippage with the best price.

### **Cross-chain Fragmentation**

With the rise of gas fees on Ethereum and its limitation on performance, a large number of exchanges are deployed on other blockchain platforms such as Binance Smart Chain, Avalanche and Solana. With the upcoming launch of Polkadot which is expected to be the most promising blockchain after Ethereum, more and more exchanges will move to Polkadot. Currently, there are a few solutions for cross chain interaction:

### **Centralized Bridges**

Wrapped coins were the first on-chain solution to improve cross-chain liquidity. For example, wBTC uses Bitgo as its custodian to wrap BTC to ERC20. In this solution, a central custodian helps the user to lock the token on one chain and mint it on the other. Another popular centralized bridge is the Binance bridge between Ethereum and Binance Smart Chain, where Binance acts as a custodian for the fund transfer.

With centralized bridges, users have to trust the custodian to be honest and not lose their keys. With that being said, it is the most straightforward solution and it is being widely adopted right now. \


### Decentralized Bridges

#### **Natively Verified Bridges**

This type of bridge uses the chain's own validator set to verify the data. For example, it can be done by running a light client of the origin chain inside of the destination chain's VM. Near’s Rainbow bridge, Cosmos IBC and Polkadot Snowfork bridge are in this category. The advantage of this solution is that it is trust minimized, but the downside is the solution needs to be implemented per blockchain and cannot be generalized.

#### **Externally Verified Bridges**

This type of bridge uses a third party validator set to verify data across chains, such as PoS/MPC systems. Anyswap and Thorchain are in this category. The advantage of the solution is that it can be generalized across various blockchains, but the downside is its security is not inherited from the base chains. \


#### **Locally Verified Bridges**

Instead of relying on third parties to mirror information across chains, this type of bridge uses 1:1 local interaction, which is very easy to keep trust-minimized. The downside of this solution is that event data passing is not possible. Bridges in this category includes Connext and Hop Protocol.\
