DeGate- Cross-rollup Liquidity Solution Based on Low Slippage AMM Algorithm
$GCR is a Tokenized Community of Researchers and Investors in the crypto space. Join our community today to get access to all the best investments ideas and deal flow, workshops and direct access to founders and key players in the space.
The fragmentation of liquidity between Layer 2 networks is an important issue to be addressed and DeGate Bridge has proposed a new cross-Rollup liquidity solution based on a low-slippage AMM algorithm.
There is no doubt that Layer 2 scaling technology can help Ethereum achieve a leap in performance, but the user experience during the exit phase and the fragmentation of liquidity between different Layer 2 networks are the big challenges that must be faced.
The most obvious problem is the time window when the assets of Layer 2 exit from Layer 1, especially for the early Optimistic Rollup networks, which had a 7-day protection period. This means that if a user needs to exit their Layer 2 assets to Layer 1, they need to wait 7 days, during which time the funds are frozen and cannot be used.
DeGate, as one of the projects working on the Ethereum Layer 2 infrastructure, has seen several teams working on solutions for Layer 2 asset liquidity, including implementations via state channels, based on self-built oracle or an intermediary relay token. Each has its pros and cons.
We think that fully decentralized cross-state machine message communication at this stage needs to be validated by a more mature network of Layer 2 oracle. A good and sufficiently good liquidity solution at this stage of the infrastructure needs to have: firstly, the ability to automatically adjust the distribution of liquidity across different layers through a market approach. Secondly, a non-prepayment solution with zero capital freeze to maximize capital efficiency. Thirdly, minimal Gas consumption and an optimal user experience are also essential.
DeGate Bridge is a fast channel for cross-layer asset transfer based on the optimization of stable coin AMM curve and the way of the trading market. The first phase of the Bridge will be realized by the way of centralized managed assets. When the mature oracle service on L2 on Ethereum appears, DeGate Bridge will migrate towards bridging assets in a decentralized manner.
The current architecture of the DeGate Bridge service is shown as follows. The current full function has been deployed in the test network of Arbitruim V4 version and can be experienced at :
DeGate Bridge’s goal is to help minimize the barrier to the migration of Ethereum assets in the early stages of the Rollup ecosystem. The existing DeGate Bridge solution is based on this goal to serve the massive adoption of Ethereum Rollup’s Layer 2 infrastructure.
Optimizing the Stablecoin Curve
The stablecoin AMM curve proposed by Curve.fi is friendly to convertibility among in-kind assets, keeping prices as close to 1:1 as possible without drying up liquidity after a single transaction. Moreover, the Curve itself supports the exchange of more than two assets in the same pool. We can assume that the stablecoin curve is also applicable to the exchange of liquidity for the in-kind assets at different rollups.
Let’s start with a brief explanation of several AMM scenarios and characteristics, assuming a pool with the same in-kind assets in both networks, and that the asset is called X in ROLLUP A and Y in ROLLUP B.
If the goal is price stability, then the simplest formula would be x + y = D. Assuming Alice wishes to exchange dx amounts of X, then (x + dx) + (y – dy) = D, so dy = y – (D – (x + dx)) = dx. However, the problem with this is that liquidity can quickly dry up if there is a need to exchange a current balance greater than or equal to Y, then this cannot be processed.
If we use the Uniswap formula, x * y = k, and assume that Alice wants to exchange dx amounts of X, then (x+dx)*(y-dy) = k, so dy = y – k/(x+dx), which does not run out of liquidity. But the price would fluctuate a lot when the quantity of X and Y is unbalanced.
Curve, on the other hand, adds a coefficient A based on addition and multiplication
As can be seen from the formula:
1. As A approaches 0, the price curve tends to the Uniswap curve
2. As A tends towards positive infinity, the price curve tends towards a straight line
However, in the Rollups model, especially the Optimistic Rollup’s Layer 2 to Layer 1 requires a certain protection period, while Layer 1 to Layer 2 is real-time. Therefore, we can roughly judge that in the early stages of the network in general, the same asset on Layer2 will be worth slightly less than the asset on Layer1 due to limited liquidity. If Price L1 divided by Price L2 is greater than 1, such as 1.0x, this will lead to an imbalance between the pools of Layer 1 and Layer 2, e.g. For pool size, L1:L2=20:180. At this time, the slippage of the transaction will be high, which is not conducive to users completing large transactions and the efficiency of the market-making pool will be reduced. The degree of imbalance between the two pools here depends on the value of A. Firstly, we would like to have a large value for A to improve the efficiency of capital utilization. So we want to make some artificial deviation to the formula so that at the price equilibrium point, e.g. 1.0x, the true balance ratio would be L1:L2 = 100:100.
So, in the specific implementation of DeGate Bridge, we have improved this formula by adding a parameter b
This can be understood by the following simplified formula
By adjusting for b, a default offset is added to the Layer 2 asset in DeGate Bridge so that the price equilibrium point for L1:L2 is not 1, but slightly higher than 1.
So if we can conclude that the coefficient b should always be multiplied by the true balance of L2, allowing the following scenario to emerge that we want:
1. When Price L1/Price L2=1, the true balance ratio would be L1: L2= 100: 100/b
2. When the equilibrium point Price 1/Price 2 = 1.0x, the true balance ratio would be L1: L2 = 50%: 50%, namely the same amount on both sides.
The ‘Advantages’ of Implementation Without Smart Contract
Gas consumption is an issue that cannot be ignored in the current Ethereum network situation. We have researched the native asset bridges of most Rollup solutions, and in the case of asset Layer1 to Layer2, Gas consumption mostly requires more than 100,000 Gas, which means that at the current price of Ethereum, an asset on Layer2 needs to pay several tens of dollars in Gas costs. This threshold will greatly hinder the adoption of Ethereum Layer 2.
Although we are aware that there may be some trust advantages in using smart contracts, there is no mature Layer 2 state oracle machine solution at present. Most of the solutions are based on certain security assumptions and trust foundations. So given the trade-off between user experience and costs, we believe that using a non smart contact centralized approach is one of how asset migration can be advantageous in the early stages of Ethereum Layer 2.
A comparison between DeGate Bridge and Optimistic Rollup L2 original Bridge is taken as an example to illustrate the working principle of the L1-L2 Bridge.
For example, Alice wants to convert 1 L1 ETH to L2 ETH and we assume that:
1 L2 ETH = 0.995 L1 ETH
DeGate Bridge rate = Curve rate = 0. 04%
Gas price = 100 Gwei
Through the native bridge of Optimistic Rollup:
• Alice sent 1 L1 ETH
• Alice paid ~45,000 gas for the transaction on L1
• After the transaction is processed, Alice immediately received 1 L2 ETH
• In the end, Alice paid 1.0045 L1 ETH and received 1 L2 ETH
• L2ETH / L1ETH = 1 / 1.0045 = 0.9955
Through DeGate Bridge:
• Alice sent 1 L1 ETH
• Alice paid 21,000 gas for the transaction on L1
• After about 5 minutes, Alice received 1 / 0.995 * (1 – 0.04%) amount of L2 ETH from DeGate
• At the same time, DeGate charged Alice for this L2 transaction: x gas – very low, negligible
• In the end, Alice paid 1.0021 L1 ETH and received 1.0046 L2 ETH
• L2ETH / L1ETH = 1.0046 / 1.0021 = 1.0025
In this example, Alice saved ~0.7% of her money at the cost of an extra 5 minutes of waiting and trusting DeGate Bridge’s managed operation (which will be decentralized in the future).
Now let’s reverse the direction and have Bob convert 1 L2 ETH to L1 ETH:
Through the Original Access of Optimistic Rollup:
• Bob sent 1 L2 ETH
• Bob paid a negligible amount of gas on L2
• After 7 days, Bob collected 1 L1 ETH on L1 and paid ~61,000 gas for it
• In the end, Bob paid 1 L2 ETH and received 0.9939 L1 ETH
Through the access of DeGate Bridge:
• Bob sent 1 L2 ETH
• Bob paid a negligible amount of gas on L2
• After about 5 minutes, Bob received 0.995 / 1 * (1 – 0.04%) amount of L1 ETH from DeGate
• At the same time, DeGate charged Bob for the L1 transaction: 21,000 gas
• In the end, Bob paid 1 L2 ETH and received 0.9925 L1 ETH
In this example, Bob paid an additional ~0.14% to reduce the waiting period from 7 days to 5 minutes. Bob also needs to trust the managed operation of Degate Bridge during the process.
Fully Decentralized Implementation
Why didn’t DeGate Bridge be implemented in a decentralized way from the start, with pools of capital on both L1 and L2 being managed by smart contracts?
The reason for this is very technical: L1 and L2 are separate state machines, where the state of L1 can be passed immediately to L2 via the native channel and L2 can trust the message completely, as L2 itself depends on L1 for its security. In other words, when the state of Optimistic Rollup L2 is transmitted to L1 through the native channel based on Optimistic Rollup L2, L1 cannot trust the message immediately. Instead, a waiting period is required to allow enough time for potential challenges to occur to prevent and correct the potential cheating on L2.
The decentralized implementation of DeGate Bridge relies on a reliable and mature prophecy machine that delivers quasi-real-time messages from L2 to L1. When such an oracle becomes available, DeGate Bridge will be able to initiate a decentralized upgrade, at which point it will also acquire the characteristics of a decentralized product:
1. Bridge capital pool does not set Admin Key, that is, anyone can not in any form divert users’ market-making funds;
2. Anyone can use the open-source code of DeGate Bridge’s interactive interface to access the DeGate Bridge protocol after self-deployment of the interactive interface.
Before the decentralized version is fully deployed, the capital pool will be guaranteed with all DeGate Home Dao assets to pay out in the event of a financial security issue.
We hope that the deployment of the DeGate Bridge will efficiently help the Ethereum Layer 2 ecosystem to be established faster, and we look forward to working with the Ethereum community to build more cross-layer access to multiple assets.
Addition: DeGate Bridge testnet functionality (deployed with Kovan and Arbitrum V4 testnet)
1. Visit DeGateBridge
2. Get the test token KUSD (ERC20) via Faucet and also get the ETH on KOVAN as a test GAS by jumping through the faucet page.
3.After a few tens of seconds, you will get 100 KUSD for the KOVAN network and KUSD for the Arbitrum testnet.
4. First select the option to exchange 20KUSD from the Kovan network to Arbitrum, then sign and start the exchange process
5.Once the order is initiated, the transaction’s current status is visible in the order details. The transaction will be confirmed by this layer and sent by the target layer in two processes. And all the costs in the process will be listed in about 5 minutes.
6. At the same time, you can also try to reverse the switch from KUSD on Arbitrum to the Kovan network. As you need to initiate a transaction on Arbitrum, Metamask will automatically pop up a prompt to add the Arbitrum network and complete the swap.
7. Once completed, you can check your order history on the home page.