🔄FIBER Router

FIBER Router is the single point of contact with the MultiSwap Fund Manager and is responsible for the movement of assets from user wallets to Dex Routers and/or to the Fund Manager and vice versa.

Thanks to the FIBER Router, no wallet or smart contract directly interacts with the Fund Manager providing additional layers of separation for any attack vectors targeting the liquidity stored in the Fund Manager.

Requests from FIBER Engine

The FIBER Router receives requests from the FIBER Engine and processes them according to the requirements of each given request. These can include swaps for Foundry Assets, Refinery or Ionic Assets, or even liquidity-related events.

Foundry Asset swap requests for FIBER Router

When the FIBER Router receives a Foundry Asset swap request from the FIBER Engine on the source network, it takes the requested Foundry Asset tokens out of the user's wallet and deposits them in the Fund Manager while sending the Fees to the Fee Manager if this is a fee-enabled transaction.

On the destination network, when the FIBER Router receives a Foundry Asset withdrawAndDeposit request from the FIBER Engine, it takes the requested Foundry Asset tokens from the Fund Manager and deposits them in the destination wallet provided in the request.

Refinery Asset or Ionic Asset swap requests for FIBER Router

When the FIBER Router receives a Refinery Asset or Ionic Asset swap request from the FIBER Engine on the source network, it takes the requested Refinery Asset or Ionic Asset tokens out of the user's wallet, moves them to the FIBER Router, then initiates the relevant DEX or Aggregator swap of this Refinery Asset or Ionic Asset to a Foundry Asset. Once the swap is completed, the DEX or Aggregator router deposits the Foundry Asset into the FIBER Router. The router then deposits these tokens into the Fund Manager while sending the Fees to the Fee Manager if this is a fee-enabled transaction.

On the destination network, when the FIBER Router receives a Refinery Asset or Ionic Asset withdrawSwapAndDeposit request from the FIBER Engine, it takes the requested Foundry Asset tokens from the Fund Manager, deposits them in the FIBER Router, then initiates the relevant DEX or Aggregator swap of this Foundry Asset to the requested Refinery Asset or Ionic Asset. Once the swap is completed, the DEX or Aggregator router deposits the Refinery Asset or Ionic Asset into the FIBER Router. The router then deposits these tokens into the provided destination wallet.

The flow of a MultiChain swap

Any MultiChain swap begins with a multiChainSwap call to the FIBER Engine. After receiving the multiChainSwap request, the FIBER Engine conducts a series of checks to categorize the source and destination assets involved in the swap. The Example of Asset Categorization section covers these checks in detail.

📂Example of Asset Categorization

Example swap scenarios

After the assets on the source and destination network are properly categorized, and the optimal route for the swap has been determined by the FIBER Engine, it sends the request to the FIBER Router to execute the necessary transfers. We will cover those transfer scenarios in detail now.

The scenarios include

  1. Foundry Asset to Foundry Asset Swap

    1. 100 USDC on Ethereum to 3,164.5569620253 FRM on BSC

  2. Foundry Asset to Refinery Asset Swap - In Progress

    1. 100 USDC on Ethereum to 0.345793423 BNB on BSC

  3. Foundry Asset to Ionic Asset Swap

    1. 100 USDC on Ethereum to 20.5912 XVS on BSC

  4. Refinery Asset to Foundry Asset Swap

    1. 0.345793423 BNB on BSC to 100 USDC on Ethereum

  5. Refinery Asset to Refinery Asset Swap

    1. 0.06422277597 ETH on Ethereum to 0.345793423 BNB on BSC

  6. Refinery Asset to Ionic Asset Swap

    1. 0.06422277597 ETH on Ethereum to 20.5912 XVS on BSC

  7. Ionic Asset to Foundry Asset Swap

    1. 20.5912 XVS on BSC to 100 USDC on Ethereum

  8. Ionic Asset to Refinery Asset Swap

    1. 20.5912 XVS on BSC to 0.345793423 BNB on BSC

  9. Ionic Asset to Ionic Asset Swap

    1. 896.059 ALPHA on Ethereum to 20.5912 XVS on BSC

Foundry Asset to Foundry Asset swap request

Example: 100 USDC on Ethereum to be swapped for FRM on BSC

First, let's go over how these were categorized.

The source and destination assets have been categorized as Foundry Assets by the FIBER Engine, as demonstrated in the flow above. The FIBER Engine will now send a command to the FIBER Router to transfer the funds in accordance with the following optimal path.

Foundry Asset to Refinery Asset Swap

Example: 100 USDC on Ethereum to 0.345793423 BNB on BSC

Let's go over how these were categorized.

The source asset has been categorized as a Foundry Asset, and the destination asset has been categorized as a Refinery Asset by the FIBER Engine, as demonstrated in the flow above. The FIBER Engine will now send a command to the FIBER Router to transfer the funds in accordance with the following optimal path.

To be continued - Optimal Path FA to RA

Last updated