Anatomy of a Catalyst Swap

Anatomy of a Catalyst Swap

Catalyst is a cross-chain AMM that facilitates atomic swaps between native assets on different blockchains. Catalyst can be deployed on any chain and allows to source liquidity from any other connected ecosystem such as Ethereum, Cosmos and L2s.

But how exactly does Catalyst allow for atomic cross-chain swaps of native assets?

Let's dive deep into the fascinating process of a Catalyst Swap, a crucial feature that enables users to seamlessly swap assets across different blockchains.

Catalyst: A Primer

Before we start, let’s give a refresher on how Catalyst works underneath the hood.

The Catalyst Protocol, like a finely tuned orchestra, harmonizes three essential components: vaults, math calculations, and the state verification router.

Vaults serve as the guardians of assets, securely storing them within each blockchain.

The math calculations component acts as the conductor of the assets, calculating the Unit of Liquidity in order to facilitate the equivalent swapping of assets across chains.

The state verification router uses any arbitrary cross-chain communication mechanism (e.g., interoperability, L2 native bridges, SNARKs) in order to transport a message and verify the validity of a message being received. It ensures that messages are transported securely and their validity is attested.

Origin Chain Process:

Imagine a scenario where Alice wants to swap her ETH on Ethereum for MATIC on the Polygon PoS chain. Let's break down each step of this intricate process.

Alice begins by depositing her ETH into the Catalyst vault on Ethereum. This action reserves her ETH and contributes to the overall liquidity of the pool.

​​Once Alice's ETH is deposited, it's placed in escrow. This ensures that a portion of the vault's liquidity is reserved for her upcoming swap. This reservation prevents other users from utilizing the same portion of liquidity during this process.

The heart of the swap process lies in the calculation of the Unit of Liquidity. This calculation involves determining the proportion of Alice's deposited ETH compared to the total liquidity of the vault. This Unit of Liquidity serves as a critical parameter for executing the swap.

Want to learn more about the Unit of Liquidity and how it’s able to convert between different assets on different chains? Read the deep dive here.

With the Unit of Liquidity in hand, a swap message is generated. This message contains crucial information about the swap, including the calculated Unit of Liquidity. The message is then sent to Catalyst's message router, which acts as a relay for the message to reach the destination chain through any Arbitrary Messaging Bridge (AMB).

Destination Chain Process:

The swap message travels through the chosen AMB to reach the Catalyst vault on the destination chain, which in this case is the Polygon PoS chain.

On the Polygon PoS chain, the Catalyst vault receives the swap message. The Unit of Liquidity is recalculated to determine the proportion of MATIC tokens that Alice will receive from the vault.

Based on the calculated proportion, the appropriate amount of MATIC tokens is withdrawn from the vault and delivered to Alice's Polygon wallet.

Notifying the Source Chain:

A confirmation of a successful swap is then sent back to the Ethereum blockchain via Catalyst’s message router using any AMB/message passing protocol. This indicates that Alice's ETH escrow can be safely placed into a vault, reflecting the completed swap.

While the process is designed to be seamless, there are cases where a swap might fail. Reasons can include the non-inclusion of the cross-chain swap message within a specific time frame or the destination swap amount exceeding Alice's predefined slippage tolerance.

In such instances, the swap message is not delivered, and the swap is considered unsuccessful. The result of this failure is then conveyed to the Ethereum blockchain via the aforementioned aggregated cross-chain mechanism, and Alice's ETH escrow is promptly released back to her.

To reiterate, even in the case of a swap failure, Alice will receive her original assets safe and sound. This differentiates Catalyst from all other cross-chain liquidity protocols where, in the case of a swap failure, the user typically receives an intermediary asset on the destination chain.

In summary, the Catalyst Swap process involves a series of intricately coordinated steps, from depositing assets, calculating the Unit of Liquidity, generating and sending messages, to executing the swap on the destination chain. This mechanism ensures a secure and efficient way for users like Alice to perform cross-chain swaps while maintaining control over their assets throughout the process. It showcases the power of Catalyst in enabling seamless value transfer between different blockchain ecosystems.

About Cata Labs

Cata Labs is a software development company that contributes to open-source technology, including Catalyst Protocol. Cata Labs is backed by prominent investors such as Spartan Group, HashKey, Polygon and Circle. Check out our website here and read more here.

Catalyst Protocol is an AMM purpose-built to connect all chains. Its mission is to empower individuals to acquire any asset on any chain. Using Catalyst, any chain can swap assets with major blockchains like Cosmos, Ethereum and its rollups. Catalyst Protocol is operated by Catalyst Foundation, based in the Cayman Islands. Find out more about Catalyst Foundation at its website. Contact Catalyst Foundation here.