0 to 1 building institutional DeFi

DappCon 2026 · June 2026 · 1:04:14

Topics

From DappCon 2026, hosted by Dappcon Berlin.

Transcript

Oh okay. the agenda.

>> Yeah. So welcome everyone. Um this is the QR

code to scan to enter the telegram group. We will have some docs link there for the tasks we will do in the second part. So how this work workshop is structured is that for the first part we will go through some basic defy concepts and for the part two we will actually do a couple of tasks to execute the defy transactions. So the vision of is to be a unified network to access uh um blockchain and defy protocols.

We started five years ago and we noticed straight away how hard was to build on blockchain networks. Uh it meant to integrate multiple D5 protocols and for every protocol you had to deploy a smart contract. Not only that but for every single protocol lived also in different chains. So you need to take care all the deployment on the script on the maintenance of all that part. we released the file aggregator and soon uh other applications started to ask us access to this uh protocols. So that's why where the modern names started as an API so developer tool where you integrate one single tool and you can access all the defy protocol actions and

uh on every chain this is our core product offering. So we have the execute part. So basically the API provides you uh the cold data and the best route for swaps defy action which is borrowing lending. We're recently releasing is not public yet but is in the docs so you can check it out. Uh we released a flesh loan aggregator and it's basically used by landing markets to create to create looping positions and bridging and aggregator. For the data part, we uh offer APY, APY data, TVL data, the prices and all of this too. It's basically abstract to create a earn product. So the full suite

to build your own uh earn product. We support basically all the defy protocol. uh I think around 100. On top of this, everything is simulated which is uh we will go through later is quite important in blockchain transaction that you simulate uh what third party returns because uh you know like they could you you never know what the call data does. So you need to be sure that uh the transaction that the user will execute does exactly what you expect.

These are some numbers. We have uh a lot of companies using us. uh in the last five years we settled around 20 billions in volume with the biggest three days streak that was uh um for the bar chain launch boy with layer zero was 3.1 billions into uh 805 pools uh in the same day three days um we have uh 13 audits as you can imagine was very expensive and we have some open source tooling that uh Uh it's quite cool. You can check it out in our GitHub. Uh temper is a transaction simulator. Uh basically tenderly but

open source. And the wear which is our core contract which is a smart contract virtual machine to chain transactions. So to start uh we will go through like how many of you know what is a dex aggregator? Okay. I guess I guess mostly everyone. The general idea on how it works and uh then I will go through how we use it uh inside our defy toolkit is that a dex aggregator is basically a graph. Um people put all the pools index the pools put it into a graph and then run algorithm pathfinder algorithms to find the best path from token A to token B.

There are multiple tricks. You split them out and so forth. But this is the core uh concept. There is a layer on top. This is how um we do for swap aggregation which is called metagregator. Um there are some UIs nowadays that offer this. I think the first one was defy lama and uh okra metam matcha things like that. We our API basically metag aggregate uh every single dex aggregator and there are a couple of reason to do that. One uh some aggregators are better than others. Some support RFQS, some supports liquidity sources at other and some are

better optimized for bigger trade or small trades and they have all different gas costs depending on the operation that they chain. This uh uh increases the execution reliability. And the most important part is that uh very often DEX aggregators over quote which means that they promise you to uh return a certain amount but in reality on chain uh this is not true and there is always some sort of delta uh from what uh is quoted versus what is executed. This is why we added a layer on top of this meta aggregation which is quote simulator. So

we perform simulation on uh every response of the DEX aggregator. Then we basically sort to the real amount out and we pick the best one that for the real amount that they return not what they quoted. We recently released a dashboard for this is some is a is basically showing um who are the best and who are the worst. So who basic the overall the the overall idea is basically who simulate their transaction before returning to the users.

Um if I put it like wait let me put it on telegram. If you want to see it it's in the telegram group and shield.ensor.build build uh for example 0x is always one of the uh ones who simulate the transaction. We also illustrate the latency and yeah this is the overall you you can see sometimes quite big numbers sometimes we got even 100% because some aggregator were putting a fee without basically saying to the user. Uh we generally also work with Dex aggregator like if we see some numbers that are too big we try to reach out and say uh to

