How to Build a Cross-Chain Yield DEX on Starknet | Edi Sinovcic - SpaceShard, Nimbora
Ethereum Denver·Wed, Oct 9, 2024, 12:00 AM
We at Nimbora are building the first cross-chain yield dex that enables user to seamlesly interact with L1 defi yield while doing it from L2 at a fraction of the cost. We combine best of the L1 (deepest liquidity and most robust protocols) with scale of L2s (zk in specific) which lower the cost for the interactions. On top of that we reduce the cost per user and make it cheaper as more users join the dex and all while giving users synchronous feeling (while in reality there is asynchronous flow in the background). Come join us how to scale L1 defi on L2s fully trustlessly and at a fraction of the cost. APPLICATIONS FOR ETHDenver 2024: #YearOfTheSpork ARE OPEN APPLY NOW https://ethdenver.com/apply
Transcript
[Music] awesome so thanks everybody for coming here today we are going to talk how to build the cross chain yield decks on starnet in this case so brace with me there will be some technical stuff but I will try to be as gentle as possible with these kind of things and make it as simple as possible so a bit about me I started as a c de back in the day basically worked on something that's called zorres which is toolbox for Z Nar ethereum this were like the old days you know when the ZK was starting then I moved to solidity team worked there for two and a half years on sourcify founded a company afterwards called sh laabs that that did basically a bunch of like LSD stuff defi related and so on and most recently basically been building like uh you know tooling and infra on the Stark net and out of that came nimora which will be the topic today so let's talk about how web2 works we all know when we go to some website to use some service well what happens is we click and it works you know it automatically works and what happens with web Tre is we go to a website then we connect with a wallet maybe we have to change an RPC because it's wrong Network then some stuff break you know stuff is not the best but when you compare like the user experience it's much worse than web three but still when we think about it web 2 is not synchronous it's and synchronous we have a lot of requests on service servers different services and stuff working in the background but for the user it feels like a synchronous experience when we think about modular versus monolitic architectures in like General rollups shards or whatever we have two approaches one is obviously salana which is monolitic so you try to run as big Hardware as big Hardware as possible with you know optimizing everything and stuff like that that can scale two point there are like you know some limitations like speed of light for propagating information and how much Hardware can process and we have the other approach which is more ethereum approach which is this kind of main chain which is ethereum main net and this scoll UPS basically which is kind of co-processors of ethereum that are scaling it what's the disadvantage with the second approach is you have broken compossibility basically liquidity is sharded or broken across multiple chains user experience is broken across multiple chains and so on so what's the solution it's quite simple actually we build synchronous use user experience for the end user in a synchronous World some call it chain obstruction it's kind of magic you know it sounds easy and so on well is it let's deep die how do we do it so I want to first introduce you like the Bora the penguin guardian of the seamless interactions it's the idea that users should not be explained all the complexity ities how do blockchains work what wallets are all the things basically we are trying to push on them but we should make it simple they it should be kind of oneclick experience like you have in web 2 who here used one click check out in web 2 anytime like you go to website you click on a link and basically you just check out so you know how it feels you know it's like you just click and that's the Magic in web tree you click a button then you w for a transaction maybe you know you get reorder this and that but we have to abstract that if you want to do this so what nbor actually is is capital efficient L1 L2 cross protocol interactions so imagine a protocol on mainnet that can have user deposits redeems and external kind of execution on l2s so this way you can kind of give them the same experience of defi on L1 while they interact on L2 it's kind of what the purpose of rollups isn't it the other basic one is ultra efficient obviously crushing yield strategies this is more specific what we can do with this so imagine you are on Stark net or ZK sync or polygon ZK AVM and you want to stti with Lio or earn some yields on mainnet how do you do it you have to bridge from that chain to main it wait 6 to8 hours for the bridge to finalize then you have to go to the protocol stake with it pay $40 in gas if you're lucky and then you get the assets and maybe Bridge back well what if we could automate all of this and do it with your friends because if the cost on Main net is $40 and let's say we have five people five friends or five users that want to use this in let's say time frame of 24 hours well we can do $40 divide them by five and everybody pays basically just partial of the fee and this way we improve the user experience this kind of is called defi pooling so why we went with C first is because it's powered by native account obstruction that means that you don't have any EAS there and so on the issue with EAS obviously is it's kind of a pseudo permission in Linux so you basically basally can do anything with it and so on and with account obstruction it's kind of smart accounts it's more granular you can do whatever with it and you protect the users from you know using pseudo all the time and this way what we did is user comes to Star ZK syn or Samar L2 deposits assets from their wallet which is account abstraction base which can feel like web 2 they don't need to pay the like the gas fees because you can use pay Master they know don't need to know when this will get executed to L1 and so on they only need to know their local kind of thing it's one click for them so even if they don't have the assets that they want to deposit and earn from you can swap for them in the background and so on and obviously that's called One Click defi you know swap deposit turn only one click and you can chain as much as you want how does it actually work well there is a bit of you know stuff going on in the background so let's go through it quickly so as we can see these a couple of strategies we have L2 part and then we have at the bottom we have L1 part L1 part is just like simple strategies like stake with Lio like deposit to spark to eres or do like delta neutral leverage or something like that then we have obviously like the bridge in between which in this case in case of starnet is starnet canonical Bridge we only use canonical Bridges because the security of the rollup depends on the security of the bridge and vice versa basically the rollup is a secure as a bridge that basically is canonical on it and basically we use Native Messaging to trans messages from L1 to to L2 and back and then on L2 we have this world based system where we aggregate user deposits and redeems so let's say there are a couple of us that want to stti with Lio I have one eat I put it in the VA you have like two eat the other guy has three e so basically all that combine is six e and somebody wants to kind of get back his three eat because he earned enough you know it's bull market it went to moon so he doesn't care anymore well the only thing we need to do is we match that 6 to three so we have 6 Plus e minus 3 eat so we have only Delta of plus three eat now we have to bridge shuttle to L1 deposit with Lio and get rep Steed back and this scale with any transaction we manag to do this so you can add new strategies new options and 60 lines of code in solidity which will be decreased even less in the future but if this is not clear to you because it's too complex don't worry border of the penguin is here so for the user is quite simple when we when we look from the user pers perspective what the user has to know what is the user intent user wants to come to the platform he has some assets and he wants to earn money on top in this case user wants to be exposed to rep test e basically light is taking and let's say the user doesn't have Eid because that's what you need to deposit well we can swap let's say here's a Wi-Fi basically Maxi we can swap Wi-Fi to e and then deposit into W and he gets the lp token so he can start turning immediately the the fees on top and for the user is one click he doesn't have to do approve and then deposit or swap first so basically he would need to do four transactions usually and now he can do only one and that's kind of a magic of this multic call and one click Def and so on and you know for withdrawals is basically the same but the key caveat here is when you bridge to L1 it takes 6 to eight hours on Stark net it takes 30 minutes on polygon it takes like 24 hours of ZK sync when you bridge from L1 to L2 any of this it's going matter of minutes so how do we kind of say to the user okay we can give you instant kind of this deposit back but you have to pay more you can do that to liquidity Bridges or swapping locally but if you're are not in a rush you can do it normally so normal mode operations when you want to withdraw product protocol is maximum every 24 hours usually less and when you want to do it instantly because I don't know you want to take this money do something with it you can do it in matter of minutes so this way we have based of both worlds on one side we have like D5 pooling which decreases the cost per user so users are not exposed to L1 kind of gas feeds and everything and on the other hand you have like a normal cross chain zap which gives you the instant experience as fast as possible but obviously for a fee so what's next for us well the the idea is quite simple but quite magic any chain any wallet any assets it has to be seamless and oneclick Integrations is it def5 protocols is it buying nfts on other chains is it something else it has to be simple as that we can scale obviously any L1 strategy in Ys to L1 l2s and vice versa so potentially if you're on like let's say Stark net you can earn arbitrum yields if you are on arbitrum or optimism you can ear Stark net yields and vice versa or even L1 yields and then the most interesting part in my opinion is we can build Noel protocols that have part of a logic and execution L1 and part of l2s and this way you kind of can get the best of both worlds L1 liquidity compossibility and so on and then cheaper transactions and the scale of l2s and obviously we have an SDK for developers so they can use this L1 L2 all the asynchronicity basically abstracted from them so with re layers and volts it's kind of integrated and you don't need to think about it we actually run a hackaton and there were like four like different strategies buil on top easily like in a mother of week which kind of proves this kind of it's feasible it's really interesting to users so this was a short intro on this so if you're interesting join our Discord and I'm open for questions if you have some thank you
Automatic transcript — names and jargon may be misspelled.