Links

Cross-chain Swaps | Symbiosis

Cross-chain swapping with the Symbiosis protocol in a nutshell.
The Symbiosis protocol was born for cross-chain operations. In the beginning, it was cross-chain swaps and bridging; then, we added more functions to our protocol: interchain communicating and cross-chain zaps. This document explains how the Symbiosis protocol handles the cross-chain swap operation that includes bridging (mining/burning sTokens).

Symbiosis Protocol V2

The Symbiosis protocol V2 inherits the logic of cross-chain operations of V1.
Let’s see how cross-chain operations go with the Symbiosis protocol V2. To do so, we should consider three cases:
  1. 1.
    The source and destination blockchains of a cross-chain operation are not S-Chain (Scheme 1),
  2. 2.
    The destination blockchain of a cross-chain operation is S-chain (Scheme 2),
  3. 3.
    The source blockchain of a cross-chain operation is S-chain (Scheme 3).

Case 1: Chain -> Chain

The source and destination blockchains of a cross-chain operation are not S-Chain.
As an example, let's see how a cross-chain swap MATICs for AVAXes goes with Symbiosis V2 (Scheme 1).
Scheme 1: A cross-chain swap MATICs for AVAXes with Symbiosis protocol V2

Case 2: Chain -> S-Chain

The destination blockchain of a cross-chain operation is S-chain.
As an example, let's see how a cross-chain swap MATICs on Polygon for BOBAs on BOBA BNB goes with Symbiosis V2 (Scheme 2).
Scheme 2: A cross-chain swap with the Symbiosis protocol V2 (MATICs on Polygon for BOBAs on BOBA BNB).

Case 3: S-Chain -> Chain

The source blockchain of a cross-chain operation is S-chain.
As an example, let's see how a cross-chain swap BOBAs on BOBA BNB for AVAXs on Avalanche goes with Symbiosis V2 (Scheme 3).
Scheme 3: A cross-chain swap with the Symbiosis protocol V2 (BOBAs on BOBA BNB for AVAXs on Avalanche).
As you can see, the Symbiosis protocol uses a number of liquidity pools to do cross-chain operations. However, only one of these liquidity pools belongs to the Symbiosis protocol: Octopool with {stablecoin, sToken1, sToken2, …sTonenN} set of tokens. Octopool is used to bridge blockchains.

Symbiosis Protocol V1

There are two cases while doing cross-chain swaps with Symbiosis protocol V1:
  • Case 1: a cross-chain swap from a blockchain with a high gas fee (in the USD equivalent) to a blockchain with a lower gas fee,
  • Case 2: a cross-chain swap from a blockchain with a lower gas fee (in the USD equivalent) to a blockchain with a high gas fee.
High/low gas fees. A gas fee is always paid for in the native cryptocurrency of that blockchain, where the transaction gets executed. Thus, when we compare gas prices on different blockchains, we compare them, for example, in the USD equivalent.
As an example, let us consider a pair Ethereum — BNB Chain.
The Symbiosis protocol works with USDC on Ethereum and BUSD on BNB Chain. Since the gas fee on Ethereum (in the USD equivalent) is higher than the gas fee on BNB Chain (in the USD equivalent), the liquidity pool {sUSDC <> BUSD} to perform cross-chain swaps for this blockchains' pair is located on BNB Chain. sUSDC represents USDC of Ethereum on BNB Chain with a ratio of 1:1.
We explain the concept of sToken in the document Wrapped Tokens and sTokens | Symbiosis

Case 1: UNI (Ethereum) -> CAKE (BNB Chain)

