Our activities at Composable Labs demonstrate a symbiotic relationship between Composable Finance’s XCVM and the pallets we are building. Pallets benefit from the XCVM as an orchestration layer, and the XCVM benefits from the foundational DeFi infrastructure provided by pallets. When utilized together, the XCVM and our pallets allow for the creation of robust, modular cross-chain applications. This unlocks new benefits for users and developers alike which we will explore further in this article. First, a look at how this is even possible.
How does Composable’s XCVM work?
Composable Finance’s Core team designed and implemented a pallet module of the XCVM on Picasso which is referred to as Pallet-XCVM. The Pallet-XCVM module communicates with the XCVM instruction sets to define interactions between Pallet-XCVM and other satellite smart contracts within the Polkadot, Cosmos, and EVM ecosystems. You can think of Pallet-XCVM as the Substrate extension of a satellite smart contract. However, satellite contracts are a novel concept still gaining roots. Let us dig in further.
What are satellite smart contracts?
Satellite smart contracts are necessitated by the fact that each ecosystem often has its specific way of contract calls and execution. Take the case of a token swap on Ethereum, this happens differently when compared with a token swap on Kusama. The same goes for a token swap on Cosmos, different from the prior. The lack of generalizability on how specific instruction sets are accomplished within each ecosystem poses a challenge to decentralized application (dApp) developers looking to orchestrate cross-chain communication for their dApps or protocols and ultimately mass adoption.
When we mention satellite contracts we are referring to the gateway, router, and interpreter implementation on each blockchain connected to the XCVM. You can read more about these in the official specification for the XCVM. In short, satellite contracts handle the specificities of each ecosystem they are deployed on, i.e, think of them as translators who take instructions from the XCVM and execute them in the native language of their ecosystems.
Through satellite contracts, the XCVM is able to provide developers with a generalized toolset capable of executing instructions on a variety of chains asynchronously. This benefits us at Labs because it allows XCVM developers to call into our pallets from any ecosystem connected to the XCVM. Thus greatly increasing the reach of our pallets.
To accomplish this, Composable Finance’s Core team writes these satellite contracts in the respective language of each ecosystem. These satellite contracts may take the form of a pallet in Substrate, Cosmos SDK module in Cosmos, or a set of smart contracts on an EVM-based chain. However, the core functionality remains the same with a gateway, router, and interpreter implementation on each chain. A good way to understand this is by demonstrating it with an example of the typical lifecycle of an average XCVM program.
- A developer creates an XCVM program using CosmWasm. Think of this program as a book with pages and each page with lines. The pages themselves will be distributed to XCVM instances across different chains. The lines that make up these pages represent instructions from the XCVM instruction set.
- The book is then submitted to the Pallet-XCVM module on Picasso.
- Upon submission, the Pallet-XCVM module starts reading the book and translating its specified pages to Substrate, executing each line on Picasso.
- Once the Pallet-XCVM module finishes translating its assigned pages, it removes the pages it has translated and passes the program on to the next satellite contract(s).
- This process is repeated until there are no instructions left and the original goal of the CosmWasm developer has been achieved.
As mentioned above, Pallet-XCVM functions as the Substrate equivalent of a satellite smart contract. However, since there are not any smart contracts on Kusama as of yet, the Pallet-XCVM module is instead embedded directly as a pallet into the runtime of our Picasso parachain. This allows the Pallet-XCVM to house the necessary gateway, router, and interpreter implementations required to interpret XCVM instructions in a Substrate environment. The main benefit of this pallet implementation for us at Composable Labs is that it makes it possible for XCVM developers to call into our pallets from their CosmWasm smart contracts.
How can developers leverage Labs’ pallets through the XCVM?
Developers utilizing the XCVM will be able to leverage all of the functionality implemented into our pallets through their CosmWasm contracts. To ensure this, we have been building pallets to provide all of the common DeFi functionality users are familiar with. Through Composable Labs’ various pallet offerings developers will be able to leverage:
- Angular, a cross-chain money market
- Instrumental, our cross-chain strategy hub
- Whirlpool, a suite of on-chain privacy solutions
- And more to be announced…
The interaction between our pallets and the XCVM can be seen below:
Each pallet serves a unique purpose within our ecosystem. However, when combined with the XCVM, these pallets can be leveraged to create novel cross-chain solutions. For example, an XCVM developer could create a cross-chain interest rate arbitrage contract by combining Pablo, Angular, and Mosaic. Doing so gives rise to borrowing DAI for an attractive rate on Ethereum, an arbitrage opportunity when swapping DAI for USDC to lend on Cosmos. All this while the user is holding aUSD on Picasso.
By calling into our underlying pallets you open up new opportunities for arbitrage that could look something like this:
- Aggregate current opportunities available on Angular
- Identify arbitrage opportunities (in this case, borrow DAI on Ethereum)
- I don’t have collateral on Ethereum but I have aUSD on DotSama. Swap aUSD to DAI using our cross-chain DEX, Pablo, which in turn utilizes Cubic’s cross-chain asset vaults
- Bridge your DAI from Picasso to Ethereum utilizing Mosaic
- Borrow the funds using Angular
- Bridge back to Picasso
- Swap borrowed funds for USDC using Pablo
- Bridge USDC to Cosmos using Centauri bridge
- Lend using Angular
The interaction between the XCVM and pallets within our ecosystem is an incredibly powerful tool for CosmWasm developers to develop cross-chain applications. Composable Labs is excited to see what new possibilities developers can spin off as they begin to leverage the pallets we are building in their XCVM applications. We are hands-on and ready to give technical support where necessary.