Thousand Words Report: Inventory of 25 Liquidity Swap Cross-chain Bridges and Their Liquidity Mechanisms

This article is machine translated
Show original

This article was first published on March 9, 2023, as Chapter 5.10 of the " PAKA Cross-Chain Research Report " series.

Author: MiddleX

Cover: Photo by Terrance Raper on Unsplash

Communicate with me:

  • Twitter: @middlex0
  • VX:xuezhijie156

SwapBridge, also known as Liquidity Swap Bridge, its application scenario is for users to exchange native assets between multiple chains. Compared with WrapBridge, SwapBridge is a more common asset bridge use case, because in most cases, users want to obtain native assets on the target chain rather than wrap assets.

1. SwapBridge’s research framework

There are so many SwapBridges, each of which has its own set of technical description languages, hierarchical structure models, and concept naming systems, which brings a lot of trouble to researchers. In order to make our research and analysis more convenient, this article will use its own set of description systems to uniformly describe various types of cross-chain bridges. This description system is actually a research framework.

In order for you to better read this research report, we strongly recommend that you first read this chapter to become fully familiar with the framework.

1.1 Media assets

In order to complete the exchange more efficiently, cross-chain exchange often requires the use of media assets. Media assets are assets that have established liquidity with most other assets and serve a role similar to currency in the real economy. As we all know, money serves as a medium of exchange to avoid complex and unreliable barter.

We use M to represent media assets. When a user needs to exchange asset A for asset B, if

Asset A and asset B are on the same chain, then the process will be: A→M→B.

Asset A and Asset B are not on the same chain, so the process will be more complicated. Assume that the media asset of the X chain where asset A is located is M(X), and the media asset of the Y chain where asset B is located is M(Y). Then the process of users exchanging asset A for asset B will be as follows: A→M (X) ⇒ M(Y)→B.

What SwapBridge wants to complete is the middle part of the process: M(X) ⇒ M(Y). As for the first and last parts of the process, that is, A→M(X) and M(Y)→B, it is often composed of A chain and B Chain local DEX completed. We can use the following diagram to describe this process more completely:

If a user needs to exchange UNI on Ethereum for CAKE on the BSC chain, the process may be:

  1. The user's UNI is exchanged for USDT in Uniswap on Ethereum;
  2. Through SwapBridge, Ethereum’s USDT is replaced by BUSD on the BSC chain;
  3. BUSD is then exchanged for CAKE through Pancakeswap on the BSC chain.

In this example, we selected USDT as M (Ethereum) and BUSD as M (BSC). In actual situations, there may be more than one media asset on a chain. For example, on Ethereum, in addition to USDT, USDC, ETH, WETH, and DAI are also common media assets. During the specific transaction process, which media asset is selected depends on the routing strategy of SwapBridge. Under normal circumstances, SwapBridge will Liquidity distribution, select appropriate media assets for users, and complete exchanges for users with relatively low losses.

1.2 Multi-chain common media assets

In the above example, M(X) and M(Y) are different assets, but M(X) and M(Y) may also be the same asset, for example, they may both be USDT, or both USDC, USDC/USDT It is a native multi-chain asset. For example, if a user needs to exchange UNI on Ethereum for MATIC on Polygon, the process may be as follows:

  1. The user's UNI is replaced by USDC in Uniswap on Ethereum;
  2. Through SwapBridge, Ethereum’s USDC is replaced by USDC on the Polygon chain (native USDC, non-wrapped asset);
  3. USDC is then exchanged for MATIC via Quickswap on the Polygon chain.

This situation is more conducive to the construction of liquidity, because the price attributes of USDT on different chains, or USDC on different chains, are basically the same (although the security expectations of different chains are different, USDT on different chains All come from Tether, and USDC on different chains all come from Circle. They all contain the acceptance commitment of their issuer), and there is almost no price difference. This brings two conveniences:

  • LPs can provide unilateral liquidity only. SwapBridge can dispatch this liquidity on different chains. In most cases, LPs do not mind that the liquidity they provide is transferred to other chains;
  • USDC on different chains can be exchanged at a constant 1:1, and the same is true for USDT. This not only eliminates the complexity of using contract code to implement the AMM algorithm, but also eliminates the redundant liquidity cost of establishing an AMM.

1.3 Core part and extension part

The core part of SwapBridge completes the process of M(A)⇒M(B), and the DEX at both ends are extensions of SwapBridge. Some SwapBridges have built-in extensions, and some SwapBridges only provide the core part, and the extensions are handed over to the aggregator.

The extension part of SwapBridge is similar, it is nothing more than aggregating existing DEX on the respective supported chains, but the design of the core part has a variety of different design solutions. Therefore, in the following project example analysis, we will only analyze the core part and ignore the expansion part.

1.4 Hierarchical model

In order to facilitate analysis, we divide SwapBridge into three layers:

  • AMT layer: Specifies how cross-chain messages involved in SwapBridge are transmitted and verified. SwapBridge may use the existing AMB bridge as the AMT layer, or it may build or customize the AMT layer.
  • Contract layer: SwapBridge needs to deploy contracts on each supported chain to implement its execution logic for cross-chain messages. Different SwapBridges have different names for their contracts, but the execution logic to be written is not much different.
  • Liquidity layer: stipulates how the swap bridge builds liquidity and adjusts liquidity to meet users' exchange needs. This is the most worthy part of SwapBridge to analyze, and it is the area where SwapBridge requires the most attention when designing. It is the mechanism of the liquidity layer that determines the most fundamental difference between SwapBridge projects.

In the following examples, we will mainly focus on the liquidity layer and only give a brief introduction to the AMT layer and contract layer.

1.5 Classification of liquidity models

SwapBridge can be divided into two modes: AMM and order book according to the liquidity mode.

Each cross-chain exchange has an execution price. Without considering gas fees and handling fees, this execution price determines how many target assets each unit of the user's original assets can be exchanged for. In the AMM mode, the execution price is calculated by the AMM algorithm; in the order book mode, the execution price is generally generated by the LP (Liquidity Provider) quotation (pending order) and the user confirmation (taking order).