Consider an example of a cross-chain swap from a blockchain with a high gas fee to a blockchain with a lower gas fee.
A user swaps UNI ERC20 tokens on Ethereum for CAKE BEP20 tokens on BNB Chain.
The route of UNI to CAKE looks like this: UNI → USDC → sUSDC → BUSD → CAKE
The algorithm of this cross-chain swap is shown in Scheme 4. An explanation follows Scheme 4.
Scheme 4. the UNI → CAKE cross-chain swap with the Symbiosis protocol.
  1. 1.
    The user signs and sends transaction containing instructions for the Symbiosis protocol. Please refer to Developer Tools for more information.
  2. 2.
    The Symbiosis protocol swaps UNIs for USDCs on behalf of the user with the 1inch protocol that guarantees the best price.
  3. 3.
    The Symbiosis protocol locks the USDCs in one of its smart-contracts: Portal.
  4. 4.
    As soon as the tokens are locked on the Portal, another Symbiosis smart-contract BridgeV2 issues an event informing listeners that there is a request for a cross-chain swap.
  5. 5.
    The relayers reach a consensus for this particular event, sign and send a transaction to the destination blockchain (BNB Chain in this case). More information on the relayers is here Relayers Network | Symbiosis
  6. 6.
    The Synthesis protocol on BNB receives information about the swap and mints sUSDC tokens with a ratio of 1:1 to the USDCc deposited on Ethereum (Step 3).
  7. 7.
    The Symbiosis protocol swaps the sUSDC for BUSDs on behalf of the user on a liquidity pool owned by Symbiosis.
  8. 8.
    The Symbiosis protocol swaps the BUSDs for CAKEs on behalf of the user with the 1inch protocol that guarantees the best price.
  9. 9.
    As soon as the swap BUSD → CAKE is accomplished, the CAKEs get deposited to the user's address on BNB.
NB Through all these steps, the user is the sole owner of the swapping assets. The user allows doing these swaps on their behalf to the Symbiosis protocol by signing the transaction in Step 1.
If you are looking for a more detailed explanation of how it works, please refer to Metarouter V3 | Symbiosis

Case 2: CAKE (BNB Chain) -> UNI (Ethereum)

Consider an example of a cross-chain swap from a blockchain with a lower gas fee to a blockchain with a high gas fee.
A user wants to swap CAKE BEP20 tokens on BNB Chain for UNI ERC20 tokens on Ethereum.
The route of CAKE to UNI looks like this: CAKE → BUSD → sUSDC → USDC → UNI
The algorithm of this cross-chain swap is shown in Scheme 5. An explanation follows Scheme 5.
Scheme 5. the CAKE -> UNI cross-chain swap with the Symbiosis protocol.
  1. 1.
    The user signs and sends transaction containing instructions for the Symbiosis protocol. Please refer to Developer Tools for more information.
  2. 2.
    The Symbiosis protocol swaps the CAKEs for BUSDs on behalf of the user with the 1inch protocol that guarantees the best price.
  3. 3.
    The Symbiosis protocol swaps the BUSDs for sUSDC tokens on behalf of the user on a liquidity pool owned by Symbiosis.
  4. 4.
    The Symbiosis contract burns the sUSDCs
  5. 5.
    As soon as the tokens are burnt, smart-contract BridgeV2 on BNB issues an event informing listeners that there is a request for a cross-chain swap.
  6. 6.
    The relayers reach a consensus for this particular event, sign and send a transaction to the destination blockchain (Ethereum in this case). More information on the relayers is here Relayers Network | Symbiosis
  7. 7.
    The Synthesis protocol on Ethereum receives information about the swap and releases USDCs the ratio of 1:1 to the sUSDC burnt in Step 4.
  8. 8.
    The Symbiosis protocol swaps the USDCs for UNIs on behalf of the user with the 1inch protocol that guarantees the best price.
  9. 9.
    As soon as the swap USDC → UNI is accomplished, the UNIs get deposited to the user's address on Ethereum.
NB Through all these steps, the user is the sole owner of the swapping assets. The user allows doing these swaps on their behalf to the Symbiosis protocol by signing the transaction in Step 1.

Cross-chain Swap for BTC

Symbiosis uses the Ren Protocol on BNB Chain and Polygon to perform cross-chain exchanges for BTC. When the Ren Protocol receives renBTCs, it burns them and sends BTCs to the user's address on BITCOIN BLOCKCHAIN.
Thus, Symbiosis acts as the interchain communicating protocol while exchanging for BTC, so please refer to Symbiosis as Interchain Communication Protocol section Exchanging for BTC for more information about this process.

More Information