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.
.png)
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
Section titled “AllSwap protocol”AllSwap makes it possible to move and trade assets across chains with the same security and speed that Fast provides.
.png)
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
Section titled “Retrieve and Rank”-
Retrieve
Section titled “Retrieve”AllSwap retrieves the best DEX rates accross all chains.
-
AllSwap ranks the best DEX rates for the user to choose.
-
Send transferClaim and swapIntentClaim
Section titled “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
amt1xAsset 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
amt1xAsset tokens.And this begins the swap workflow.
-
Receive transferClaim and swapIntentClaim
Section titled “Receive transferClaim and swapIntentClaim”AllSet, through its Relayer component, gets notified about the two claims: transferClaim and swapIntentClaim.
-
Relay «Swap intent»
Section titled “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.
-
Send «Swap transaction»
Section titled “Send «Swap transaction»”Once the intent is verified, Fast Contract Y initiates a swap transaction.
amt1yAsset1 to be exchanged foramt2yAsset2.
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
Section titled “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.