πLiquidity, Fragmentation & Bridges
Last updated
Last updated
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.
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.
3) As demonstrated in the figure below, assets are nodes while the expected returns from liquidity pools are the distance between each asset.
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.
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 of liquidity is an interesting problem in DeFi. There are two levels of liquidity fragmentation: single-chain fragmentation and multi-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.
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:
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.
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.
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.
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.