Building Onchain Workflows with LI.FI Composer

ETHGlobal New York 2026 · June 2026 · 12:35

Leonardo Cascianelli of LI.FI introduces Composer, a compiler that turns a declarative JSON flow into a single atomic transaction. He explains why multicall is flaky for chained DeFi steps such as a swap followed by a vault deposit, shows pre-simulated outputs and gas, and demonstrates the TypeScript SDK with a swap and zap flow.

Speakers

Topics

From ETHGlobal New York 2026, hosted by ETHGlobal.

Transcript

Let's start over. Who remembers my name? Hey everyone. I'm Leo from LiFi and today we are sponsoring the composer project for the ETHGlobal hackathon. Composer is essentially a compiler. It allows you to execute complex DeFi strategies in one atomic transaction. The way it works is that you define a declarative flow. This happens in JSON land, so it's a pretty simple interface.

And the idea is that we take this JSON flow and then mangle it a little bit and transform it into something you can execute with one click on chain. Everything gets pre-simulated, so you will also get information about what outputs you're going to get, how much gas you're going to use, and if the transaction is going to fail or not. So many of you might have had the situation before. You wanted to execute a swap, a vault deposit, and then some other operation like a stake or restake of your vault shares.

And often this gets shipped into multiple different flows. And so you have multiple transactions you need to send, and you need to have some sort of coordinator that takes the output of the previous transaction and feeds it to the new transaction. This is kind of a pain, and some people try to solve it using multicall. The issue is that multicall doesn't give you this data flow really. Like you need to hardcode these intermediary values into your calldata, and it's not great when it comes to building flows like this. It's pretty flaky.

So yeah, composer allows you to define this flow in one spot, and then all of the intermediate values get passed on through uh the values operations. As I was saying, everything goes through this JSON specification that we made is essentially a embedded DSL. Um you provide what inputs go in to your transaction and what operations you execute, and then we take care of the rest. Here I created a really simple uh flow that performs a swap and a zap, zap being, you know, you're staking something into a vault. And then I'm going to throw I'm going to go through the various bits to showcase how it actually works. This is the TypeScript

SDK that you can use, but essentially, as long as you can produce JSON out of one of your um preferred languages, you can interact with Composer, no issue. So, yeah, first step of your flow is declaring your inputs. In this case, we are declaring the um wrapped Ethereum goes in. It's a ERC-20 resource. You define how you want to provide this this input into the context of Composer. In this case, I used a direct deposit, aka you have an EOA, you have some weth, and you want to deposit it into Composer context.

The stars of the um of the flow are the nodes. We have two nodes here that um we've created. We have a swap that uh takes the uh weth resource and transforms it into a USDC resource, and then a subsequent operation that we call the zap that allows you to go from um a USDC resource to some staked USDC. You can note here that we also have support for what we call guards. Um essentially, this allows you to have some sort of certainty about what the minimum amount will be when the transaction executes. These are optional, but And a good idea to put them in most of the flows you are going to create.

Um yeah, so there's one thing that I wanted to clarify regarding how composer works, which is the account model. Each signer, so this can be your EOA, a safe, a smart wallet, gets a dedicated user proxy. So, all of the interactions through composer happen in this isolated environment. The idea is that each user has their own. It's deployed automatically if you don't have it yet, and it allows you to not share approvals with other users of the composer product. Once you're inside the user proxy, execution happens through delegate call to our on-chain virtual machine.

The API surface is pretty simple. We have one main endpoint that you communicate to. This is the slash compose endpoint. You post your JSON data flow graph to it. And then you have two metadata endpoints that are interesting to figure out what operations are available. This one is the slash compose slash manifest route. And then the other one is related to zaps. It allows you to know what kind of zapping operations we support. Um yeah, there's some details here regarding how you authenticate with it.

You need an API key. You can get it at portal.li.finance. Sorry portal.li.fi. Um the response you're going to get once you send your flow for compilation contains a bunch of fields. Of course, you get a transaction back. You are responsible for sending this on chain yourself. You also get a list of approvals that are required to execute a transaction. This is a best effort kind of situation. We try to figure out what you might need. And then one of the most interesting outputs is the resources that get produced out of this. Essentially, since this is pretty much Turing complete, you can do kind of whatever.

We try to figure out what are the dangling resources at the end of a flow and they are exposed in the uh response. Um something like this essentially. Um for the hackathon specifically, we decided to go one step further and provide um a bunch new a bunch of new operations that we don't have on the live surface yet and then we kind of tied a demo to it. Um this was a cross venue that migration and the kind of situation that justifies this example is imagine you have a Ave position with this API and you want to migrate to a better position say on Morpho with a better API.

You can do this into uh using composer in one single flow. Um And what's cool about this is that as I show in the slide, a lot of the complexities of using um flash loans which are required for this kind of cross venue migration um are abstracted away for you with this concept that we call materializers. So, this is just a snippet to show you how easy it is to deposit something but also obtain a flash loan for um some funds that you want to use in your flow. So, all you need is just, you know, three lines of code and then that are the complexities taken care for you.

And the migration happens in this kind of three beats. Um you need to you first have an exit, you know, to clear the old position, you repay your Ave debt, you zap to um free your Ave collateral. You enter the new position, you can see that we have two flash loans, one here and one here that are used for um the interaction. And then you settle your flash loan by repaying the the funds that you actually used. As I was saying, all of this functionality um is in preview and is specifically available on the ETHGlobal specific composer deployment. Um all of the SDK surface um you just need to essentially point it to this this URL to have access to to this

new operations. And we support Ave V3, Balancer V2, Morpho, and then ERC-3156 flash loan providers. Um most of you will probably be working on this using agents. Uh we provide a llms.txt and You can just point your agents to this URL and then they're going to figure out how the uh flows need to be built. You can probably take a screenshot of these um slide here. There's also like this QR code. Essentially, we created a repo with 30 plus examples that you can run against our backend to give you an idea of what's available and what's

possible with the with the product. As I was saying, the only thing you need really to interact with this is the API key you can get at um our partner partner portal. We thought about a bunch of things that you can build with this. These are just some examples. Um essentially, you can do as I said, Turing-complete operations. So, we're really interested in seeing what use cases you can come up with. Um we're interested in AI tracks, but also UX tracks and dev tooling tracks.

I'll pause a second for you to maybe take a screenshot of this. Oh sorry. And yeah, so this was a quick presentation. I just wanted to showcase how the interaction pattern looks like for this product. Um if you have questions, I'm going to be at the booth. And yeah, thanks for listening. >> [applause] >> Any questions?

I guess not. Okay, see you later, guys. Yeah so it depends on what kind of surface

you're targeting. If it requires web two interactions, that's a bit more complex. So, but we allow you to target pretty much any smart contract on chain. So, you have all the surface to call any smart contract you want using composer. So, you can use other primitives and also ship your own primitive to call any smart contract on chain. Yeah? Um So, I mean, composer is quite new.

Um we don't have partners building on this just yet. This is kind of like the launch uh the first launch public launch for for the surface. Um we have some partners working on that migration flows. I think that's the most complex one that has a lot of traction probably. Yeah. Oh.

ARC chain, you mean? Okay, so the question is is if composer is available on ARC chain. Unfortunately, no, not yet. We It's in the backlog, but we don't have it shipped yet. Okay. Okay, so the question is is there any white list um when it comes to interacting with third-party contracts?

The answer is no. You can communicate with pretty much whatever contract you want on chain. Okay, I think that's a wrap. Thank you, guys.

Related talks