Five minutes to understand DeGate Bridge: A cross-Rollup liquidity solution based on the low slippage AMM curve

0

 209 total views

The separation of liquidity between Layer 2 networks is an important issue that needs to be solved. DeGate Bridge proposed a new cross-Rollup liquidity scheme based on the low slippage AMM curve.

Written by: DeGate

There is no doubt that Layer 2 expansion technology can help Ethereum achieve a leap in performance, but the user experience during the exit period and the problem of liquidity separation between different Layer 2 networks are the big tests that must be faced.

The most obvious problem is the time window for Layer 2 assets to exit to Layer 1. Especially for the early Optimistic Rollup network, there is basically a 7-day protection period. This also means that if the user’s second-tier assets need to withdraw to the first-tier, they need to wait 7 days, during which the funds are frozen and cannot be used.

DeGate is one of the teams dedicated to the construction of the Ethereum Layer 2 infrastructure. We have seen that many teams have also begun to work on solutions for the liquidity of Layer 2 assets. Among them are state channels, based on self-built oracles and the introduction of intermediate token bridges. There are pros and cons for each of the implementation schemes.

We feel that the fully decentralized cross-state machine message communication at this stage needs to be verified by a more mature two-layer oracle network. Under the current infrastructure conditions, an excellent and good enough liquidity solution needs to have: First, it can automatically adjust the liquidity distribution of different layers through the market. Second, a non-prepayment scheme with zero capital freezing that can maximize capital efficiency. Third, the lowest gas consumption and the best user experience are also crucial.

DeGate Bridge is a fast channel for cross-layer asset transfer based on the optimization of the stable currency AMM curve and based on the trading market. The first phase of the Bridge will be realized through a centralized custody of assets. When a mature oracle service appears on the Ethereum L2 Later, DeGate Bridge will turn to realize the bridge of assets in a decentralized way.

The architecture diagram of the current DeGate Bridge service is as follows. The current complete functions have been deployed on the Arbitruim V4 testnet, and the experience can be accessed:

The goal of DeGate Bridge is to help reduce the threshold of Ethereum asset migration to the greatest extent in the early stages of the Rollup ecosystem. The service is based on the large-scale implementation of the application of the second-tier infrastructure of Ethereum Rollup. Based on this goal, the existing DeGate Bridge solution is formed.

Optimize the stablecoin curve

The stable currency AMM curve proposed by Curve is very friendly to the exchange of similar asset types, allowing the price to be as close as possible to 1:1, while not drying up liquidity after a certain transaction. And the curve itself supports the exchange of more than two assets in the same pool. We can think that Curve’s stable currency curve is also applicable to the liquidity exchange of similar assets at different Rollup layers.

Let me briefly explain the situations and characteristics of several AMMs. Assume that there are two types of assets in a pool of the same type. Assume that the assets are X in Rollup A and Y in Rollup B.

If the goal is price stability, then the simplest formula is x + y = D. Suppose Alice wants to exchange dx amount of X, then (x + dx) + (y-dy) = D, then dy = y-(D- (x+dx)) = dx. However, the problem is that liquidity will quickly dry up. If there is a current balance that needs to be exchanged for Y or more, then it will not be able to proceed.

If you use Uniswap’s formula, x * y = k, assuming that Alice wants to exchange dx for X, then (x+dx)*(y-dy) = k, so dy = y-k/(x+dx) In this way, there will be no liquidity exhaustion, but the price will fluctuate greatly when the quantities of x and y are unbalanced.

The Curve curve adds a coefficient A on the basis of addition and multiplication.

Five minutes to understand DeGate Bridge: A cross-Rollup liquidity solution based on the low slippage AMM curve

It can be seen from the formula:

  1. When A tends to 0, the price curve tends to the uniswap curve
  2. When A tends to positive infinity, the price curve tends to a straight line