For traders, the AMM model has slippage problems and MEV problems; for LPs, there are impermanent loss problems, and these problems do not exist in the order book model. In order book mode trading, what you see is what you get, and the transaction price is determined before the transaction. However, compared to AMM, the order book model has higher professional requirements for LPs. LPs are often required to maintain a secure hot wallet environment and have the ability to write or configure quotation algorithms.

Depending on the location of the AMM, it can be divided into two modes.

  • AMM on the bridge: refers to the cross-chain bridge that directly calculates the execution price and completes the exchange based on the liquidity distribution at both ends;
  • Under-bridge AMM: refers to deploying AMM Pool on the chain supported by the cross-chain bridge, and cooperates with wrap/unwrap logic to realize cross-chain exchange of assets. In bridge AMM, there is a relatively special situation - using the same media assets on multiple chains and supporting constant 1:1 exchange in the cross-chain process. This can also be understood as a kind of AMM (constant sum AMM), but its characteristics are very different from conventional AMM (including constant product AMM and its various improved versions). We list it as a separate category: constant exchange model.

Therefore, in the following article, we will divide SwapBridge into four categories for analysis

  • Under-bridge AMM mode
  • Bridge AMM mode
  • constant exchange mode
  • Order book mode

On this basis, we will explore two advanced forms of SwapBridge: aggregator and hub chain.

2. Under-bridge AMM mode

 2.1 Symbiosis V12.2 O3swap(O3 InerChange)2.3 Thorswap (Thorchain)2.4 Synapse Protocol

2.1 Symbiosis V1

Symbiosis Finance is a cross-chain bridge project invested by Binance Lab. Early investors include Blockchain.com , Spartan, Avalanche (Avatar), DAO Maker, KuCoin, etc. The team members are mainly from Europe, and the product interface is quite geeky. .

Symbiosis's AMT layer is a permissionless MPC network called the Symbiosis Relayers network with built-in cryptoeconomic incentives. Any subject can become a Symbiosis Relayer by staking SIS.

In Symbiosis V1, if a user needs to exchange USDC on Ethereum for BUSD on BSC, there may be two paths in the process:

• Path ①: wrap first and then swap

• Path ②: swap first and then unwrap

Since the Gas on Ethereum is much higher than that of BSC, Symbiosis V1 will tend to choose the path for users ① and put the swap process on the BSC chain with lower Gas fees to help users reduce the overall cost of cross-chain exchange. cost.

Liquidity rebalancing

The AMM pool will have a liquidity adjustment function. Assuming that assets are always transferred from Ethereum to BSC instead of the other way around, the exchange ratio of sUSDC/BUSD will increase, which means that more sUSDC is needed to exchange for 1 BUSD. This situation will encourage arbitrageurs to do the opposite, use BUSD to buy discounted sUSDC, and then unwrap it to Ethereum for cash. In the same way, assuming that assets always move from BSC to Ethereum and not the other way around will encourage arbitrageurs to perform reverse operations and rebalance liquidity.

Symbiosis Docs: https://docs.symbiosis.finance

2.2 O3swap (or O3 InerChange)

O3 Swap is an asset cross-chain protocol created by the O3Labs team, and its AMT layer is Poly Network. The O3Labs team was founded in Tokyo in 2017 and is one of the world's earliest encryption wallet development teams.

Different from Symbiosis V1, every cross-chain exchange made by users in O3swap includes two swaps on the source chain and the target chain.

For example, if a user wants to exchange USDC on Ethereum for USDC on BSC in O3swap, the process will be as follows:

If users want to obtain BUSD on BSC, they need to do another swap in the local DEX of the BSC chain (such as Pancakeswap). O3swap has not established liquidity for pUSDC/BUSD. O3swap establishes liquid trading pairs, all of which are in the form of A/pA, but not in the form of A/pB.

Liquidity rebalancing

When LP wants to provide liquidity to the A/pA pool on a certain chain, it needs to provide two assets, A and pA, to the pool according to the ratio of the two assets in the current pool. LP If only A is provided, the system will automatically convert part of it into pA through the "Barter" function.

There are two ways to convert A and pA, one is to Swap through the AMM pool of A/pA, and the other is to directly convert A and pA 1:1 through the wrap/unwrap function of O3 Bridge. This is in the O3swap documentation. , is called peg/unpeg. In addition, O3swap also provides the function of directly converting A and pA 1:1 on a chain, which is called Barter.

Due to the existence of peg/unpeg and Barter functions, any imbalance in the A/pA AMM pool in any direction is quickly smoothed out by arbitrageurs.

In Symbiosis V1, each cross-chain swap only uses the AMM pool on the target chain; while in O3swap, each cross-chain swap uses two AMM pools on the source chain and the target chain. We call the former the unilateral AMM mode and the latter the bilateral AMM mode .

Both unilateral and bilateral AMM modes require the bridge to deploy an AMM pool on each supported chain. From the perspective of the cost of liquidity deployment, there is no difference between the two, but the bilateral AMM model undoubtedly increases the gas cost of a swap operation. In addition, in the bilateral AMM model, if the user performs two swaps, there will be two price impacts, and the number of assets that the user can ultimately obtain will be reduced.

However, the adoption rate of bilateral AMM mode in projects we have seen is higher than that of unilateral AMM. Even Symbiosis no longer uses unilateral AMM in its V2 version, which makes me a little puzzled. It may be because in the bilateral AMM mode, the logic on the bridge is simpler, there is only one logic burn-mint, and there is no need for wrap and unwrap logic.

O3swap docs: https://docs.o3swap.com/

2.3 Thorswap (Thorchain)

Most of Thorchain's team members come from Swish Labs, and the investment institutions behind it include: Delphi Digital, Multicoin Capital, X21 Capital, Zee Prime Capital, etc.

Thorswap is considered a core product of Thorchain, and Thorchain, as a PoS-type MPC network, is also the AMT layer of Thorswap. Thorchain's work token is Rune.

