arrow-right-arrow-leftAllSwap

AllSwap builds on top of AllSet's liquidity layer to enable seamless cross chain swaps. It aggregates decentralized exchanges (DEXs) across networks, identifies the best available rates, and executes swaps instantly, powered by Fast's verifiable claim system.

Figure 1: AllSwap high-level architecture.

This diagram shows how AllSwap benefits from the interactions with AllSet and Fast to provide secure and verifiable swaps. It begins by retrieving and ranking the best DEX rates and forming a swap intent on the source chain. That intent is then relayed through AllSwap, where AllSet verifiers confirm the claim and proof. Once validated by Fast, AllSwap mints/burns the appropriate assets on the destination chain to complete the swap.

AllSwap protocol

AllSwap makes it possible to move and trade assets across chains with the same security and speed that Fast provides.

Figure 2: AllSwap workflow.

AllSwap's workflow can be split into three categories: 1) retrieve and rank, 2) swap, and 3) withdrawal and deposit.

Retrieve and Rank

1

Retrieve

AllSwap retrieves the best DEX rates accross all chains.

2

Rank

AllSwap ranks the best DEX rates for the user to choose.

Swap

1

Send transferClaim and swapIntentClaim

Once the user chooses the desired decentralized exchange, say DEX Y, two claims are sent to the Fast network:

i. A transferClaim specifying that amt1 xAsset tokens have to be transferred from the sender's account to the target chain account (Chain Y Bridge Account).

ii. A swapIntentClaim specifying the swap intent of the same amount amt1 xAsset tokens.

And this begins the swap workflow.

2

Receive transferClaim and swapIntentClaim

AllSet, through its Relayer component, gets notified about the two claims: transferClaim and swapIntentClaim.

3

Relay «Swap intent»

Next, AllSet Relayer forwards the withdraw intent to Fast Contract Y, a contract responsible for the swap transaction on the DEX Y.

4

Send «Swap transaction»

Once the intent is verified, Fast Contract Y initiates a swap transaction. amt1 yAsset1 to be exchanged for amt2 yAsset2. The swap transaction comprises of the following:

  • Withdrawal from the Fast Contract Y, for the swap transaction to be taken place at DEX Y. Hence, this triggers the arrows as represented by W5-W7.

  • Deposit back to the Fast Contract Y, indicating that it is meant to be deposited back to the Sender Account on Fast. Hence, this triggers the arrows as represented by D2-D4.

Recall that yAsset denotes the representation of Asset on chain Y.

Observe that steps S1-S4 are similar to Steps W1-W4 in AllSet's withdraw workflow, with the difference that the intent claim and transaction in last step are now about swapping and not just withdrawing.

Withdrawal and Deposit

The swap transaction triggers a withdraw flow for amt1 xAsset and a deposit flow for amt2 yAsset. Steps W5-W7 and D2-D4 correspond to the homonym steps in AllSet's withdraw, respectively deposit workflow.