🎃How does OmniBTC work?

Omnichain Swap

To realize omnichain swap,we use two communication protocols,Maker Margin Contract(MCC) and Stargate protocol based on Layerzero.

The omnichain Swap can be divided into,

  1. The exchange of different tokens in the same chain. For example,Alice swapped 1 ETH for 1200 DAI on Ethereum in one single transaction.

  2. And the exchange of different tokens between any chain. For example,Bob swapped 1 ETH on Ethereum for 5 BNB on BSC in one single trasaction.

For the former, OmniBTC completes the swap by calling DEX on-chain. For the latter, we divide the realization path of cross-chain transaction into two kinds by dividing the amount of cross-chain transaction funds of users.

For small-fund users,

we have introduced Maker Margin Contract,used to deposit the excess margin of small-fund market Makers and ensure users to receive fund. After the user initiates a cross-chain transaction request, the relevant parameters will be packaged into mag and sent to Maker, which will directly transfer specified assets on destination chain. If Maker fails to transfer assets in time, the user can initiate arbitration to the contract itself. After verification, the contract will directly send the assets back to user.The send-back assets come from the Maker's margin.The amount of calculation involved in this path is very low, so the cost borne by users is also very low.

The specific process is as follows,

  1. At first, Makers need to deposit the excess margin in Maker Margin Contract(MMC).

  2. User sends a cross-chain swap request, the relevant parameters will be packaged into mag and sent to Maker.

  3. Maker transfers the specified assets to user directly on destination chain.

  4. User can initiate arbitration and provide Tx on source chain to MMC if he doesn't receive final assets in time.

  5. Then, MMC will set this arbitration as a pending case and wait for the Maker to provide the Tx on destination chain for 0.5-2 hours.If Maker can provide a correct Tx and the Txmatches the Tx on source chain,MMC will close this arbitation and show the Tx to user.

  6. However, if Maker cannot provide the relevant Tx after 0.5-3 hours, MMC will send the tokens back to user on the destination chain.The send-back tokens come from the Maker's margin.

For large-fund users,

we provide a novel resource calculation algorithm. We provide a novel resource calculation algorithm,which partitions users' cross-chain assets into slices after calculating slippage and service fee.Then,the slices will be respectively swapped in different DEXs on both of source chain and destination chain(just one click for users) to ensure that users can get the assets on destination chain with the best price and lowest slippage.Even if there is something wrong with one DEX in a certain chain, as long as most DEXs are still running normally, users can receive their cross-chain assets with the lowest risk and the lowest slippage in the current market.

The specific process is as follows,

  1. Alice wants to swap 100,000 LINK on Ethereum for Doge on BSC and she sends the assets to our contract A on source chain with one click.

  2. After calculating the slippage and service fee in every DEX on source chain by the algorithm,the contract A divides the assets into two parts,per part is about 50%(Just a general number in this example).

  3. Then the two parts are swapped for USDT in Uniswap and Balancer perspectively,here the first step is completed.

  4. Then the contract A will calculate the slippage and service fee in DEXs on destination chain, and the relevant parameters are updated and packed in a mag.

  5. The msg will be sent to another contract B on destination chain,and contract B will execute the instructions according to the msg. The contract B will swap 70% of the USDT for Doge in Pancakeswap and swap the rest of the USDT for Doge in Biswap. After deducting service fee,the remaining Doge will be sent to the user.

  6. Finally, the relevant parameters in contract B will be updated after executing.

BTC Omnichain Lending

As shown in the figure, we will integrate the lending agreement (MakerDAO agreement) and LayerZero agreement on ChainX, and establish our own stablecoin pool on each chain. In this way, the user first supply BTC to the Bitcoin Taproot multi-sign address of ChainX network to obtain the cross-chain asset XBTC.

Then, XBTC is locked in the vault created according to MakerDAO protocol, and the LayerZero endpoint contract on ChainX chain is called to generate the log. After verifying the MT messages of Oracle and Relay, the contract on destination chain issues the corresponding stablecoins to users. In addition, providing liquidity to the pool of stablecoins on each chain will get the stablecoins as the interest paid, and the rate of return is expected to be higher than the market average.

Last updated