Thorswap abandoned the path of using stablecoins as media assets and instead used Rune as a media asset. In Thorswap, from asset A on the X chain to asset B on the Y chain, Rune must be used as a transit asset to complete the exchange:

Since many of the chains supported by Thorswap do not support smart contracts, Thorswap's liquidity pool is directly hosted by Thorchain's validators, who control the private keys of the custody accounts on each chain. In order to prevent validators from colluding to steal assets, Throchain requires validators to make mortgages. The total mortgage amount is 2 times the RUNE in all liquidity pools. Since there are non-RUNE assets of equal value in the liquidity pool, the validators are in Throchain. The amount of collateral on them is equal to the value of the liquidity they have in custody.

The benefits of using RUNE as a media asset are:

  • Increased RUNE’s value capture capability;
  • All chains use one media asset uniformly to avoid exchanges between different media assets.

But it also brings problems:

  • When the price of RUNE falls, arbitrageurs will take away liquidity from the system. The decline in liquidity may bring negative expectations to the price of RUNE, causing the price to fall, thus forming a vicious circle and a flywheel of death.
  • Thorswap chose to allow all assets to establish liquidity with RUNE, instead of reusing the liquidity of existing media assets, and found a more difficult path for itself to obtain liquidity. However, the reason why Thorswap chose this path may be that there is no DEX on most of the chains it supports (such as BTC, BCH), and there is no reusable liquidity.

Thorswap Docs: https://docs.thorchain.org/

2.4 Synapse Protocol

The original name of Synapse was Nerve, which was just a stable currency DEX on BSC. It has developed into an asset cross-chain protocol supporting 14 public chains. The word Synapse means synapse, which seems to express Synapse's vision of connecting multiple chains into a neural network.

**Synapse uses limited media assets: nUSD and nETH to transmit cross-chain value. **nUSD and nETH are wrapped assets created through asset reserves on Ethereum.

Nexus Pool on Ethereum

Synapse has deployed the Nexus Pool on Ethereum, where you can get nETH by pledging ETH, and you can get nUSD by pledging any one or more of the three stable coins of USDT, USDC, and DAI. The pledge is relatively short. Stablecoins can obtain more nUSD, while the amount of nUSD obtained by staking relatively excess stablecoins will be discounted. The specific amount of nUSD that users can get when depositing a single stable currency should be simulated in the Pool, and how much they can exchange with these stable coins [1/3USDC+1/3USDT+1/3DAI].

There is no clearer information in Synapse's documentation. According to the discussion between the author and Synapse developers in the community, the relative shortage and surplus here should be based on the average quantity , which means that Synapse assumes that USDT, USDC, and DAI The values are equal, and the perfect balance is a state where each of the three accounts for 1/3. However, in fact, there will be a small price difference between stablecoins, and this assumption will leave some room for arbitrageurs.

Nexus Pool on other chains

In addition to Ethereum, Synapse has also deployed Nexus Pool on other supported chains, which is a nUSD/Stablecoin liquidity. In most cases, this is a multi-asset pool. For example, on the BSC chain, synapse deploys nUSD/ 4pool for BUSD/USDT/USDC. Among the supported chains, some are Ethereum's Rollups, which will also have nETH/ETH liquidity.

In Synapse, if the user wants to exchange USDC on Polygon for BUSD on BSC, the process is as follows

But if the user's exchange involves Ethereum, the process will be different.

If you want to replace Ethereum's USDC with BUSD on BSC, the process is as follows:

If you want to exchange BUSD on BSC back to USDC on Ethereum, the process is as follows:

In other words, in Synapse, if it does not involve Ethereum's cross-chain swap, it is a bilateral AMM mode, and if it involves Ethereum's cross-chain swap, it is a unilateral AMM mode.

Provision and withdrawal of liquidity

LP can provide liquidity to the nUSD/stablecoin pool on each chain to obtain nUSD-LP tokens. LP can provide nUSD and each stablecoin in equal proportions according to the proportion of each asset in the current pool, ensuring that the pool will not change. The existing ratio of each asset, just like they do on single-chain DEX;

LPs can also offer only one of these. If only one of the assets is provided, it will push the asset ratio in the pool to change. If the LP's behavior pushes the asset ratio of the pool closer to the ideal ratio, then the LP will obtain more nUSD-LP tokens. If the LP's behavior If the asset ratio of the pool is pushed away from the ideal ratio, the amount of nUSD-LP obtained by LP will be reduced.

What is the ideal ratio? Taking 4pool on BSC as an example, the ideal ratio of nUSD/BUSD/USDT/USDC should be 1/2nUSD+1/6BUSD+1/6USDT+1/6USDC. How much nUSD-LP can be obtained by LP providing single asset liquidity should simulate the amount of assets provided by LP and how much can be redeemed from the pool [1/2nUSD+1/6BUSD+1/6USDT+1/6USDC].

The same goes for retrieving liquidity. LP can destroy nUSD and withdraw liquidity in proportion to the existing ratio of assets in the pool, or withdraw a single asset. If LP's behavior of withdrawing assets makes the asset ratio in the pool closer to the ideal ratio, Then LP will get back more assets, otherwise the amount of assets it gets back will be reduced.

Therefore, for LP, when providing liquidity, you should choose assets with relatively short liquidity, and when withdrawing liquidity, you should choose assets with relatively excess liquidity. If the current liquidity is balanced (the ratio of each asset is the ideal ratio) , there is no relative shortage or relative surplus, and it is the best strategy to provide/retrieve multiple assets in equal proportions according to the distribution in the pool.

However, if the amount of liquidity to be provided by LP is not too much, there is no need to consider such complexity, because the impact of the above factors is not too great. Synapse uses a stableswap market making algorithm similar to Curve, and the basic liquidity in the pool is also sufficient. LP provides the liquidity of a single asset and has minimal impact on the balance of the pool.

Synapse Chain

Synapse's AMT layer is a PoS network called Synapse Chain. Synapse Chain itself is an Op Rollup of Ethereum, and the work token is SYN. Synapae hopes that as its cross-chain business develops, Synapse Chain can develop from a bridge chain to a hub chain to allow applications to be deployed directly on Synapse Chain.

