Charles Jhong: Intent-based swap |15th Oct 2023 | Sunway University | ETHKL 2023
Ethereum Malaysia·Wed, Oct 9, 2024, 12:00 AM
The ETHKL 2023 conference is a two-day event that covers a wide range of topics, including Zero Knowledge Proofs, Layer 2, DeFi, Data infrastructure, security, and more. This gathering brings together industry experts and pioneers to explore the latest advancements in Ethereum. Attendees will have access to insightful discussions and presentations on various subjects related to Ethereum technology.
Transcript
[Music] sh [Music] all right good morning everybody good morning good morning I know it's a bit of a sleepy morning this morning uh but I really appreciate all of you coming out uh being punctual as much as possible I know the reason why everybody's late is because during the side events they all went drinking and they can't wake up I asked my my friend are you coming today he like Ross I haven't finished drinking at 2: a.m. I was like oh yeah that's probably why but hopefully they'll be joining us later if you have any friends who are at home still showering please tell them to come faster because today we're going to be talking a lot about dii protocols a lot about dii and all the different kind of developments and uh interesting projects that in the works so I think it's going to be really interesting yesterday we had a lot about Z okay so um good morning everyone so my name is Charles and uh I'm a small contract engineer from token long and uh I know it's pretty early right now usually 10:00 a.m. is the time when I get off to get off the bed so it's early for me as well so anyway thank you guys for coming so let's get started and today I'm going to talk about uh the intent based Swap and how it's going to be uh going to reshape the Dex market so okay so the outline today is have a major three parts and first uh I'm going to uh talk about the the current Dex pattern of the trading right now and uh after that I'm going to introduce the uh what is intent what is the idea of that and uh why we talk about this what problem does it solve and uh uh some of the example of the intense swap and uh at the end I will just um talk about how we use that kind of a design for uh to improve our product and to provide new features to the users okay so uh let's make a take a quick look of the the current situation so currently we have uh two major uh patterns of Dex the first one is the am and uh the for example like Unis swap curve uh balancers these are all based on the the so-called uh constant product formula also some protocol have their uh specific uh envirment um uh so the good thing of that kind of a model the the concern product is it is always tradable for users so you are always able to trade for a certain pair uh from the M protocol but um but the uh problem or the the uh the problem of that kind of design is that the efficiency of the liquidity is not very well so also uh from the liquidity provider perspective uh there are also like uh some issue like Implement loss or the lvr cost when they trying to you know provide liquidity to a poor so uh from the user perspective there are also some experience problem like when you uh do a when you going to swap with the mm protocol you need to specify the tolerance of the slipage that you're able to uh that you feel okay with so um that means there are some uncertainty or and uh the the result is unable uh when you swap with the the mm port and uh on the top of that there are also the me issues so uh probably some of you may heard that topic before so when the user want to uh make a trade with the mm protocol these are major two issue that uh you need to worry about the slipage and whether how do you avoid the me attack and the second one is uh the rvq which is uh request for quote for short and uh basically it is uh P2P trading and um you can we can uh see this diagram for the the the whole flow of the rvu trading so basically the user uh want to for example trade uh the the eth with the usdc so he asked for the price of that pair so the maker uh responds with the the price for example like 16 uh100 and then the user decide to you know make a trade on that price so for example buy two ether on uh using that price and the maker will uh response with the order and the signature of the order and the order which uh basically specified which pair uh will be uh for the trade and um the amount also the price of the the the trade also there will be like uh expire time for for that kind of a quote and then after user uh reive that order uh he can submit the transaction with that kind of order to the blockchain and get confirmed and get you know settled on the blockchain so usually um you have the the maker here uh usually they are just professional Market maker to provide Crow for the users so the good thing about uh such model is that there's no slippage there so and there's no me uh because the the amount and the the price are specified in the order so you there's no space for you know a different result or different amount or different price so the the result is very predictable so you won't have a issue to spfy your slipage tolerance so it sounds like a perfect solution right is solve the the major two problem of the the emm but actually there are some concern uh from the maker perspective so uh the first one is fluctuation uh versus the older expiry so um like we said um the older will have a expiry field to specify the the valid time window or duration of that kind of price or the quote okay so uh if that kind of a window is too short uh it will need uh require the user to submit the transaction and get confirmed the transaction onch very in a very short of time so um that means uh the user need to uh sign the transaction and submit to the blockchain also they may need to adjust the the gas price uh accordingly because the congestion and networ uh situation always not predictable so but it is uh good for the maker because uh about the the risk uh so if the time window is too long and it is good for user because um they can uh they can have their time to to to decide whether they want to trade or not and don't they don't need to you know set up a high very high gas price to just to be confirmed in a in time but uh the market price uh can go up and go up and down right so it cause the the risk for the maker that uh they may need they the price may be out of date so like we said the price is fixed in the ERS so uh if the value time is too long so the market price change the price may need may be a good for user but bad for for maker so maker will get uh well expose their risk from that kind of a duration window so it's kind of a tradeoff to choose whether to have a a short valy window or a Long valy window and the second concern is that the the how do they manage the manage the quote how the the maker manage their quote so basically you have to track um the quote that you've already issued out for the users but it's up to user to whether they are um accepted or going to swap the the trade right so you have to track the status of each quote and um because the maker also need to track their exact amount whether they are some of their amount is pending for trade or some of them are you know available for new uh providing quote Yeah so uh on the top of that there are also another issue that because we said the market price can go up and down right so uh sometimes uh there's a specific uh situation that maker May issue uh multiple multiple quotes which is will cause a conflict for example the uh the same pair but with the uh the inverse Direction and uh because the the price change so user may uh be able to Arbitrage from from that maker itself so you also need they also need to you know monitor or detect whether there have a conflict quote or not so from our experience the most of the maker they are just uh very familiar with the centralized change Market making but there may not be uh able to you know um have a comprehensive assistant for uh trans uh transaction management or the core management so this will uh the the result is that for uh the maker they will have more uh conservative uh coding strategy also and uh ultimately it will fide the the price that user can get and usually um these maker are you know Market making doing the market making on the the major payers so uh overall the this uh model is uh good for users but uh too many uncertainty for for the maker so um the RFQ and am actually are you know comp complimentary to each other they are not replacing each other at all okay so let's get into the today's U topic and uh let's uh let's take a look of what is the idea of intent before we get into the intent based well so um so intent is like a an idea that instead of uh you know let user to submit the transaction by themsel and uh with the the the the the specific code data and intent actually focusing on the the intention or the purpose of the transaction so uh you can let's take a look of this diagram so uh on the left these are the the current flow we have right now so for example you uh the user you know want to sell uh his ether with the best price right so uh he probably just open up the browser and access to the and you know aggregator to find the right path for for selling his ether and then and then he got the code data from the aggregator which uh specify the the the selling tra uh selling path for you know for the best price and then he submit the transaction to the blockchain and get confirmed also so you know State uh State get uh changed accordingly so these two uh these two black Square actually you know relate to each other we can see uh the user uh the original initial intention uh is uh made uh achieved by the the actual State change but the problem is that uh this steps in the middle is kind of um uh sometimes is uh too complicated or sometimes U need uh different expertise to find the the best path for for the trade so uh so the in blow is actually on the right side and so you can see uh with the same situation that a user want to sell The Ether with the best price so um instead of you know open up the browser accessing to the the different uh D app uh now he has all he has to do is uh sign this intention as a for example the Erp 712 format uh so this is like uh the um offchain signed message not the the real transaction can be submit to the blockchain so after that um the intent is broadcast to the the solvers and these solvers are professional solvers too their job is to fulfill that kind of uh intention or uh the purpose from the users so uh the sers uh well you know trying to find the So-Cal solution for that kind of a intention and then after that one of the solare will you know send the the transaction with the the the right uh solution to fulfill that kind of intent to the blockchain and um so the result is that uh after the uh transaction got confirmed and the the state also changed on the the blockchain it also relates to the uh the or initial intention of the user but the difference is that uh now you can see lots of the step uh are done by the server not the user the user just signed a message at the very beginning okay so um that's the basic idea of the the the intent and um let's take a look at the how a swap is done by the the suchar of design so a swap a token swap you can uh it can be understood as a uh a Desir State change that uh for example you want to swap uh you pay some token to get other tokens right so uh basically you want the uh balance difference as the specific State change after the swap yeah so um the user now trying uh if the user want to do a swap he can you know uh specify the balance difference in the intent order so uh also with some other condition like the uh who is able to trade with that kind of intention or the amount price expiry something like that uh yeah so basically users specify the what not the how so um now uh you can see uh on the last page the example if the user want to sell some tokens he can specify in the this here I say his intention and uh whatever your price you want to specify it's uh it's up to you but it will affect the how you know how the solware will uh be able to find the right solution immediately or you you have uh you need to wait some time for the market price uh yeah so the good thing about the intense BL the actual good thing about the what is first the user doesn't need to pay for the gas so this zero gas for user but some of you may argue that oh it's not the zero gas it's actually paid by the solvers uh eventually yeah uh that's correct but technically technically uh they it also has some benefit for the server to submit the transaction instead of users uh basically it's about the submission efficiency efficiency uh for example um as you know user I need to you know uh choose the right gas price or they have to find the right uh like M node to submit their transactions they have to do you know lot of things but we can leave this uh kind of uh operation to the professional solvers instead of you know user struggling to operate this kind of things and uh obviously there are much less step for the users as we mentioned they he has to do is uh sign a trans ass sign a message instead of you know accessing the browser D app sort of things and uh the another good thing about this is uh the composability uh which means that the solver with the expert they can you know combine more uh liquid Source uh which result is uh better price for users yeah so uh but yeah there are also some you know uh bad thing about such design the first is that when you you know sign a order and send out to the solvers if you want to cancel that intention you don't want to trade uh using that conditions anymore you have to uh submit a transaction to the BR uh currently yeah that is that is because um uh you need to um you need to mark that this order is not able to be uh executed anymore on the Block so that's one of the uh things that need to be improved right now and also um this kind of uh design doesn't support Ro assct because for example you want to sell The Ether actually you need to um wrap it out as a w at for for the intense swap because uh the PO payment uh method is used uh within the trade and uh it is much harder to trace or to simulate the transaction because um uh currently we you know filter the transaction using the front and two address right but right now you if you sign the intent message you don't know uh which server is going to submit the transaction to the blockchain so you don't know the front and the two address uh so it need to it requires a specific tool or you know website to track your your assigned intention also if you have a uh conditioned uh it's not very very strict so it is hard to you know get the get the prediction of the result uh before the the transaction is actually executed so um there are a couple um example of that kind of a int intense swap uh if you uh if you remember that uh that we mentioned in the RFQ slide you can see that actually RFQ is a uh simple version of the intent but with the inverse Direction uh yeah the the signature is provide by the maker and be uh by submit uh user submit the transaction so it's kind of a inverse Direction uh from what we talking about right now also if you have heard about the demer in the Dex it actually uh is another version of uh intent because you need to specify condition like the price the amount and the expiry as well so other than that we have uh for example 1 inch Fusion mode they are relies on the uh intent base design so when you uh interact with such a DF you don't need to submit a transaction by yourself all you need to do is uh sign a message and also the cwall they have a Fe feure like uh unified clearing price they also relies on the the intention that from the users and they have a group of sare to to you know uh fulfill those intentions yeah also the openc nft market you can specify uh multiple nft you have to trade with multiple you know nft at the same time yeah and uh couple months ago uh the Unis was just uh announce their new product called Unis SW X and uh this is the diagram of the Unis SW X so actually Unis swap is getting step into the aggregator um Market not just the mm liquidity source so uh I think you can Lop in um to use the Unis swag right now uh from their website there's an option you can choose yeah so this mean is BAS basically what we have the for the situation right now so back in days like in the 2021 so the Unis Swap and the 1 in like sushi sushi swap they are all doing the transaction based uh faction there if you uh use that at these days you have to submit the transaction yourself so you have the gas price issue you have the me issues and uh those I think this mean maybe made by you know cwap I don't know yeah so at that this the kwap is the only project that you know Leverage The The Innovation yeah so nowadays because uh the one is uh announc their Fusion mode and uh uh the unisa also have their unisa X everyone just you know focus on the the new intent based trading yeah so um more uh product can be you know exported from that kind of U intention architecture so um we're we're talking about the the swap but actually the potential of the intent is not just about the simple onetime swap so uh you can specify the condition of in the intention right so the condition can be you know the intent could be actually a way for you know realizing more General trading conditions or a way for you know authorizing so um you can have a customized uh conditions and the execution can be really flexible and the result can be optimized so uh the example is like you can you know delegate your part of your accent to um to the professional Trader but you can specify the condition for example uh the the maximum or the minimum price you are you know going to accept it so it's like uh for example the grill grid trading for example also you can achieve uh the dwap trading like the CW do uh did uh using their system they can now uh you know support the tab trading uh which combines um multiple trade with a uh with a certain duration not just you know one one time swap so uh finally uh how the we as took along we Leverage The the intent design actually uh talking about the swap we have RFQ and limi order now uh in production you can use the these two features uh uh in the token Lo right now also we are developing a new uh uh for the trading strategy uh product uh which called Best Buy uh it allows you to uh you know uh you know buy the tokens with the right price with the right time automatically yeah so uh as we said the the market uh price goes up and down so if you want to buy a large amount of token so uh it is essential to know uh which time to to to buy or using a different amount not just you know one time large order so uh basically the the user interface is something looked like this um you can specify the the token for sure and uh the trigger price and the total amount also the duration here as the these are your conditions and your intentions so uh the professional Market uh Trader they are going to you know um Mar monitor the network and U trade uh by your uh allowance to you know help you get the better price the better result yeah so uh that's uh what what I'm going to share uh uh right today so you can check use uh the token loan we have the website right now you can definitely make a check if you want to you know swap the uh token to get a better price okay okay thank you all right thank you very much Charles let's give him a warm Round of Applause okay we're going to open it for quick session of Q&A does anybody have any questions about token swapping intent based tokens uh raise your hand oh yes of course one second switch it on for you please introduce your name as well as your question uh well thank you for presentation I'm martinet and um yeah so my question is right now these are kind of like the old type hold the mic a little bit Clos the these are kind of like the old type of intents right uh I'm wondering what you see about like the newer intent designs for example anoma and Flash product these are kind of like on the development oh okay so originally I want to cover uh topic about you know General State change General intent as well but you know the time is not enough but actually I'm very uh very excited about you know the general intent uh the the design like Nora or you know Flash the next generation of the The Flash bar design yeah so all we covered today is from the application uh perspective how a intent application can be done and what's the the new functionality new feature they can provide but actually if you think about the whole blockchain you know um instead of allowing user to submit transaction we can you know just the the node can accept uh like the intention from the user and instead of the transaction I think it will you know change the the user experience of the the blockchain completely but uh I think that's also quite challenging for you know user need to figure out uh for example I want to sell some token is quite easy right to to you know to uh to to make it as a uh State change or the balance difference as are my intention but if I have to you know do something other than swapping it's uh more difficult to you know for a normal user to to say uh what is the state change of that kind of operation it may require some you know tools for kind of a you know uh Translating that kind of a uh intention to the actual State change yeah so personally I'm really excited about you know that kind of idea but I think um we uh it definitely need some time to you know overcome the challenge yeah sorry another follow-up question so in one of the slides when you first mention intent you say like oh you can get the best prize for you know around the right time right but in my current understanding like the intent you have to specify what you are willing to give up essentially so my my take was that I'm basically exposing my a me I'm accepting that me is going to happen and let it happen to me but I make it very clearly and from that point of view like oh Unis swap itself like a slippage is also an intent saying that hey I'm willing to accept this because you can also just set it to zero right and so um I guess my question is like how you have that best price thing H how does that work yeah you you can say um the slipage is one of my intention as well but uh you know as a user get to the Tex they if you ask the user what's your intention for the slipage they will ask you what's the slipage why there's a slipage so they they they know the trade they know the swap the the in and out amount but they don't know the about the slipage so that's the one thing about the user experience but um so you you said the the what's going to be sacrificed I think um yeah the the product itself actually um basically you have some kind of a trust assumption for the professional Trader uh with that with the trade so uh yeah there's um probably no not a you know very formal way to approve to prove that this is the best result but uh we we can Ure that we can ensure that there are some you know limited of the the operation or the trade that the trader can you know operate within a certain you know a range like the amount or the duration the price you can set up the price range you are you know willing to to trade yeah so other than the the range is not going to happen on the Chain so basically it requires some you know sort of a trust as at least yeah okay if you have any further questions you can always find Charles after this let's give another big round of applause thank you very much Charles thank you
Automatic transcript — names and jargon may be misspelled.