check certain route and paths. But this I think is an essential tool for everyone who wants to trade on chain and do perform and want to perform um defy actions for the user is that the aggregation part need to be correctly simulated otherwise you can have a huge revert rate or basically uh misleading the user. uh if you want to check it out the website we also have some other performance charts the over quarter rate the simulation rate uh the latency comparison and some uh u outliners like in the last seven days uh this transa like for example bit transaction simulated was

almost 1 million and the delta is basically 51k this is a lab test so we basically take the cold data and simulate it against the latest talk which cover most of the cases. Here you can see some other illustration for it. Um why the DEX aggregator do that is a mix of reason. Sometimes they just use a pure mathematical approach. So everything is pure computation and they don't do u they don't find the best path by simulating. Sometimes it's basically they just want more order flow. So in competition they if the metagregator

doesn't check this they try they basically win order flow or they yeah and in general they don't simulate the transaction. There is another um yeah another another reason that came up lately in the last months which is like toxic pools. Um a lot of a lot of malicious u pools came up especially in protocols that allow to create uh pools with custom behaviors like unis swap hooks and curve pool. Basically these pools are done in a way um that tricks uh transaction simulator.

So generally when people do simulation do a call and they don't set a gas price for example or a coinbase account or a time stamp and this pool put in solidity logic certain checks that tricks the simulator and basically try to scrape as much as possible that the slip slipage from the user. This is an example of us. Yeah. >> Yeah. So >> yeah, this this is an example. Um well I yeah I don't have the code here but uh I I can show you later the code but I can summarize it now. This is a a toxic pool that was on curve u in the last two weeks basically made 120

million volume and stole 60k in fees. Generally when you do a simulation you do an eth call right and it's like taking taking the call data and you and you say okay simulated at latest block and you extract the amount out that this transaction will give to the user. The issue is that out of the box this simulation are uh don't consider a lot of things that are actually unset on chain like the gas price. So some of these pools were encoding in the solidity logic. If the gas price is measured then 10 then apply a fee. So the simulator because they don't set a

gas price was strict and the fee was not counted in this is a >> sorry >> yeah exactly yeah I mean this is like how we kind of solve it is like one what the feature that we added lately is not only gas price like this this malicious attacks are like they change every day but one of the latest feature that we add is uh toxic flow detection which is basically we don't just simulate purely but we start to do state overrides on the request uh overwriting the block or writing the gas price the coinbase account the time stamp because this was just an example

it toxic flow detection but there are some other things like fee based on temp time stamp uh so basically if you make a transa if you get a request you simulate It looks good because you you simulated at this time stamp but in the solidity logic you can say if 10 second pass then apply a fee. So in that case you need to kind of start to spam with simulation with different uh future scenarios to understand and detect if there is some sort of toxic behavior or hidden fee.

Um yeah this was just just an example of a pool in the last uh two weeks but we've seen many on uh on unisapuks and it's and it's very hard I have to say for aggregator to catch all this uh all these malicious pools because it can really uh be anything encoded in solidity we generally report uh these pools to aggregator and they are quite fast on removing it but since we cannot trust always this this responses that's why we added base tox flow toxic flow detection and hidden feed detections.

Uh this is also one of the main feature of that is a standalone tool. So it's you basically can call it with whatever if you have aex aggregator on your app and you want to verify that the behavior is correct you can call the quarter and uh it will automatically top up the balance of the user. So the to simulate uh you don't need that the user has the balance he can just uh we automatically top up uh in the simulation environment the balance of the user you can do batch quoting and yeah the feature that we talked about before uh it's also very very fast so it probably like 200 millisecond and you can batch simulate 10 different dex aggregator responses so

you can pick the best one. Okay. So, I think that's it for the first part. Is there any question? I mean malicious actors. >> Yeah. >> Yes. >> Yeah. Yeah. >> And you don't need a lot of capital essentially because you trick the oracle uh either in the hooks or curve rate or so. So yeah, it doesn't require large capital. just manipulating in a sense

