How to Aggregate Cross Chain Liquidity?
The problem of swapping assets among multiple blockchains is a problem of liquidity. It is necessary to lock and mint, burn and release assets among multiple platforms, as these are usually wrapped tokens that are used to transfer value among blockchains. Each of these require pools of assets that must always provide the required liquidity to fulfill any order at any time.
In the specific case of bridged assets that have the same value, this presents a particular challenge because liquidity providers cannot be incentivized with pricing strategies but with interest-like rewards that can compensate them for leaving their tokens locked for a while. So, guaranteeing the liquidity of a number of assets that compete for the resources of liquidity providers is the key for the implementation of efficient swapping strategies.
Single and Multi-Chain aggregators have been getting traction in the last 12 months, nevertheless most of them seem to be in early (or very early) stages. In general, all of them present themselves–either directly or indirectly — as “liquidity protocols” and this seems to be the quid of the issue: x-chain aggregators’ strategy for bridging blockchains presents a liquidity problem that requires a liquidity solution.
Under this framework, centralization á la Binance present an “easy” solution but comes with the very well-known problem of allowing a single entity to control big amounts of assets, i.e., trusted custodians that manage escrow accounts on behalf of their clients, must rely on trusted server operators’ block headers that could — and eventually will — fail and be compromised either by external or internal malicious actors. These custodians bear the risks of private key loss or theft, which in both cases could lead to loss of control of their clients’ funds. Currently, in a typical implementation, custodians store the majority of their clients’ assets in multi-signature addresses and store the controlling private keys offline. This provides a more secure approach to having private keys stored on internet-connected devices, but the trade-off creates additional operational complexities for parties acting as custodians. All this strikes right into the core of the issue: Centralized custodians need to be trusted.
Conversely, decentralized custodians do not rely on a single point of failure at the top-levels, i.e., they do not need to be trusted. Sadly, this means that they must implement more complex solutions that are hard to generalize, meaning that each pair of assets must be implemented at the time, with each integration having its own particularities and idiosyncrasies, so the bridging can happen unsupervised by a central authority. This is far from just a technical issue, idiosyncratic risk — the part of the total volatility of the asset’s returns that cannot be explained by market returns (Sharpe, 1964, Lintner, 1965) — seems to correlate negatively with liquidity (Spiegel and Wang, 2006) therefore, cross-chain aggregators need to make sure that assets are available on both ends of the swap in very idiosyncratic markets without bonded-rational humans unbarring the markets if they run out of one or more assets.
Thus, existing protocols must implement solutions that address the problem of liquidity, and it has been the current trend, mostly by the implementation of liquidity pools, i.e. smart contracts that lock, burn and release tokens in synchronicity so funds that are moved from one blockchain are locked and an equivalent is released in another one.
What are cross-chain bridges?
A cross-chain bridge is a mechanism that allows tokens to be swapped from their native blockchain to a token on another blockchain. This allows a more flexible usage of tokens such as using bitcoins on programmable networks (e.g., decentralized lending) or swap native assets into wrapped utility tokens.
Bridges offer multiple benefits such as reducing technical complexity with exchange listings or new use cases outside of their respective networks like borrowing, lending and margin (among many other financial use-cases) through synthetic assets. There are many technical possibilities to implement such a bridge, ranging from a completely centralized offering (like Binance Bridge) to decentralized solutions like Harmony’s Horizon.
What are the challenges for a Harmony’s Cross-chain Aggregator?
Currently the focus for Harmony’s Cross-chain Aggregators is on the developments of API’s for exposing services to partners. These interfaces in turn, can be divided in two main different groups:
- The first should address the aggregation of Bridged Assets such as ethBUSD and bscBUSD by providing infrastructure for aggregating liquidity pools for these bridged assets.
- Then, Harmony’s cross-chain strategy could greatly benefit from the implementation of Price Discovery Mechanisms that can identify best pricing strategies for cross-blockchain order fulfillment.
A Cross-chain Aggregator API for Harmony
A basic API design for a Harmony Cross-chain Aggregator should be able to provide the following services:
- Swaps. Endpoints for creating/querying swap transactions, including nominal and real prices, as well as mid price, price impact and slippage, i.e., all the required information for calculating the actual amount that the user will receive and fees for a given swap. This also includes endpoints providing information about the supported tokens and protocols. Ideally it should be able to provide statistical information about swaps activity in the network such as volumes, rewards etc.
- Liquidity. A set of endpoints for liquidity providers transacting with liquidity pools. They should provide functionality to add/withdraw funds to/from liquidity pools, as well as all the information required by LPs to track the availability and performance of the funds added to the pool.
- AMMs. A set of endpoints related to pricing and liquidity in the contracts. The implementation of these services require many updates to the protocol and the creation of new smart contracts. Some of those areas can be greatly improved by innovating, in particular I believe there are some areas where the pay-off could be significantly high.
- Price Discovery. Improved mechanisms for providing the best possible price among the aggregated DEXs could provide a competitive advantage. Swap splits among multiple entities and among different market depths can be improved and perhaps combined with other advanced strategies.
- Bridged-Assets Aggregation. As currently there are multiple cross chain assets pointing to the same liquidity pool, liquidity gets diluted among multiple pools of the same asset. This leads to lower liquidity and higher slippage for swaps. In general, the solution to this problem would require the reduction of the liquidity segmentation through a mechanism that is compatible with the bonding curve.
The Aggregation of Pools
The problem of aggregation of pools is created by the existence of multiple pools of pegged assets originating from different source blockchains, eg USDT bridged from Ethereum and Binance Smart Chain. These pools could eventually provide the required liquidity for the exchange of ONE tokens and a USDT pegged asset (xUSDT). Then, it may be the case that demand for one xUSDT is substantial so that providing the liquidity from a single pool could be either impossible because there are not enough tokens available or inconvenient because the impact of extracting all the tokens from a single pool would generate associated fees (slippage, etc.) that would render the transaction too expensive.
To describe the problem let’s consider a setting in which there is some volume of V units of an asset (in our case a USDT-backed token). The goal is to buy or sell as many of these units as possible at a single transaction, and there are K “pools” in which this buying/selling may occur. Then, the V units can be divided in any way across the pools in service of this goal. The solution then, is to efficiently achieve a near-optimal allocation policy under stochastic assumptions on the pools.
Therefore, a general solution is to provide liquidity for x1USDT using pools of other tokens x2USDT and x3USDT, this would require a infrastructure that either maintain multiple pools, one for each xUSDT asset or a single pool that can handle handle transactions among multiple tokens. Following, it is provided a brief discussion of some of the solutions to the problems based on the type of infrastructure required.
Bridged Assets Pools
A Bridged Asset Pool is a liquidity pool for the swap of USDT-backed stable coins. Where P is the set of all the USDT-backed stable coins, k = |P| and X0,… Xk in P, so there should be one pool for every possible pair of tokens.
This approach even though simple presents a series of challenges:
- There is no guarantee that the allocation of tokens from different pools is efficient, i.e., that it will try to minimize the amount of fees, this will probably require a dynamic approach that is able to consider many different allocations in order to define which is better, this is both an allocation and a price search problem.
- The creation of new pools implies that incentives should be given for liquidity providers to lock tokens in, this not only increases the complexity of the system in general but also increases the chances for diffusion in the form of fees, gas or other inefficiencies. In addition, it is not clear whether it would be better to increase the incentives in the ONE ⇔ Xn pools instead of creating a whole new set of pools, i.e., the creation of new pools might not increase the supply of liquidity for each token. Evidence in dark pools suggests that they can increase liquidity by improving the conditions in comparison with exchanges (Degryse, H., De Jong, F. and Van Kervel,) but in this case, both type of pools (ONE|xUSDT and Bridged Asset Pools) are fully transparent, present no opportunities for arbitrage and will give similar if not equal rewards, so liquidity providers will be indifferent about locking tokens in one or the other and an increase of liquidity in one pool might represent a reduction of liquidity in the other.
Aggregated Token Solution (AT Vault)
An aggregated token solution based on Ethereum balancers would allow for multi-token pools, each with a different and dynamically allocated share of the pool. To route trades, it uses a system similar to Uniswap’s Smart Order Routing (SOR) that intelligently sources liquidity from multiple pools so as to automatically guarantee liquidity among the multiple pairs. This ATV is itself a balancer that groups each pool’s assets under a single vault that holds the assets for all Balancer pools. Therefore, this approach represents a de facto pool of pools, eliminating the necessity of a two-tier liquidity scheme as currently proposed. Poolers receive xUSDT in exchange for pooling their resources and rewarded also in that token, this also allows for other benefits such as zero percentage fees and very low transactional costs. Another benefit of an AT Vault would be the possibility of holding reserves, so if an increase in trading is expected in the near future reserves for both tokens can be created in order to maintain liquidity
In contrast with Uniswap’s Balancers actors cannot be incentivized to keep the portfolio balanced by taking advantage of price arbitrage opportunities, so this AT Vault should balance liquidity by managing fees and rewards between market markets and takers. In addition, more complex instruments like lending should be implemented, so unused tokens can be lent to lending protocols.
A Harmony’s AT Vault, should hold a multi-asset pool with new xUSDT assets that should be frictionless traded by other USDT-backed assets and used to incentivize LPs. At the same time should maintain a pool where ONEs can be exchanged by any USDT-backed asset. This solution presents an innovative approach to managing liquidity, and seems to be able to reduce the friction that comes by using multiple-step swaps while reducing competition among assets. Nevertheless it would require an entirely different approach and the adoption of novel techniques that are still unproven.
Harmony is in the mission of building bridges to facilitate the flow of value among different environments. For this, our API strategy is fundamental, so we are always on the lookout for the best solution to these very complex challenges. As we have seen, liquidity is a pressing issue, therefore we are opening the discussion around some of the potential solutions that seem to be promising because they approach the problem in innovative ways. We hope you can join the conversation.