Synapse Docs https://docs.synapseprotocol.com/

3. Bridge AMM mode

 3.1 symbiosis V23.2 cBridge 2.03.3 AllBridge Core3.4 Chainflip

In the bridge AMM, the liquidity of the two assets of a trading pair is on two chains respectively. The bridge directly calculates the execution price based on the liquidity distribution and market-making algorithm, and completes the exchange for the user. Compared with under-bridge AMM, on-bridge AMM mode has no reaction intermediates and can be achieved in one step! However, this also means that if the transaction fails, the entire cross-chain exchange needs to be reversed.

"On the bridge" is an abstract concept. AMM is on the bridge, which means that the execution price is calculated through cross-chain. Specifically, there are several situations:

  • The execution price is calculated in the bridge contract on the source chain and the target chain. Before calculation, the liquidity amount on the source chain will be cross-chained to the target chain through the AMT layer together with the transactions initiated by the user on the source chain;
  • The execution price is calculated by the external validator set of the AMT layer. After the calculation is completed, it is passed to the target chain and triggers the pool on the target chain to release assets to the user;
  • The execution price is calculated on the bridge chain. The situation is actually the same as the previous one. Essentially, the validator of the bridge chain is still calculating.
  • The execution price is calculated on the relay chain. The bridge selects one of the chains it supports as the relay chain and completes the calculation on this chain. In this case, the source chain passes the parameters to the relay chain through the AMT layer. After the relay chain calculation is completed, it passes The AMT layer passes in the target chain and triggers the release of assets on the target chain.

3.1 Symbiosis V2

Symbiosis V2 adopts a completely different form from V1. In V2, there is a relay chain called S-chain (settlement chain) . The calculation of the execution price will be completed on the S-chain. The currently selected S-chain chain is BSC.

Symbiosis V2 still uses wrap assets (sToken) as the calculation medium.

Symbiosis V2 selects a stable currency as a media asset on each supported chain, and each media asset on the chain corresponds to an sToken on the S-chain.

  • Ethereum→USDC
  • BSC→BUSD
  • Avalanche→USDC.e
  • Polygon→USDC
  • Telos→USDC
  • Boba Ethereum→USDC
  • Boba Avalanche→USDC.e
  • Boba BNB→USDC
  • KAVA→USDC

It should be noted that even if the media assets on different chains are the same, they have different sTokens on the S-chain . For example, USDC on Ethereum and USDC on Polygon have different sTokens on the S-chain.

**sToken is actually an accounting representation of the liquidity on each chain on the S-chain. **The number of USDT on Ethereum will be the same as the number of sUSDT-Ethereum on S-Chain, and the two numbers will always remain consistent. If the USDT liquidity on Ethereum is added or withdrawn, the sUSDT-Ethereum on S-Chain will also increase or decrease accordingly.

On this basis, Symbiosis V2 established a multi-asset AMM pool composed of various sTokens on S-chain. Symbiosis V2 currently supports nine chains (including BSC as S-chain), so the AMM pool on S-chain is a 9pool with BUSD and 8 kinds of sTokens. The community vividly calls it Batongda.

Note: BNB Chian is another name for BSC

In Symbiosis V2, if you want to replace USDC on Ethereum with BUSD on BSC, the process is as follows:

9pool can help users complete asset exchanges in any direction among the 9 chains, and arbitrageurs will smooth out the imbalance caused by the different amounts of exchange funds in different directions.

Symbiosis Docs: https://docs.symbiosis.finance/

3.2 cBridge 2.0

cBridge is an asset cross-chain bridge launched by Celer Network. cBridge 1.0 used to use hash time lock-based atomic exchange (local verification) and order book model to achieve cross-chain exchange, but it is no longer used because atomic exchange has always been Users need to perform more than two steps to obtain assets, which is not a user-friendly experience.

Now cBridge 2.0 has switched to a mode that combines external verification and optimistic verification. Its AMT layer is a PoS network called SGN (State Guardian Network) and Celer IM, and now cBridge is in AMM mode.

cBridge supports trading USDT, USDC, ETH and other assets between different chains, but it can only support swaps between homogeneous assets. USDT can only be exchanged for USDT, and ETH can only be exchanged for ETH.

Of course, not all chains have ETH, and not all chains have USDT. This requires that a common media asset must be selected for transactions across chains.

Liquidity model

If USDC on Ethereum is to be exchanged for USDC on Polygon, cBridge will complete the exchange for users through the liquidity in the USDC pool deployed on Ethereum and the USDC pool on Polygon.

There is a problem here. USDC on Ethereum and USDC on Polygon must be relatively equal in order for the exchange ratio of USDC (Ethereum)/USDC (Polygon) to be close to 1:1. In fact, according to this logic, cBridge supports The USDC reserves in each chain with a USDC pool must be roughly close to each other. This brings a lot of waste: the scale of entry on different chains is different, and the requirements for the reserve amount in the pool are also different. Chains that don’t need as many reserves must also reserve enough USDC in the pool.

Faced with this problem, cBridge added weight parameters for each chain based on the Stablecoin AMM curve similar to the Curve protocol: The w value is in the following formula: wi and wj

If wi=wj=1, then this is the curve of the simple Curve protocol. At this time, the ideal value ratio of the assets on both sides is 1:1. cBridge will assign different w values to a certain asset on different chains, changing the ideal value. value ratio.

Chains with higher w values require relatively lower reserves, and chains with lower w values require more reserves. The w value needs to be set manually by the cBridge development team and can be adjusted through governance.

This requires the cBridge team to judge the entry and exit of a certain asset on each chain in the future based on experience.

If a certain asset's cross-out in a chain is always greater than its cross-in, then liquidity will tend to accumulate on this chain. Setting a lower w value for this asset in this chain can promote redundant liquidity. Flow to other chains with higher w values.

On the contrary, if the outgoing of a certain asset in a chain is always less than the incoming, then the liquidity will tend to dry up. Setting a higher w value for the asset in the chain can attract the inflow of liquidity on other chains.