that the oracle Oracle returns higher price than market average aggregator choose that pool and then during execution you get caught >> no not yet I mean it's it's something that I wanted to look into uh especially because lately the number of toxic pool increased a lot um we started to see a lot of fail transaction on all the metagregators. Um and it was mainly what we seen was unis swap hooks and curve pools. Um it will be nice to run some uh some analytics on this. Yeah. Uh yeah, I

think we will something that we will do in the future. Cool. So the second part it's more handsome and it's about building a earn product. It will use the ENSO API uh to create uh the basis. So getting the user balance the data so of the defy position uh so APY and TVL um the route uh actions so you can do uh swaps and defy deposit and the single chain on the on different chains

access uh we are mter for xtos and ono and and soon a couple of other rwa providers and in general defy actions Sorry, we started 15 minutes 15 minutes ago because there was a time change. So in general there are two different types of defy positions. Uh the simple one are tokenized defy positions which means what probably protocols that you know already like a pendle everything that gives you a RC20 receipt and this is it's all available in the

route endpoint because this being a tokenized position you can u use routing which means the aggregator plus a defy to enter a specific position. There are some other more advanced type of positions which are non-tokenized uh which means opening a borrowing position, open an NFT position, deposit without any RC20 receipt, uh a sync vault for example like vaults that either don't allow or don't allow um any everyone to deposit. So they you kind of make the request and then in a second moment they will send you uh the LC20 um for example open call it's a um

insurance wrapper for volts uh in that case you know you you request a deposit uh you stake your request and they will send it to you and all this section are composible uh with the bundle endpoint. So wait since few people joined um I think the time on the agenda was was wrong. We started uh 15 minutes ago. If you want to join now that we will do the task. This is the telegram group.

Okay, this is the first task. Um, it's pretty simple. Just get used to the API. Um, in the Telegram group, there are the uh docs links and uh uh it's basically to create a simple uh defy route Ethereum into a landing pool in this case a Um I think we will leave like five 10 minutes for you to play around and then we will show it uh into the screen here. >> Is there any question?

>> Yeah. Can you see the messages on Telegram? >> Oh, okay. And I will link the dashboard that we talked about in the first section uh on

comparing dex aggregator. For the people who join now just to give a quick recap, we went through the how a DEX aggregator work. Why you need meta aggregation which is basically you cannot trust DAX aggregator and you need to simulate what uh what they what actually they return uh what what they actually return uh for a various reason can be like just miscalculation or they want to get more order flow. Uh we released a dashboard that is testing all the dex aggregators uh that is linked in the telegram chat and uh um we also talked about toxic pool that a lot of these dex aggregator are vulnerable to which means uh pools

that try to fix with solidity logic simulations and uh yeah this is an example of the last two weeks a pool stole 60k in fees uh from dex aggregator routes and because of this we it's not announced yet But we released since a week uh we added toxic flow detection. So when you simulate with our simulator you get the actual return that is already counting in the toxic uh pulse fees. I will go back to the task.

And if if something is not working, just call us and we will come there to to check. I have to make it.

Perfect. I I posted in the chat in the Telegram

group um the end point for that request and I will add the token address in case you didn't find it. >> Sorry. Okay. Okay, I think we can uh move on. Um

Brandon will show now uh basically the task from the from a terminal just to inspect the response and we can see how the first part uh the meta aggregation is used with the uh a defy hook. >> Should I use the mic? >> Yes. >> Yeah. Okay. Um so what do you see on the screen um is essentially the request uh for >> sorry can you zoom a bit maybe I don't know if the streaming yeah okay perfect >> sounds yeah um yeah essentially the request to route from ether to a is a USDT on another v3 um I can just simply

go through each line am I mount in which is in wave value which is one ether in this case token in uh we represent it as u the quote unquote native um address token out is the a USDT um slippage um can be set cannot be set default uh is uh 50 um that we always set for every route from address is the address who is going to execute the route um receiver is also optional you can specify if receiver if you want the funds to land in a different address. Usually it's never the case. It's always uh the same address chain ID one which is the mainet

