1inch Network 🛠The Future of DeFi is here: introducing 1inch Fusion mode and how to work with it
ETHGlobal·Mon, Oct 9, 2023, 12:00 AM
Join Nikita Kozlov from 1inch Network for a workshop titled "The Future of DeFi is here: introducing 1inch Fusion mode and how to work with it". Thank you to everyone who joined our first in-person appearance in 2023! We are incredibly grateful for the support and contributions of all the hackers, tech mentors, judges, partners, and volunteers who made the ETHGlobal Tokyo event such a huge success. Without your dedication and expertise, this event would not have been possible. We would also like to extend a special thank you to the attendees who traveled from over 59 countries to participate in the event. Your presence and involvement made it a truly international weekend, and we are thrilled to have had such a diverse group of participants. With over 1070 hackers it was a pleasure walking into Toranomon Hills and seeing such a talented pool of individuals. With over 22 workshops, 9 talks, and over $375,000 USD in prizes we hope you enjoyed the weekend full of hacking, meeting all our incredible partners and learning from enthusiasts of the space. We are proud to have welcomed over 35% of attendees who were new to Web3. We hope this event sparked your interest in the world of blockchain and provided you with valuable insights and knowledge. We cannot express enough gratitude to everyone who contributed to the success of ETHGlobal Tokyo. We are already looking forward to the next event and hope to see you all there! 🎉🚀 ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com
Transcript
foreign [Music] sorry for the small delay um so uh today um it's kind of actually it's a long workshop and I'm not sure I can handle everything in 30 minutes but I will try at least I'll try to explain what the Spanish fusion and why it's so like what's what is the hype about on each fusion and how it works under the hood but let's make some small recap for this one inch firstly so basically one inch is a started as a hackathon project at a few New York at 2018 by almost five and a Half Men right now we have about 200 people uh we have a lot of metrics we have billions of volumes of dollars so multiple chains uh we actually are one of the largest decks aggregator on the market we also have multiple other protocols like limit order protocol we do have a niche wallet actually it's a list of protocols and you can take a look on some of them here and one of the most popular one right now is limit order protocol and manage Fusion also we do have a niche Pro that is product for institutionals that provides qic and ml policies um so uh let's make some intro about what is one inch aggregation protocol healthy maybe you heard that fanuc's tax aggregator and actually it's true we do have API for aggregation information that access how basically that works let's imagine that you want to make a swap on the unit swap and in this case let's imagine that you want to swap for example 100 ethereum to some amount of die and what will be the problem that you will have potentially that if he will use uni swap they actually use specific price like pools liquid easy pulls to make the transaction like like to make a swap and of course you will have some price slippage what is the best like idea how you can have the like potentially the best lowest possible slippage in this case you need to have multiple pulls and try to split your 100 ethereum amount to some small parts uh it can be it will rise how small it is but it be it must be like that small that the price is slippage in each pool where you will try to make a swap will be almost zero and you need to do all of that inside one transaction so basically it's how vanish Works under the hood as one each day segregator product we basically split oh yeah if you want to just file for example die to one inch we split amount of dye to some small subpars and split this subpars to another subparts and try to erode all these and emulate all of that logic through multiple liquidity pools for almost each Decks that have existed on ethereum chain for example on a minor small chain and trying to find the best option to get the max return and have the lowest gas for the user that's like pretty basic right now and most the guys aware of it but I just want to remind that how it works and the main feature here is that it happens atomically so for example if somewhere price goes wrong we have some desired minimum amount that you will need to get if you are not okay with that the whole transaction will be reverted so basically you are protected from any Edge case that can happen during this swap uh but the main problem here is that if it's a one Atomic transaction and in some cases for example if it's some coin and you some sometimes everyone needs to swap some coins in this case uh if you have a lot of them you can have a really bad big slippage it doesn't matter how much taxes you use because liquidity for some cars can exist for example only on sex or on other chains and if you are doing that atomically that means that it's impossible to aggregate all of that liquidity in one Atomic swap you need to wait a bit for that to make to make it in this case uh the limit order protocol can help you what is the limit order protocol it's quite the same as basic limit orders on any attacks but it's completely decentralized so basically you just sign a specific structure that you agree that our smart contract can withdraw the tokens from your account and fill it with uh by using specific function and get some tokens instead basically make a swap and anyone can use this function and they just need to provide specific instruction from your from your site it's a signature and data which contract they need which which token they need to withdraw basically the limit order protocol allows to make a gasless transactions on your own site I mean you can make a gasless swap for example in this case you can just need a proof for example for the die to the Limit order contract and make a c like a and make a limit order for example to sell die for ethereum and anyone can actually fill this transaction on behalf of your like user and in this case basically not user is paying the gas but Market actually Market maker make it architecture is paying the gas it's a cool feature but the problem here is that it's specifically a very specific price condition here it's fixed so that basically means that if price goes wrong you can wait for like four hours or four weeks to get a good price to make this other executed if you will try to say in the sex Germans it's quite it's like market sell there is no market sell here it's only limit order and you need to wait there is no any guarantee that it will be executed even if the price will be the same as the market price for example what if you want to make something on the market price but we want to make it like limit order is it possible in the defy and actually that's what the question what we have and right now we can say that it's possible it's actually so so actually it's the solution what we make with the vanish Fusion we want to make something like market price sell at the same time it must be like Atomic it means it must be digital or inspired it must be gasless it must be protected from Mev attacks all at once and that's what this Fusion actually it's a fusion of multiple protocols at one age uh how it works basically it's auction um you try to say that I am okay to sell specific amount of dye and the rate is going down and down and all of that is actually one limit other and what what it allows to anyone to for example to the resolver to the party who will try to fill your order it allows to aggregate liquidity during that moment so basically it's kills you killed multiple issues at the same time firstly you try to actually to have a market cell feature so you feel yourself some tokens without any you don't care it will be it will be all diffused there is a guarantee that it will be filled it's hyper this hyperability will be filled at the same time the suppressive which will be a bit lower because you don't need to make it atomic um and for for this case we actually use price auctions and this is like example of the curve for the price auction for the rates where the rate is going down during the time it's basically it looks like Dutch auction actually um the main the main feature is that all of that logic is quite simple for the user and there is almost no difference for the user when you try to use one each Fusion it's quite the same as just make and chain transaction but it's off-chain transaction it's basically signing a specific limit order on the side of the user and that's it but there are like there are some additional features here uh the first one that of course is the gasless execution what I mean is that as a it has a limited addresses of chain transaction and uh you basically just send some data to the sum database that's it and anyone can access to this signature to your data in this database and execute transaction on your site um regardless execution doesn't mean that you don't pay gas fee at all this gas Western fee is just included in the rates of the fusion order and basically it's still a bit more efficient that we will try to pay on your own because uh in in the fusion protocol there is a specific gas optimizations basically that means that when somebody try to pay for your transaction photography like to fill the transaction it the user the layer can execute multiple transactions at the same time it will be one on chain transaction but multiple Fusion transactions and one transaction it can save a lot of like like gas a lot of ethereum and gas for example and one will have when the volume is a large it can be like 10 times more efficient for example than just paying on your own for that so that's basically how actually how actually any Fusion orders are working right now any of chain orders are working they just so the order is going through to the blockchain through your layers through some Market taker who is doing that it's quite the same for the limit ordering for the fusion let's try to make it more complicated why we have a view protection by default here because there is no any blockchain communication on the side of the user there is no any option how somebody can steal your data or it will execute it on your own but that it doesn't mean that there is no there is no meat protection for the resolvers uh but the risks in this case are much lower than for the user because when resolvers are trying to feel disorder they have risks that somebody can execute it a bit more efficient and they can they can Arbitrage the reserves resolvers on their own but the price difference here is not that critical and it's more a case of the resource how they can try to find the way how to protect from the myth so the risks are lower for the users a bit higher for the resolvers and what about like liquidity liquidity feature that basically actually we can aggregate all the liquidity across multiple chains uh during some option time so for example in case of any resolver you don't we don't have any design how you need to aggregate or how you need to fill the the each user order you just have a time for that and it's not it's not like force you can't be forced to execute any other as a resolver so basically it's open market and each issue is over just you can aggregate liquidity from any any point for in case of our coins for example how it can work we basically Need Just For example any shift car that's existing on the ethereum and existing on the polygon and all liquidities on the polygon you can see that there is a pretty good interesting order on the ethereum side and there is no any liquidity to execute it right now any result can take some time and withdraw this liquidity for example from the polygon chain to the ethereum and after that it can be executed on the ethereum site it will be impossible to do the same logic for example on aggregation protocol because it must be Atomic and it must be instantly and in this case uh that's the instant profit for all the parties it just makes the markets more efficient because users can get more tokens in this case and resolvers can get some profits from that case as well uh there is some slippage for the user because of the price option there is goes down but this spread is not that high because it's pretty open market and it's very easy to get it to become a vanish resolver right now so um right now let's let's take a look on some PC's example about like price auction uh I just want to say that uh we do have right now as more Dynamic formula for each pair on one each front end so it depends on which token you are selling and which token you are buying the price follower can differ and for example on ethereum dire raid if you'll try to adjust like to say that in the beginning when you're trying to make another a price option the price is going down not that fast we are allowing like resolvers to like instantly fill the solder but if you see that during some like amount of time like one minute nobody feel it that basically means that price is really very bad and nobody will feel and we can go and make it a bit faster going down making this period a bit more like a bit more extreme um if it's still okay if it's still okay that means that the market is changing rapidly and we still we need to stop working like this and try to say to have this the same stable formula so basically it's a lot of logic and the price formula under the under the way how you can execute the option it's another way how you can make the markets more efficient for the in it also depends on the pair and the liquidity of the pair uh we also do take care of all of that and it's another like opportunity how you can for example design something or propose your own price formula for specific buyers and make it more efficient I just want to mention that um the whole picture actually looks like that if you'll try to understand Spanish Fusion is that market maker is basically users they just need to send another send it to the network of the one inch of the H Fusion after that on each Network you store this order as a fusion order and share this Fusion order across resolvers uh right now there are top 10 results that can execute any other instantly and if you want to participate or become a resolver there is a documentation on our website how you can do this basically the entry barrier for any resolver is quite low it's about 100 vanish tokens and if you want to participate it's just like less than 60 dollars so basically any resolver can feel you like like as it actually is limit order so any reserver can fill this limit order for one inch a smart contract this this is open source and one is filled a limit order is executed and sent funds to the maker so basically to the user so the logic is of chain along chain at the same time there are some questions what is one institution is it of chain logic or is it on chain logic it's it's a gig hybrid it's smart it's sometimes off chain in some cases in another cases it's on chain uh but basically uh it's quite the same as a limit order protocol but more advanced with more additional rules over limit order if you want to try to understand it uh let's like take talk a bit how to you can work with the vanish Fusion basically uh there are two options how you can integrate and work on the funniest Fusion uh the first one actually you could integrate one inch Fusion for you to your app let's imagine you have a wallet or any app that needs to have a functionality to swap any token to any other token in this case it's pretty simple we do have a vanish Fusion SDK and in this case you just it's in JavaScript we have a brass version as well and if you want you can just like use it yeah there is a pretty easy example here I will show you one second how it works so basically um in this case you can use for example node.js application to make to make a fusion order um so we have on each Fusion SDK you just it's open source and it's quite transparent it's not that hard to install it uh in this case you just need a note you need a private key you need to make your address of your like of the user who will be creating like a limit order and what you need to do is basically have a web P node and our SDK you just install our SDK setup our SDK with our our Network our URL of of storage of limit order of fusion orders and web free provider and basically you just need to create a little place another where you specify a from token address which token you are trying to swap to token addresses you are trying to set like to buy and amounts in from token address so it's like only for like four parameters for the function it's quite simple and in that case I don't have enough ethereum right now to execute this function but um basically it's just one function it's not a lot of issue to make it work um so it's the simplest way how it can work with the managed Fusion order and also it's gasless so basically I just want to add what we will try to use for example to run SDK language Fusion SDK it can be not working because you still need to make a proof of the of the front token amount to the fusion contract if you don't make an approve you need to use permit function in this case it's more complicated if you want to come if you want to combine permits and make a play make a fusion order but it's possible of course we do support permits in the fusion protocol but in this example you need to make a proof before you're trying to make a swap so there's the the one example how you can use Spanish Fusion others and the second one actually is to become a resolver if you want to become a resolver in one inch like ecosystem there are three like there is a multiple steps what you need to do basically the first one you need to have some unleash token staked you need to apply as a resolver and like basically all of that is pretty decentralized but if you want to be on the on the front and side on the vanish like if I feel like front-end inclined there are multiple additional steps that requires us to connect with you to chat with you so if you have if we have a website like we have a website form where we specify all the data what you need to do to become a resolver but basically it in the end it will end up with a chart with our team that helps you to integrate and to become a resolver on our site um we we agreed to make some compliance checks and the same at the same time but if you don't if you want to become completely decentralized you can potentially you can do this you can still do this like that's the main point about vanish Fusion that is right now the network is much more decentralized and we can't stop you to become a resolver because it's mostly on the smart contract side um how I just want to explain a bit more how resolver Works how the logic under the resolver works and for that in this case I need to open vanish that's been giving it one second please so um let's take a look at now delegate uh like delegate tab Advantage front end one second so right now we have multiple resolvers and what is it um only top 10 is always in this list can be allowed to fill transactions and what does it mean like all of them are competing for your transaction each in each one each Fusion order can be filled not atomically but by parts so basically when you create a swap multiple resolvers can fill the same transaction it's their own competition between them who will be the first one who will feel all of that so they need to take care on their own how it's happening each one inch Fusion resolver can basically share some profits from the with the user in this case for example if you're owner of the vanish talkers tokens you can delegate manage tokens and to the any resolver and allow a resolver to be on the top and fill the vanish Fusion orders and get some profits so the scheme it looks like pretty the same as curve Wars as a curve staking and but there is a one small small difference here that basically when it Fusion resolver is not obligatory sharing the sharing the profits with the user there is no direct scheme here but but if your exclusion resolved we'll try to refuse to share the profits you can just undulocate from this part and delegate another resolver so basically on large volumes it will works on the markets like literally the marketing competition and any resolver is obligatory to get some profits to share profits with the user if it will if it will be lower than expected from the user site you can just try to use another one so as you can see like right now we have about eight working open sources like open resolvers that and the market share right now is much more lower in terms of vanish lapses or as always it's only about two mouse that we are working right now and we have like pretty good results right now I just want to add that we also support not only ethereum chain right now with the support by the smart chain and a polygon chain and we have plans to support all networks that we have on the front-end side so it's about 11 10 networks uh so it will be ziki sync as well um the on the option how you can participate as a user for example you just need to stake one inch tokens and I just want to mention when you stake manage tokens you lock your tokens for specific amount of time you can lock it for example for 40 years in that case you can't withdraw it for two years but you have pretty good amount of Delegation or delegated tokens that means that you will have higher APR and higher profits from the resolver when it will take it so it's up to you how much amounts you want to stake and for how long you want to stake it you can always unstake it before this locked period but in this case you will have some fee and for example if you log your tokens photo gears and you want to unstake at the next transaction you will lose like 99 of the total total transaction in the in the fee in this case all the fees going to the vanish down so it's pretty transparent if you have any questions I'm pretty happy to answer that so um I just want this to show again uh our car cards how you can participate as a resolver and how you can create Fusion orders using one each Fusion order SDK we do have additional instructions how we can use Fusion on our documentation websites so basically this link is going to the our documentation website so thank you so if a third-party partner wants to integrate Fusion to let's say you know a major centralized Exchange it has to be can they you know they they also have a DEX aggregator does it have to be a separate button or can it be somehow fused between fusion mode and you know the the they have the sort of the Legacy swap mode right so how would that work out hey if it will be a summon another segregator it will be quite hard to aggregated if they have only own chain functionality I mean like in case of one inch for example trying to integrate another one inch in this case it's almost impossible because I have an inch needs to integrate only the access Fusion is not a Dax and in the case of another deck segregator it requires to make off-chain logic and in but they need only one Atomic transaction so it's not quite possible uh yes they need like a different different interface and they need to explain the user that this transaction can be filled up not atomically but by some steps there is like an option here um just took soon uh how would you get historical um tried data like the trades from historical stuff basically uh each Fusion order is a and then the followers is just on chain transaction so basically if you will try to feel the like if you want to get the date you can just index the there you know you can use Gene analytics for the data or you can just go to the other scan and see all the vanish resolver like others that are executed on the behalf from like one to one each Fusion contract this is the one option that you can do the second one we do have right now like a database like API where there is a storage of all others you can fetch data there but I do recommend that the best option is actually the index data from the nodes directly or actually use gen analytics for example to fetch all limit like Fusion orders we do have a general analytics dashboard for the fusion and we do have like there are all the requests all the see like it's quite transparent there how it's happening so all the analysis about oh Fusion is actually quite open source and transparent yes like the main logic key is that it's yeah it works like that uh right now there is one more like a edge case that potentially later the fusion order can be filled not like not for the not fully they can be some small amount that will be not filled right now but right now it's handled like in the in the case that in in most cases right now it's not very profitable to fill order by small sub by small steps so usually like usually it's always they just feel it atomically in multiple like in one step or two steps later with large amounts it can be a small issue with the some small amounts that is not executed it's the same as for example one each limit orders have it is the same issue like you can trade you can make a limit order for 100 000 ethereum and 0.0.1 ethereum will be not executed and then default because it's just more expensive to spend on gas then execute this limit order after is in the overall transaction are paying for for the transaction basically it's only a resolver that is paying for the transaction and in the case of resolve its own it's this possibility of the resolver to calculate the like how profitable digitalization will be for the resolver so and because the price is going is going down that basically means that for example let's let's imagine that currently ethereum price is like two thousand dollars I want to make a fusion order to sell ethereum like for like two thousand dollars let's imagine I make a diffusion order uh but nobody wants to execute this transaction because the gas price is like 20 dollars for example let's take it let's wait like 10 seconds the price right now is not two thousand dollars it's like 1099 9999 in this case for example it's profitable and somebody will come and fill this feel Disorder so the price is going rapidly down and during the moment when the market price is a bit like is a bit lower than the real price somebody will catch and execute this order it's quite the same I think as are working on the markets they're just trying to compete to find the way how they can execute or like optimize the market foreign there is a period of when the there is an auction of course it can be canceled but if you want to cancel it it can it must be on chain transaction so that's the like the pain Point here that if you'll try to cancel it there's no guarantee that it will not it will be canceled instantly you need to worry that the return change transaction will be executed so yeah it's quite painful issue here but of course it can be canceled by the amount of time but for example in some cases it's very edge cases but sometimes it happens when the market is going like not in your position against you the all the fusion order can be like not executed at all uh in this case yeah it's just time constrained when this this Fusion order is executed all of that is actually on like off-chain data that you're assigning for so basically you can see all the details how this Fusion order will will be executed there is no any like something that is not of chain or not signed or not like not in the like permissionless way basically becoming a resolver right now there are multiple like actually one unsensitive programs to become a launch resolver uh that basically means that we share some Unleashed tokens manage down sharing Financial tokens for resolvers to help them to like to reduce their costs of building the infrastructure uh there are some details on the vanish website for that so yeah there are multiple incentives incentives from any manage team to help to build resolver on your own and there are like right now it's pretty high volumes on the vanish Fusion order so I did highly recommend to try it take a look on it yeah so I think we can end up this thank you so much
Automatic transcript — names and jargon may be misspelled.