For example, in cBridge, the outgoing ETH on Optimism is always greater than the incoming. This is because there is no waiting time when Optimism Bridge bridges ETH from Ethereum, but it takes about 7 days to bridge back. This causes liquidity to tend to pile up on Optimism, so cBridge sets a smaller w value on Optimism for ETH.

In short, cBridge’s asymmetric reserve algorithm is of great significance for a more reasonable distribution of liquidity on different chains.

Liquidity provision and withdrawal

Let's take USDC as an example. Among the chains supported by cBridge, there are USDC reserve pools on 11 chains. LP can provide liquidity to USDC on these 11 chains in equal proportions. However, this operation is undoubtedly too cumbersome. cBridge does not Support such operations. cBridge only supports LP to provide USDC on a single chain. If you want to provide USDC on multiple chains, you need to operate one by one.

However, LP provides single-chain liquidity and may face such a situation. Let’s take USDC as an example to illustrate:

If USDC liquidity is provided on a chain with excess USDC, the liquidity will be transferred to other chains by arbitrageurs. The arbitrage transaction follows the AMM algorithm, so after being transferred, the amount of USDC of LP will become smaller, and LP will suffer losses. .

Therefore, the system encourages LP to provide liquidity for relatively scarce assets to promote the balance of multi-chain liquidity. Assuming that liquidity is balanced across multiple chains, then the best strategy for LP is to provide liquidity to 11 chains in equal proportions. .

But in fact, similar to the situation of Synapse, if LP does not provide huge amounts of liquidity, it does not need to be so complicated. It will provide liquidity on which chain the assets in hand are on, and the impact on balance will be It won’t be too big, and there will be very little room for arbitrage. If LP wants to provide huge amounts of liquidity, it needs to consider how to provide it relatively evenly on each chain.

It should be noted that cBridge will not provide LP Tokens to LP, but will track the whereabouts of the liquidity provided by LP through the SGN network . When LP retrieves liquidity, it may need to retrieve it from multiple other chains, and it will not be the same as the one originally provided. The amounts are inconsistent.

cBridge Docs https://cbridge-docs.celer.network/

3.3 AllBridge Core

Allbridge was founded in 2021. The founder is the famous encryption entrepreneur Andriy Velykyy. So far, Allbridge has completed a seed round of financing of US$2 million.

AllBridge Core is a cross-chain stablecoin trading solution that currently supports

  • USDC (Ethereum, Polygon, Solana)
  • USDT (Ethereum, Polygon, BSC, Tron)
  • BUSD (BSC)
  • DAI (Ethereum)

Cross-chain exchange of four stable coins on 5 chains.

Cross-chain exchange and liquidity

Cross-chain exchange in AllBridge goes through a virtual medium: called virtual dollar value, which can be understood as a reaction intermediate similar to Wrapped Token, but it does not have an entity, it is just a calculation medium.

For example, if you want to change USDC on Ethereum to BUSD on BSC, Allbridge will first convert USDC to virtual dollar value, and then convert it to BUSD. The virtual dollar value has an initial price ratio of 1:1 with all stablecoins, but will slide as the transaction progresses. The calculation of the specific sliding value is a complex mathematical process, which is not suitable to be discussed in this article. Interested friends can learn more in Allbridge Core Docs.

Optional AMT layer

Allbridge's AMT layer is optional and currently supports two options, namely AllBridge itself and Wormhole.

Allbridge Core Docs

https://docs-core.allbridge.io/

3.4 Chainflip

Headquartered in Berlin, with team members located around the world, Chainflip completed financing of $6 million in August 2021 and $1,000 in May 2022.

The AMT layer of Chainflip is an MPC network, called State Chain. In Chainflip, the execution price calculation of cross-chain exchange is completed on the State Chain.

Chainflip is a project under development and the product has not yet been launched. According to the description in the Chainflip documentation, Chainflip plans to use an AMM algorithm similar to Uniswap V3 to perform cross-chain exchanges, which is called in Chainflip: Just In Time AMM, or JIT AMM for short.

We know that the interval market making algorithm of Uniswap V3 is a milestone in the development history of the AMM algorithm. This algorithm combines the properties of AMM and order book to some extent. **LP can provide symmetric liquidity (equal proportion to the assets in the current pool) or asymmetric liquidity (providing unequal proportions of liquidity to the pool) in AMM. If asymmetric liquidity is pushed to the extreme, it is unilateral liquidity (providing single-asset liquidity for a trading pair). The nature of providing unilateral liquidity is equivalent to pending orders, so Uniswap V3 actually supports LP pending stop-profit sell orders and limit buy orders.

Chainflip Docs https://docs.chainflip.io/

3.5 Summary of this chapter

An asset has different liquidity needs in each chain. Forcing each chain to reserve the same value of liquidity will cause a huge waste of liquidity. So we found that almost all SwapBridges in the AMM mode are trying to solve a problem: how to achieve liquidity asymmetry .

  • Symbiosis V2 achieves this by establishing a Balancer-like multi-asset pool for liquidity on each chain;
  • cBridge is based on the symmetrical AMM curve and sets different weight parameters for the liquidity on different chains to achieve asymmetry of liquidity;
  • Allbridge Core has added a virtual value intermediary. The exchange ratio between the virtual value intermediary and each stable currency has nothing to do with the reserves on each chain, but is only related to the exchange history, so the reserves of each chain are no longer required to be symmetrical;
  • Chainflip uses JIT AMM , which naturally allows for asymmetric liquidity.

4. Constant exchange model

 4.1 Multichain4.2 XY Finance4.3 Hyphen(Biocomy)4.4 Stargate

Although AMM has the function of regulating mobility, it causes the bridge to become complex, whether it is complex reaction intermediates and reaction processes, or complex cross-chain calculations. Some projects have begun to use a simpler and more direct method: if the assets on both sides are consistent, then they can always be exchanged at 1:1.

As mentioned before, this form can also be understood as a special AMM: constant sum AMM. If the exchange is always constant at 1:1, the sum of the liquidity on both sides will naturally not change.