and then u I'm passing the API key. Um and then uh yeah this is the response um which returns the call data together with gas amount out the price impact of the route uh just to ensure that u unexpectedly the value that you receive is not significantly less than you inputed and the whole transaction object that you uh that user executes and then the interesting part is the route um where essentially you can see two different hops The first one is the swap u from ether to the underlying of USDT which is a USD which is the USDT and then um we take

the whole amount that was produced by the swap and put it into another uh a USDT. That's it. Yeah. So the first part is basically what we seen before with the meta aggregation in this case a northern one. uh the transaction was simulated and then uh there is this defy hook uh you can go the defy hook uh which basically is saying take uh the amount out that was returned from the swap action and uh basically deposit into the other lending market.

>> Yeah. And if you're interested that's the answer that Milos previously mentioned which is open sourced. You can check it out on on our GitHub. uh the cold data you can of course like double verify if we what we return is correct. Um a lot of people like to use standardly for having you know the full UI to simulate. Our type of simulation is a bit different. It's more like very specific and meant to be very fast but for like inspection of the full route as as code uh I can recommend tenderly UI.

Okay. Is there any question on this part? If not, I will move to the second task. I'm I'm assuming everyone will use cloud code. So, it's it's it's more like a prompt that rather than a task. Yeah. Okay.

So the the task two is more like um to show the end to end uh of a earn product how it could look like. Um we have multiple endpoints uh for this. Um I I linked I linked it in the telegram group which is this one. So basically the task is to create a a small UI where the user can connect with MetaMask or Rabi. You can use the balance endpoint to show the user uh balances uh which it's already organized by D5 protocols.

So you can see like when you get to the end point uh after after the we will leave five 10 minutes for the task to for you to play around then we will show it on the screen. Um it it basically organize everything by defy protocol. So if you have another position or you have a pendal position you will see it there. Um the second task the second part of the task is to display uh basically a box where you can show the APY and TVL of the defy position. And the third one is to actually use the one that we used before. So the route to allow the user that is connected to actually execute this transaction.

If you if you want to test on a cheaper network, we support a on every network. So you can just pick B instead of Ethereum. Yeah, that's it. I will leave five 10 minutes um and then we will go through uh again with with code and some UI example here and again if you have any question you can just reach out. >> Yeah. is the protocol sendpoint. Um maybe I can show you.

Yeah, we have a swagger is linked into the telegram chat. So we have a bunch of protocols. Maybe meanwhile I can go through um sorry a bunch of routes uh endpoints. The basic one is the route uh the part that I mentioned before about simple tokeniz tokenized positions like RC20 the non-tokenized route which means um NFTs uh and all the sort of position that are that don't return a receipt token the bundle endpoint sorry >> no I wanted to say best example would be more in that case for non-tokenized >> yeah definitely uh and the bundle endpoint this is meant to use

declarative uh defy actions. So swap plus deposit plus borrow. Um if you want to do it in a certain way or orchestrate your own flow, you will use this uh this endpoint. Going back to the question, there are like all the metadata uh endpoints. So the network that are supported, the prices, um the tokens, uh the non-tokenized positions and the protocols. So you can see for chain ID1, I think it should return all the list of protocols that we return.

Yeah, Xtos and also the chain where these protocols live. So XTO, year, orderly, uh Pendle, there are quite a lot. I mean it's like most of them now they have zero TVL uh but are still supported. Yeah. Yeah. Both for swaps. Uh and I think also to deposit into the LP pools. Do we have deposit into Yeah, we have our own DEX aggregator but

generally the swap part is is managed by the routing uh >> yeah in the fluid we don't have the LPS we have the deposit in for the lending part >> no we do have looping we don't we we don't have the LP tokens of the uh decks but we have the lending packet. Yeah, the looping you can achieve it by flash doing a flash loan into another protocol like morpho.

Yeah, we have also bunch of other endpoints but these are for the crosschain part. Um so to track the transaction with relay layer zero CCIP CCTP also if you're in the telegram group I

