Skip to main content

Executing Swaps

Recall from Obtaining Quotes that you can experiment with the swap feature without connecting a wallet. However, if you have your wallet connected and click "Get Quote", you will see a slightly different interface shown below:

Connected.

The main difference is instead of seeing "Connect Wallet", you will see a disabled "Execute Multiswap" button. It is disabled because the allocation must sum to 100% and without a recieve token selected, the allocation is 0%.

Now, if you add any pay token, you will see the following:

Insufficient Allowance.

If you increase the amount of the swap so that it exceeds the allowance, you will see the following:

Insufficient Allowance.

Now, add one or more pay tokens and one or more receive tokens as follows:

Multiswap Sample 1.

Note that the total allocation is 100% and the "Execute Multiswap" is enabled. We can execute!

However, all the allocation is currently allocated to the first receive token. Try reducing the allocation to the first receive token to 50%.

Invalid Multiswap.

Now the total allocation is reduced to 50% and the "Execute Multiswap" button is disabled again.

Finally, add 25% to the second pay token allocation and 25% to the third pay token allocation as follows:

Multiswap Sample 2.

We now have a valid quote. Go ahead and execute it!

Confirm Multiswap

A few seconds after executing the multiswap, you should be able to see it confirmed in MetaMask:

Multiswap Confirmed.

Clicking the transaction will bring up the details:

Multiswap Details.

and you can see the transaction of Etherscan by clicking "View on block explored".

Congratulations! You have executed your first multi-asset swap. We'd love to hear from you in our Discord or on Twiiter. Welcome to the CavalRe!