The advantage of the constant exchange model is that the utilization rate of liquidity will be higher. Unlike various constant product AMMs and their various improved versions (Balancer's multi-asset AMM, DODO's PAMM, Curve's Stable AMM, etc.), there is always a part Liquidity that only participates in calculations but is rarely used. Moreover, the constant exchange model naturally allows asymmetric liquidity provision, because the exchange price is a constant value, and the distribution of liquidity on both sides will not affect the price.

However, the constant exchange model also has its limitations. It only supports exchange between versions of the same asset on different chains, and other types of exchange must use this as a medium. Just like: it can only support constant exchange between USDC and USDC. If both sides are USDC and USDT respectively, then it cannot be handled roughly 1:1.

There is another more important problem with constant exchange, that is, as a constant sum AMM, it does not have the function of liquidity adjustment . As the exchange proceeds, liquidity on one end may be depleted and there will never be room for arbitrageurs to rebalance the liquidity. Therefore, if the SwapBridge project adopts this approach, it will often be equipped with other liquidity rebalancing measures.

4.1 Multichain

Multichain is a wrap+swap mixed asset bridge, and its AMT layer is Multichain's own MPC network built on Fusion.

When the asset that the user needs to bridge has no native asset on the target chain, Multichain will trigger the wrap process and the user will obtain anyToken. For example, when the user bridges USDC from Ethereum to Moonbeam, the user will obtain anyUSDC;

When the asset that the user needs to bridge has native assets on the target chain, Multichain will trigger the swap process and the user will directly obtain the native assets on the target chain. For example, when the user bridges USDC from Ethereum to Polygon, the user will obtain it on Polygon. Native USDC;

When the asset that the user needs to bridge does not have native assets on the target chain, but is officially recognized by the target chain, recognized by the asset issuer, or is a default wrap asset by convention, the swap process will also be triggered. For example, when a user bridges ETH from Ethereum to Near, the user will obtain nETH (an ETH-mapped asset issued by Near's official cross-chain bridge, Rainbow Bridge) on Near.

Let’s take USDC from Ethereum to Polygon as an example. The process will be as follows:

Please note that there is no swap, and each link is a 1:1 exchange.

In this process, anyUSDC is a reaction intermediate and is invisible to users. Only if the transaction fails, the user may receive it:

If the burn-mint link fails, the user will keep anyUSDC (Ethereum);

If the last step of convert fails, the user will keep anyUSDC(BSC).

Users can use reaction intermediates to retry failed links at any time, or return to the initial state.

The burn-mint link generally does not fail unless there is a problem with the AMT layer. A more common failure is that the last step of the convert link fails due to insufficient liquidity in the target chain.

However, Multichain does not have liquidity rebalancing measures, so in the last step of convert, it is very likely that the USDC reserve on the Polygon chain will be insufficient. In this case, the user will receive anyUSDC (Polygon) and cannot complete the subsequent process. . At this point, if the user wants to continue the exchange, they can only wait for someone to step out of Polygon and lock in USDC, or for LP to add liquidity.

Liquidity provision and withdrawal

LP can obtain income by providing liquidity. LP can provide single-chain liquidity. The LP Token obtained by providing liquidity is anyToken. In fact, the process of providing liquidity is the process of converting Token into anyToken. In the same way, retrieving liquidity is actually the process of converting anyToken into Token.

The liquidity of LP may be moved to other chains, but the quantity will never change, which is different from the situation in cBridge. However, the movement of liquidity may cause the chain that provides liquidity for LP to have insufficient reserves and be unable to withdraw it in full. At this time, LP can transfer anyToken to other chains with sufficient reserves through burn-mint to withdraw it on other chains. fluidity.

In fact, if the user receives anyToken due to the failure of the final convert step during the cross-chain exchange process, then the user holding anyToken is actually passively providing liquidity.

Multichain Docs https://docs.multichain.org/

4.2 XY Finance

XY Finance team members mainly come from companies such as the Ethereum Foundation, imtoken, and IBM. Its founder, Wilson Huang, is an industry veteran who has been immersed in the blockchain field for more than 8 years. XY Finance raised more than $20 million in private financing and IDOs at the end of 2021.

XY Finance divides its products into X swap and Y pool. X swap is the user interface, and Y pool is the liquidity support behind it.

In XY Finance, any cross-chain exchange needs to be completed through the common media assets of both parties. XY Finance supports a total of three media assets, USDC, USDT, and ETH.

The AMT layer of XF Finance is its own Consensus chain, which is actually an MPC network. LP providing liquidity on any chain supported by XY Finance will obtain LP Token (xyUSDC, xyUSDT, xyETH) on the Consensus chain

XY Finance adopts a constant exchange model, 1 USDC can always be exchanged for 1 USDC. In response to imbalances in the Y Pool, XY Finance will reward transactions with $XY (XY Finance's own token) that drive liquidity transfers to less liquid chains .

The Consensus chain records the liquidity balance on each chain and calculates the contribution of each transaction to liquidity rebalancing through a specific algorithm.

But in reality, the equilibrium state assumed by XY Finance is an average liquidity balance on each chain. The incentive of $XY actually promotes the average liquidity on each chain, rather than pushing it to reach the most reasonable state.

XY Finance Docs https://docs.xy.finance/

4.3 Hyphen (Biocomy)

Hyphen is SwapBridge launched by Biconomy. Biconomy was established in 2019. It was an early project involved in solving the pain points of transfers from Layer2 to Layer1. In addition to greatly shortening the transfer time, it also proposed a "Meta Transactions" solution to solve the gas problem on the chain. The problem of expensive fees is that the essence of meta-transactions is to allow dApp developers to pay transaction fees on behalf of their users.

Hyphen deploys the LiquidtiyPoolManager contract (hereinafter referred to as the LPM contract) on all supported ledgers. All liquidity is stored in the LPM contract. Anyone can deposit into the LPM contract to provide liquidity.

Hyphen's AMT layer is an MPC network composed of execution nodes (Executor Node). When users need to exchange across chains, they will deposit assets into the LPM contract on the source chain. The execution node of the Hyphen network will monitor the deposit event and forward it to the LPM contract on the target chain. After the LPM contract on the target chain receives it, The assets will be released to the target chain address provided by the user. Execution nodes do not need to provide liquidity, all liquidity is in the LPM contract .

Hyphen used the AMM model in its earliest days. But now Hyphen adopts a constant exchange model. On this basis, Hyphen uses a "dynamic fee algorithm" to promote the rebalancing of liquidity.

Dynamic fee algorithm

In Hyphen, in addition to regular gas fees and handling fees, each swap also involves two dynamic fees - deposit rewards and transfer fees .

In Hyphen, each cross-chain exchange is actually composed of two transactions, a deposit transaction on the source chain (the user pays the LPM contract), and a transfer transaction on the target chain (LPM pays the user).

Hyphen will reward every deposit transaction and charge for every transfer transaction.

Hyphen regards the natural distribution of liquidity provided by LP as an equilibrium state when there is no cross-chain exchange. The ongoing cross-chain exchange will redistribute liquidity. The liquidity of some chains is reduced compared to the equilibrium state. Hyphen calls it a liquidity liability state. The liquidity of some chains is increased compared to the equilibrium state. Hyphen calls this a state of excess liquidity .

deposit reward

If the source chain is in a current liability state and the user's deposit behavior actually improves this liability state, then the user will receive a deposit reward, and the reward amount = the user's deposit amount/liquidity liability ratio * the total funds of the IP pool, and the user will receive The maximum reward will not exceed the total funds of the IP pool.

If the source chain is not in a liquid liability state, there is no deposit reward.

transfer fee

When the liquidity of the target chain is in a balanced state or a debt state, if the user wants to continue to transfer on the chain, use the liquidity and increase the liquidity liability, the Transfer fee is between 0.1%-10%, of which 0.1% goes to LP, and the rest will be put into an incentive pool, which Hyphen calls an IP pool. When the liquidity of the target chain is in excess and the user's transactions are not enough to turn it into a liability state, then the transfer fee is 0-0.1%, all given to LP.

On the whole, if the user's swap promotes the rebalancing of liquidity, generally the deposit reward will be greater than the transfer fee, and the transaction will be rewarded as a whole. Otherwise, the deposit reward will be less than the transfer fee, and the transaction will be charged extra.

Hyphen Introduction: https://docs.biconomy.io/products/hyphen-instant-cross-chain-transfers

4.4 Stargate

Launched in March 2022, Stargate is LayerZero Labs' first cross-chain application based on the LayerZero protocol standard, specializing in cross-chain asset transfer.

Stargate, like Hyphen, encourages users and arbitrageurs to balance liquidity through a dynamic fee mechanism, which Stargate calls the "Delta algorithm."

In Stargate, each chain sets a weight for other chains, which is initially set by developers and can be adjusted through governance.

Assume that Stargate supports a total of three chains, namely X, Y, and Z

So:

  • On chain X, there are two weight parameters W(Y) and W(Z)
  • On chain Y, there are two weight parameters W(X) and W(Z)
  • On chain Z, there are two weight parameters W(X) and W(Y)

According to these weight parameters, the liquidity on each chain will be divided into different partitions:

  • On chain X, liquidity will be divided into two partitions, Y and Z.
  • On chain Y, liquidity will be divided into two partitions, X and Z.
  • On chain Z, liquidity will be divided into two partitions, X and Y.

In a swap from X to Y, the user will deposit liquidity into the Y zone of the X chain (Y zone on Think of it as a current debt owed by Y zone on X. Debts appear and disappear as transactions proceed.

If the user's cross-chain exchange transaction is increasing debt, then the user will be charged additional fees; if the user's cross-chain exchange transaction is eliminating debt, then the user will receive a subsidy.

If it is just to implement dynamic fees, there is no need to do soft partitioning of liquidity. **The significance of partitioning is to ensure that the transaction will not fail due to insufficient liquidity after it is submitted, which is the "instant finality" in the "cross-chain exchange trilemma" proposed by Stargate. **Because when X chain and Y chain cross-chain to Z chain at the same time, you only need to judge whether the liquidity of their respective partitions is sufficient. You don’t have to worry about the liquidity in your own partition being seized by transactions from another chain. transaction failed. However, this partitioning scheme seems to have low liquidity efficiency. Suppose there is a large transaction from X to Y. The total liquidity on the Y chain is sufficient, but if the liquidity of the corresponding zone (X zone on Y) is insufficient, the transaction can only be rejected. Is it worth sacrificing liquidity efficiency to ensure that transactions will not fail?

Delta algorithm information is limited, and the author may have a biased understanding. Readers are welcome to contact me for corrections.

Stargate Docs https://stargateprotocol.gitbook.io/

Delta algorithm paper https://www.dropbox.com/s/gf3606jedromp61/Delta-Solving.The.Bridging-Trilemma.pdf

4.5 Summary of this chapter

We see that the core of the constant exchange type SwapBridge design is the liquidity rebalancing mechanism .

In Multichain, there is no liquidity rebalancing mechanism. If there is insufficient liquidity on the target chain during swap, the user will have to receive the reaction intermediate: anyToken to retry the transaction when there is sufficient liquidity;

In XY Finance, the liquidity rebalancing mechanism provides $XY incentives for transactions that promote liquidity rebalancing;

In Hyphen and Stargate, the liquidity rebalancing mechanism is a dynamic fee model. Transactions that promote liquidity balance will be rewarded, and transactions that exacerbate liquidity imbalance will be charged additional fees.

We also found that the projects defined “equilibrium” differently.

In xy Finance, the definition of "balanced state" is the "average state", and the incentives of the system actually push the liquidity on each chain to be equal;

In Hyphen and Stargate, the definition of "equilibrium state" is the natural distribution state of liquidity provided by LP when there are no transactions. Even without rebalancing measures, LPs tend to provide and adjust liquidity more rationally because this can maximize the transaction fees they receive. Therefore, it is reasonable to believe that the natural state of liquidity provided by LPs is a balanced state. of.

5. Order book mode

 5.1 Connext5.2 Hashflow5.3 Orbiter5.4 Orion Bridge

Due to the non-real-time nature of the blockchain, transactions supported by AMM cannot avoid slippage problems and arbitrage by MEV robots. The order book can achieve what you see is what you get, that is to say, before the transaction, the price will Be identified first.

In addition, in the order book mode, the bridge does not need to consider the issue of liquidity rebalancing, and LP will optimize its own liquidity allocation to avoid missing orders. Competition among LPs will also encourage LPs to provide better prices to users.

Therefore, we have seen that some SwapBridge projects adopt the order book model to provide users with asset cross-chain services.

5.1 Connext

When Connext was founded, it was a small but beautiful technical team headquartered in the United States. Its founder, Arjun Bhuptani, was the Co-Founder of Moloch DAO. Connext is funded by the Ethereum Foundation and has the support of some of the top investors in the encryption field, including Polychain Capital, Consensys Ventures, 1kx and other institutions, with a total of US$15.7 million in financing.

Connext, like cBridge, once adopted a transaction model based on local verification (hash time lock), but abandoned this model for the same reason (requiring users to perform two operations, poor experience).

Connext has now completed the Amarok upgrade and started using Nomad as the AMT layer. Or it can also be understood that Connext is a fast channel of Nomad (Nomad itself is a slow channel), and Nomad is the dispute resolution layer of Connext. After the upgrade, its liquidity is still provided by Router and belongs to the order book mode.

The user will first lock the assets in the source chain. After the Router observes this transaction, it will quote a price to the Sequencer. All Routers can quote. If the Router's reserves are insufficient, it can only provide partial liquidity;

**Sequencer is an off-chain role in Connext, responsible for collecting Router's quotes to avoid the Gas waste of Router's on-chain quotes. **Sequencer will select the best quote for the user and publish it to the chain;

The quotation is essentially an unsigned transaction . After being posted to the chain, the user will confirm it. After confirmation, the Router needs to sign it. After signing, the transaction will take effect and the user will receive the payment immediately. If the Router does not sign after being selected, it will Being Slashed.

After about 40 minutes, the user's transaction of locking assets on the source chain is transferred to the target chain by Nomad. Nomad will create a corresponding number of wrap assets and use the local liquidity on the target chain to exchange for its native version, and then pay to advance liquidity. Router.

Since Router's act of advancing liquidity for users generates capital holding costs, it will be compensated by users in the form of cross-chain fees.

There are currently 9 Routers in the Connext bridge to provide liquidity services to users.

Connext docs https://docs.connext.network/

Amarok upgrade https://blog.connext.network/announcing-the-amarok-network-upgrade-5046317860a4

5.2 Hashflow

Hashflow is an emerging SwapBridge with an order book model. The current LP mainly comes from audited market makers. As the audit gradually opens up, more market makers will join. Founder and CEO Varun Kumar graduated with a PhD in aerospace engineering from Stanford University in the United States. Co-founder and CTO Victor Ionescu graduated with a bachelor's degree in mathematics and computer science from the University of Oxford in the United Kingdom. He has served as a senior engineer at Facebook and Airbnb in the past.

Hashflow's investors include many large market-making institutions, and we can foresee that Hashflow will aggregate a large amount of liquidity from them. In Hashflow, LPs provide liquidity by running their own market making algorithms (PMM). Each transaction initiated by a user will have multiple LPs trying to provide liquidity, and users can choose the optimal price to complete the transaction.

Transactions are divided into two steps, namely transaction matching and transaction execution . The transaction matching is completed off-chain. After the user initiates the transaction, the LP will provide a quotation. After the user confirms the quotation, the transaction matching is completed. Transaction execution is completed on the chain, and this process requires the use of the AMT layer for cross-chain message transmission and verification. Hashflow currently uses Wormhole as the AMT layer.

  • It is called LayerZero in some promotional materials, but it is called Wormhole in the official documents.

In order to lower the threshold for providing liquidity, Hashflow has made innovations. LP can create a collective account , into which other users can invest funds to participate in market making. All market making operations are completed by the creator of the collective account.

Hashflow Docs https://docs.hashflow.com/

5.3 Orbiter

Orbiter is a SwapBridge focusing on the EVM ecosystem. In November 2022, Orbiter completed the announcement of its first round of financing. Investors include Tiger Global, Matrixport, A&T Capital, StarkWare, Cobo, imToken, Mask Network, Zonff Partners, etc. The amount of financing was not disclosed. The project party also stated that Vitalik donated 16 ETH to it.

There are two roles in Orbiter, sender and maker. The sender is the person who initiated the transaction, and the maker is the LP. After the off-chain maker agrees to trade with the sender, the sender can directly pay funds to the maker's account on the source chain, and then the maker pays funds to the sender's receiving account on the target chain. However, there is no quotation process. Orbiter only supports cross-chain exchange of homogeneous assets, and the exchange ratio is constant at 1:1.

Orbiter has deployed an MDC contract on each chain, and the maker needs to mortgage funds in the MDC contract on each chain. This is a deposit used to ensure that the maker faithfully performs its contract. If after the sender pays, the maker intends to commit fraud and fails to pay or pays insufficiently, after arbitration confirms the truth, the MDC contract on the target chain will pay the maker's deposit to the sender.

Under this mechanism, there is an upper limit on the amount of a single order that a maker can take, and it cannot exceed its mortgage deposit.

Dispute Arbitration

When the sender initiates an arbitration request, the Orbiter will rely on the SPV contract for arbitration.

Orbiter deploys the SPV contract of the other chains on each supported chain. The MDC contract on the target chain will use the message returned by the SPV contract to confirm whether the sender has made the correct payment on the source chain, and then determine whether the maker has made the correct payment. Fraud.

The SPV contract actually establishes an AMT layer between the various chains supported by Orbiter.

Orbiter Docs https://docs.orbiter.finance/

5.4 Orion Br

Source
Disclaimer: The content above is only the author's opinion which does not represent any position of Followin, and is not intended as, and shall not be understood or construed as, investment advice from Followin.
Like
Add to Favorites
Comments