In the Rollups model, especially the Optimistic Rollup’s Layer 2 to Layer 1 require a certain protection period, and Layer 1 to Layer 2 are real-time, so we can roughly judge that in the early days of the network, under the general situation, the same species on Layer 2 Due to the limited liquidity of the assets, the value will be slightly lower than the assets on Layer 1. If Price L1/Price L2 is greater than 1, such as 1.0x, it will lead to an imbalance of the pool funds of Layer 1 and Layer 2, for example, L1:L2=20:180, then the slippage of the transaction will be high at this time, which is not conducive When users complete large transactions, the capital utilization efficiency of the market-making pool will also decrease. The degree of imbalance between the two capital pools here depends on the value of A. First of all, we hope that the value of A is large to improve the efficiency of capital utilization. So we hope to make a certain artificial offset to the formula, so that at the price equilibrium point, such as 1.0x, the real balance ratio is L1:L2=100:100.

So in the specific implementation of DeGate Bridge, we improved this formula and added a b parameter

Five minutes to understand DeGate Bridge: A cross-Rollup liquidity solution based on the low slippage AMM curve

It can be understood by the following simplified formula

Five minutes to understand DeGate Bridge: A cross-Rollup liquidity solution based on the low slippage AMM curve

By adjusting b, a default offset is added to the second-tier assets in DeGate Bridge, so that the price equilibrium point of L1:L2 is not 1, but slightly higher than 1.

So can we conclude that the coefficient b should always be multiplied by the real balance of L2, so that the following scenario we want appears:

  1. When Price L1/Price L2=1, the real balance ratio is L1: L2 = 100: 100/b
  2. At the equilibrium point Price 1/Price 2 = 1.0x, the real balance ratio is L1: L2 = 50%: 50%, that is, equal amounts on both sides.

The “advantage” of non-contractual realization

In the current Ethereum network situation, gas consumption is a problem that cannot be ignored. We have investigated the native asset bridges of most Rollup solutions. In the scenario of assets from Layer1 to Layer2, most of the gas consumption requires hundreds of thousands. For example, Optimism is around 45w, which means that according to the current price of Ethereum, an asset is on Layer2. Need to pay more than 100 US dollars in gas fees. This threshold will greatly hinder the landing of Ethereum Layer 2.

Although we know that the use of smart contracts may have certain trust advantages, there is no mature two-layer state oracle solution at present. Most of the solutions are based on certain security assumptions and trust foundations, in view of the user experience and rates We feel that the use of non-contractual centralization is one of the advantages of asset migration in the early stage of Ethereum Layer 2.

The following will take the comparison of DeGate Bridge and Optimistic Rollup L2 native bridge as an example to illustrate the working principle of L1-L2 Bridge.

For example, Alice wants to convert 1 L1 ETH to L2 ETH, we assume:

1 L2 ETH = 0.995 L1 ETH
DeGate Bridge rate = Curve rate = 0.04%
Gas price = 100 Gwei

Via Optimistic Rollup native channel:

  • Alice sends 1 L1 ETH
  • Alice pays ~45,000 gas for the transaction on L1
  • After the transaction is processed, Alice immediately receives 1 L2 ETH
  • In the end, Alice paid 1.0045 L1 ETH and got 1 L2 ETH
  • L2ETH / L1ETH = 1 / 1.0045 = 0.9955

Via DeGate Bridge:

  • Alice sends 1 L1 ETH
  • Alice pays 21,000 gas for the transaction on L1
  • About 5 minutes later, Alice received 1 / 0.995 * (1-0.04%) amount of L2 ETH from DeGate
  • At the same time, DeGate charges Alice the fee for this L2 transaction: x gas — very low, negligible
  • In the end, Alice paid 1.0021 L1 ETH and got 1.0046 L2 ETH
  • L2ETH / L1ETH = 1.0046 / 1.0021 = 1.0025

In this example, Alice saved ~0.7% of funds at the cost of waiting an additional 5 minutes and trusting DeGate Bridge’s managed operation (which will be decentralized in the future).

Next, we reverse the direction and let Bob convert 1 L2 ETH to L1 ETH:

Via Optimistic Rollup native channel:

  • Bob sends 1 L2 ETH
  • The gas cost Bob paid on L2 is very low and can be ignored
  • 7 days later, Bob receives 1 L1 ETH on L1 and pays ~61,000 gas for this
  • In the end, Bob paid 1 L2 ETH and got 0.9939 L1 ETH

