โ๏ธxChain Zaps
LI.FI xChain Zaps
One of the most requested features by the projects we talk to at LI.FI is cross-chain contract calls, to execute another transaction after bridging the tokens. We believe itโs a game changer as it allows much more composability across chains. So, now, FINALLY! Itโs here! The cross-chain contract calls, and weโre calling them xChain Zaps!
Contact our business partnerships team to discover how you can partner with us and integrate LI.FI into your platform.
What are xChain Zaps?
One of the limitations of a multi-chain future is the siloed nature of blockchains and transactions. LI.FI can batch as many transactions as a block allows inside a particular chain, but it wasnโt possible to batch transactions across two different blockchains until now.
To be honest, weโve been batching cross-chain transactions since the beginning, but to only a limited capacity. We had this exclusive feature at LI.FI called โdestination swaps.โ First to the market.
In a normal any-to-any cross-chain swap, to swap AAVE on Polygon to OP on Optimism, we have to swap AAVE to USDC on Polygon, bridge USDC across to Optimism, and swap USDC to OP on Optimism.
In a normal any2any cross-chain swap, converting AAVE on Polygon to OP on Optimism requires the following steps:
Swap AAVE to USDC on Polygon
Bridge USDC to Optimism
Swap USDC for OP
You canโt sign the DEX swap transaction on Optimism from Polygon, so you usually have to switch the RPC and sign another transaction. But with LI.FI, you could do all three things in a single transaction on Polygon!
How? We achieved this by passing the destination swap contract call data through a bridge to execute the final swap for the user and then sending the swapped tokens to the user. Initially, we achieved this through Connext. Now Stargate also supports the destination swap feature, with many more bridges coming soon.
Introducing LI.FI xChain Zaps
Weโve extended that destination swap feature to support contract calls of any kind to be passed through bridges to be executed on the destination chain. Itโs now possible to perform any action on the destination chain after bridging, along with swapping.
How does it work?
When you request a route from LI.FI SDK for a cross-chain swap, you can pass the contract call data through the SDK as an extra parameter. If this data is passed, only the bridges that support cross-chain contract calls will be used for bridging. The bridges that support this right now include:
Connext (
amarok
) - In prodStargate - In prod
CelerIM - In prod
deBridge - Yet to integrate
With these bridges, we could bridge and do contract calls on almost all chains we support.
Once we pass this data onto the bridges, the bridges make the contract calls on the destination chain. Also, the bridges will pay the gas fee for these transactions by taking a cut in the original token bridged. For example, Connext has a relayer fee that helps relayers pay the gas fee.
Howโs it a game changer?
xChain Zaps have introduced the possibility of transaction batching. This concept is pivotal in abstracting the various opportunities users have in web3. Hereโs how transaction batching will benefit all users:
xChain Deposits
Deposit directly in a pool from any asset on any chain.
1. Deposit into Yield Aggregators
One of the biggest use cases in DeFi right now is depositing your funds into a pool to earn. Thousands of people deposit into pools every day. But depositing into a pool on an L2/alt L1 chain is the hurdle here. You must bridge your funds to the chain and deposit them into the pool.
As a project on an L2 chain, you already have to work hard to get users onto your dApp from Twitter/Discord. And, even after getting someone onto the platform, the user might still have to figure out how to bridge to the chain or ask the server for the best routes โ making the user journey far from ideal.
Imagine if the user could just choose their token on their chain and just click Deposit and enter your pool in 3 clicks. In the backend, LIFI searches for the best route among a large array of possibilities, and once chosen, funds will be inside the pool in a matter of minutes.
And thatโs why xChain Calls are a game changer.
2. Deposit into Derivatives Trading Platforms
Derivatives trading is becoming a major use case in the L2/alt L1 chains because of their cheap gas fees, security, and fast/instant confirmation on alt L1s/Optimistic Rollups. Many full-time traders donโt have time to research bridges to deposit USDC/ETH to start trading. Traders only care about locking in their positions as quickly as possible. If trading on decentralized platforms is harder than entering your credit card and trading, what are we even offering here?
With xChain Deposits, the user can select any asset on any chain and deposit USDC/ETH into the trading contract in a single transaction.
xChain Payments
3. Buy an NFT from any chain
NFTs have onboarded millions of users to Web3, and most users that enter the space through NFTs are not very DeFi savvy. Asking them to figure out bridges and DEXs before they can buy an NFT on L2 chains is a tough user journey, and they wouldnโt want to wait or get stuck while buying NFTs.
With xChain Zaps, a user can select any token on any chain as a mode of payment and buy the NFT in a single transaction. This is the web3 user experience that can trump any Web2 user experience.
As bridges become faster and cheaper daily, this experience will be seamless with LI.FI, this whole thing can be abstracted away from the end user.
Other use cases
4. Lending Platforms
5. LP Farming
You get the pattern.
Cross-chain Deposit into any Contract
Get Started
You can currently try this out here. We are working with a few projects to pilot this feature, and weโll update this page as those integrations go.
Happy Hacking!
Last updated