put the link uh how would you get all the fluid lending u receipt tokens essentially where you can route I put it in the telegram group the link where you could see a list of all the assets that you can route into that are related to fluid Lending is a build with um here you can create the API key.

It generally works also without API key. But uh yeah, of course there are like limits for that. You can also use this one. It's disposable. Okay. Do you want to show how it works

for the samples? >> Oh, sorry. Um I think you need to press somewhere.

Yeah. Yeah. So, uh what I'm showing is an endpoint that you can use to fetch user balances or any other balance. Um and uh it will return you a list of the balance on the same chain on the chain that you specified sorry. Uh and then you can find if if user has uh

D5 tokens, you can then fetch the tokens endpoint. This endpoint can be used to fetch the metadata of the tokens that we support um that can be routed to um which essentially should also include the other USDT one that uh showed before.

um the metadata if a token is a yield earning uh asset you'll have additional data like APY TBL that you can use to display to the user help them understand what is the uh state of the asset and you will see that uh yeah currently I'm just fetching the av3 assets uh that is like a type defy That's how we identify assets that are um require special actions. In this case, it will be a deposit into our V3.

Um the other type we have is base which uh we just do a simple swap into via text aggregators. Is there anything else I missed? >> No, that's fine. Let me Yeah, I can show here the uh a more visual example.

So this is basically doing the the same thing that uh the task two uh was doing. Uh basically you can get the protocol list. Uh these are all the protocols supported on Ethereum uh spectra a and so forth. We can check a uh and we can select a v3. So 2% APY 700 million TVL and we can see the visual um part uh which was like the same of the terminal there is a swap and the hook um into the ava pool.

Cool. Is there any question for the last part? Okay. So to conclude um this this were basically mostly the sorry it's lagging a bit the computer I think it's really stuck. So uh it's really stuck. So okay

sorry there is quite some delay I think because I connected I need to buy a new Mac. Okay. Yeah. So all of this was the first uh the simple part uh which was the tokenized position. So the simple defy tokens that received for the more complex part you will need to use the bundle endpoint or the non-tokenized endpoint. I'm trying to get to the right slide. Okay hopefully it stays like this. Okay, for the advanced use cases, generally we do support it into the non-tokenized uh endpoint where you can pass a position ID that represent the NFD for example or

or or other abstracted uh parts. Otherwise, we have the bundle endpoint where you can be more declarative. So you can say um first do a crosschain transaction and in the call back of the crosschain transaction you swap and deposit into a token or certain stable coin uses this uh endpoint for abstracting the chain. Uh they usually have a a minting contract on Ethereum and they want to um have the user just to you know come from the whatever chain click deposit and receive on a certain chain. So what we do in this case uh with the bundle endpoint you can construct the route saying I will bridge

the stable coin uh the UCCC for example mean the stable coin and then in the same transaction mint back send back to the original chain and the stable coin. This is because stable coin issuer often prefers to have the liquidity and the u minting system on a specific chain but uh still want to um be composable with the defy protocol on for example optimism on hypervm. So in in this using the bundle endpoint you can construct more complex iteration and uh yeah basically create abstraction. We will release probably next week the sorry you

want to say something. >> No, I just wanted to add to the bundle endpoint. It's a place where you can express yourself um in a low-level way even if we don't have any uh some actions from some sort of protocols. Um you can do low-level calls um to the contracts that you wish to combine them take the outputs from those lowlevel calls to other inputs. Um, yeah, it's a it's a it's a great tool if you want to express yourself in a certain way for a specific route uh that may require more logic than just a simple token A token B. Um, and yeah, as Milish mentioned that one one of the principles

is the double bridging how I call it. Um, and the other one that recently came uh quite common is the flash looping. Um yeah. Yeah. And the bundle endpoint I'm trying to the the computer restarted. Um the bundle endpoint it's uh having the same security measures as the um other endpoints. So basically all the transaction simulator and the outcomes are used to write on chain the minimum amounts. So you don't risk that your transaction get front run or MIV attacks. And of course there is also the all the simulation part of the to skip

toxic pool or fake quotes from dex aggregators. Yeah I think that's it. Do you have any question? Cool. So thanks everyone for joining.