Via DeGate Bridge:

  • Bob sends 1 L2 ETH
  • The gas cost Bob paid on L2 is very low and can be ignored
  • About 5 minutes later, Bob received 0.995 / 1 * (1-0.04%) amount of L1 ETH from DeGate
  • At the same time, DeGate charges Bob the fee for this L1 transaction: 21,000 gas
  • In the end, Bob paid 1 L2 ETH and got 0.9925 L1 ETH

In this example, Bob pays an additional cost of ~0.14%, reducing the original 7-day waiting period to 5 minutes. In the process, Bob also needs to trust DeGate Bridge’s managed operation.

Completely decentralized

Why didn’t DeGate Bridge be implemented in a decentralized manner from the beginning, so that the fund pools on L1 and L2 are managed by smart contracts?

The reason is very technical: L1 and L2 are independent state machines, the state of L1 can be immediately passed to L2 through the native channel, and L2 can fully trust the message, because the security of L2 itself is dependent on L1; and The reverse is not possible, that is, when the state based on Optimistic Rollup L2 is passed to L1 through the native channel, L1 cannot trust the message immediately, but has a certain waiting period, which is for potential occurrence Challenge to leave enough time to stop and correct potential cheating on L2.

The decentralized realization of DeGate Bridge relies on a reliable and mature oracle that transmits quasi-real-time messages from L2 to L1. When such an oracle appears, DeGate Bridge will be able to initiate a decentralized upgrade, and DeGate Bridge will also Get the characteristics of decentralized products:

  1. The Bridge fund pool does not have an Admin Key, that is, no one can misappropriate users’ market-making funds in any form;
  2. Anyone can use the open source code of DeGate Bridge’s interactive interface to deploy the interactive interface by themselves and access the DeGate Bridge protocol.

Before the decentralized version is fully deployed, the fund pool will be jointly established by DeGate Home Dao and community partners. If a fund security problem occurs, all assets of DeGate Home Dao will be guaranteed and paid.

Outlook

We hope that through the deployment of DeGate Bridge, we can efficiently help the Ethereum Layer 2 ecosystem to be implemented more quickly. We also look forward to and are willing to establish cooperation with the Ethereum community ecological project to establish cross-layer channels for more diverse assets.


Attachment: DeGate Bridge testnet function (deployed with Kovan and Arbitrum V4 testnet)

1. Visit DeGate Bridge

Five minutes to understand DeGate Bridge: A cross-Rollup liquidity solution based on the low slippage AMM curve

2. Obtain the test token KUSD (ERC20) through the faucet Faucet, or jump to the faucet page to obtain the ETH on KOVAN as the test GAS.

Five minutes to understand DeGate Bridge: A cross-Rollup liquidity solution based on the low slippage AMM curve

3. After tens of seconds, you will get 100 KUSD from the KOVAN network and KUSD from the Arbitrum testnet.

Five minutes to understand DeGate Bridge: A cross-Rollup liquidity solution based on the low slippage AMM curve

4. First choose to redeem 20KUSD from Kovan network to Arbitrum, and the redemption process will start after signing

Five minutes to understand DeGate Bridge: A cross-Rollup liquidity solution based on the low slippage AMM curve

5. After the order is initiated, the current status of the transaction can be clearly seen in the order details. The transaction will be confirmed by this layer and sent by the target layer. The cost of all the processes will also be listed. The entire process is about 5 minute

Five minutes to understand DeGate Bridge: A cross-Rollup liquidity solution based on the low slippage AMM curve

6. At the same time, you can also try to reverse the KUSD on Arbitrum to the Kovan network, because you need to initiate a transaction on Arbitrum, Metamask will automatically pop up a prompt to add the Arbitrum network and complete the switch

Five minutes to understand DeGate Bridge: A cross-Rollup liquidity solution based on the low slippage AMM curve

7. After completion, you can check the historical order records on the homepage

Five minutes to understand DeGate Bridge: A cross-Rollup liquidity solution based on the low slippage AMM curve

Let’s block ads! (Why?)