Onchain trading

ETHCC 6 · July 2023 · 23:00

Hayden Adams discusses onchain trading, Uniswap v4 and possible next steps for DeFi at EthCC[6].

Speakers

Topics

From ETHCC 6, hosted by Ethereum France.

Transcript

[Music] foreign how's everyone doing oh all right this is my first conference uh since before kovid that I'm speaking at uh really also my first time in Paris so really really excited to be here thank you all for coming to my talk um thank you so this talk is a little different from most of my talks because normally I extol the virtues of uniswap but today we will be roasting uniswap and also announcing something big which is which is exciting so you know it all started with uniswap V1 um which which we all know about and I think that the big thing that uniswap

did is it introduced the ability for anyone to create liquidity for any token and I think before that you know there was a lot of problems around listing and it was hard to get your your token listed on a centralized exchange and also even once you got listed it was very difficult to create liquidity so V1 was successful not because it was like the most efficient design it was successful because it unlocked something new uh and and uh you know a lot of people to do something different and that's why we have this sort of upwards chart uh this is a little bit old but um just shows like how many tokens get added to the protocol now it's more like 200 000 uh this is from like maybe a year ago um uh but you know you saw V1 had problems unusual is inefficient uh inflexible

written by one amateur Dev in a language known used uh and I made up the feet here um on a plane one day and uh I think what's you know really important to think about here is just that like you know it forced all liquidity providers to use the same strategy um which wasn't a very efficient strategy the vast majority of the funds in uniswap V1 never got used um I mentioned the language because it wasn't very like it wasn't a you know a lot of people didn't know how to build on top of it just because it was it was written in a new language and I'm a fan of Viper um so unified V2 came out um and became this much bigger money Lego I had much more adoption than V1 um and an entire ecosystem formed around it

um uh which which we see you know what that looked like back in the day um uh but it actually funny enough the the new features that we introduced with unison V2 actually did not get used the main new feature was erc20 or C20 Pairs and uh because it wasn't in a very efficient curve for stable coins uh people didn't really use it for stable coins and everyone else just wanted to pair their tokens against eth the other features were like oracles which were mostly used very poorly um uh and it actually did not fix v1's biggest problems uh which were like around flexibility and expressiveness and efficiency um but you know it still was it was a success in its own way uh unit spot V3 uh came out and I think that was a big breakthrough moment um it made amm's uh extremely efficient uh you

know kind of kind of for the the first time in some ways um and this is why we saw like the sort of market share go up and we saw this this Market depth chart on the left uh where we have unit swap exceeding you know the likes of binance and coinbase and cracking it Etc on you know the market depth uh ironically when we when we put out this piece on on the comparing the market depth depth uh centralized exchanges uh the reason we didn't claim it had the deepest liquidity in the world for ethusd uh was because we couldn't get the data from FTX at the time uh turns out uh you know that was a sign um so it was defus including the world and that's also why you've seen decentralized exchange go up relative to centralized exchange uh you know in like

overall spot trading um is this sort of new efficiency that was introduced uh but not without its problems um you know I think you just thought V3 was actually very uh complicated is there it was and is you know quite complicated to build on top of um and has you know some issues around the competitiveness of liquidity providers against each other potentially uh we can unpack that um and it was extremely opinionated I think the important thing here is that like as the amm development got more complex it you know we started having to make much more complex trade-offs and adding a new feature that was beneficial for some users would actually have a negative impact on other users so the capital efficiency that enabled the efficient like the the sort of you know

you still have to compete in the way that it did actually came up with a trade-off which was like it's much more confusing to to interact with as a developer um so we entered this like opinionated trade-off space um you know uh and that's what it means like this um and so like what do we do about that um you know this talk is not a talk on usual before uh but you know quickly there have been other ones but you know just quickly like I think you saw before is really built to be like the ultimate Dex platform and allow people to choose the trade-offs that they want to make um which you know helps with with this with this complex trade-off space and so the ability to do like fully custom pools uh with the introduction of hooks uh you know creates a really expressive

system where you can you know create custom order types Dynamic fees custom curves Etc um and that's really powerful uh I think one of the most interesting things is that like um in the in sort of the proliferation of other amms and other projects um you can tell that there's like a really uh interesting area like there's an interesting world to explore with with uh Dex Innovation um but building an entire amm from scratch or an entire text from scratch has a lot more it takes a lot more time and is a lot more um risky than building on top of hooks and generally speaking you know the the the single you know the shared signal contract for all pools in unisoft V4 also creates like an efficiency benefit

where if you build uh a hook instead of a custom amm outside of unit swap you get a gas efficiency benefit routing across all other pools um so there's sort of this like shared benefit for building on top and that's sort of the the logic of V4 and what we did there um however uh you know even though the protocol is not out yet it is not Beyond roasting um so I think that the main uh you know the main problem we have with you know spot V4 is that we actually managed to make liquidity fragmentation worse and routing even harder um so you know uh the way this works right before it makes routing harder because it massively increases the number of liquidity pools that are available and increases the complexity of riding

across them uh you know instead of there being you know one uh one or a few pairs per a few pools per pair now there's like potentially infinite and then the arbitrary logic that can be introduced by Hooks also increases the can increasing complexity of routing so for example if you have a pool that like requires some additional checks or or move the price in an unexpected way or something like that routers have to be aware of that and so the the problem of routing across many pools gets harder and it actually was already extremely hard um so I have the routing problem extremely hard we have quite literally hundreds of thousands of liquidity pools at this point um and uh we have you know multiple features uh soon to be infinite we have

multiple protocol versions uh we have I don't know seven to tennis chains I've kind of lost track of chain deploys um we have you know all these problems around front running an Mev and trade-offs between you know gas related trade-offs so it's a really complicated problem um and then one we've been you know looking to tackle head-on uh something we've been working on for a while now um so excited to announce a project called uniswap X uh it is a new phone um no it is a auction-based routing protocol um so you know how does human swap acts

work basically and we'll get into some of the benefits in a second but even swap X basically works by you know all orders uh now start off as off-chain signatures uh today most orders are you know are transactions that are submitted directly these are off-chain signatures uh which we are calling Dutch orders so these orders are essentially auctions um the price you sign an order that says this is the price I'm willing to accept and that price goes down a little bit over time um attempting to you know optimize the price that you get uh so the price decays until a transaction is filled or it times out um you know there is a a new party of users these are actually kind of old users in Disguise uh called fillers uh they compete to fill the order first against each other uh the people you

know that do this are people that look like block Builders uh Etc today uh today um and I think that the important thing here is that you know uh today we have this this problem of front running and Mev where uh you know often you get the worst rate you're willing to accept rather than the best rate that is available and that's because you know people can reorder transactions within a block and move the price and so by creating structuring orders as you know competitive auctions uh you you attempt to get the best rate that someone can offer not the worst rate that you're willing to receive um uh additionally so auctions take time and having auctions happen more quickly um uh there can be tricks for that so

the the base protocol doesn't doesn't need this but there's an optional ability to parametrize these Dutch orders using an RFQ system which helps the auction happen faster um and so this is sort of what the the two variants look like um pretty simple you have you know a a starting price um so it's like the maximum price you might expect to get um and in the case the minimum price you're willing to receive but again uh the sort of way sandwiching works is that you often get the worst price you're willing to receive and what we expect here is that you will get you know the best price that is available uh when possible and you know uh complex trade-off space of parametrization but aside um then with the RFQ variant on the uh on the right um uh there's sort of this ability to

converge more quickly on the on the the initial price or the expected price um it still is a public auction so if someone has price Improvement on top of the RFQ winner uh that price can be overridden um uh but there is some minimum margin of improvement um okay so what is the point of all of this um technical decide uh really what we're trying to do is compete uh create a competitive Marketplace for trade execution uh so today you know in front ends most people use you know like they're like today in our front end right we have like a routing system it's open source it's called the auto router um but it's like one team and I think one of the biggest questions that we had when uh you know unit swap before was announced is okay like I create some new

custom hook how does this liquidity get discovered how is it found um and uh you know by creating a competitive marketplace where anyone can compete with each other to offer the best routes uh we expect that you know when there's some new liquidity pool that's created uh rather than having to be integrated directly it can be integrated instead of like a one-of-one integration you need it's a one of n or any possible you know filler uh can integrate with with these pools and and create liquidity I think just generally uh you know uh today right now like there is competit competition to interact with unisoft trades but it's competition between block Builders trying to extract the maximum value they can and what we want to create is competition to offer users the best prices

um so yeah you know it generally acts as you know a way of aggregating on-chain liquidity as well as off-chain liquidity um yeah it has some swapping benefits by moving to uh signed off-chain orders we can get you know uh basically a gas free swapping ux where you the the fillers pay the gas on behalf of the swapper um and so for the from the swapper they just have an input token and an output token so if you're swapping usdc for die you don't need to pay each fees um there is some minor caveats around like you still have to do token approvals unless your token supports signature based approves but we can ignore that um additionally there is no gas cost for failed transactions again because these are just off-chain signatures from from

the user's perspective uh so that is nice uh generally you know again kind of attempts to reduce the amount of value that is extracted by Mev uh people and kind of internalize it keep as much of the value for the swappers as possible um so there is an opt-in beta live today um it is a slow rollout so today when you go to the web app uh probably right now um I hope um then uh you know you have the option to opt in to uniform accent settings or it can pop up on certain trades um it's being rolled out slowly so you know you need time for like a more diverse ecosystem of fillers to come online uh time to test parameterization

of the system uh but yeah you know some trades might start routing through this in the short term and then over time we expect more and more trades and eventually maybe all trades or uh all trades where it can offer price Improvement to route through uniswap X um but that is not all we are announcing today we actually have another announcement um so this is Unified X the cross chain variant um you know I think that when you move orders we realized when you move orders to signed off-chain messages it actually enables a really interesting design space for cross chain um so you know these these signed Dutch order you know uh trades enabled cross-chain swaps and fast L2 exits so

how do we do this well first off these these orders can settle over almost any Bridge one way to think about is it can kind of ignore the bridging layer and it sort of works uh irregardless of the bridges that exist and can kind of settle over any of them um it also has a seamless ux for swappers so you know think the unit spot experience you have today um and that is achieved by having these fillers manage a lot of the complexity and latency so a lot of you know today when you interact with Bridges there are you know long delays and latency and today those are borne by users who want to move tokens between chains but here we can have them you know the the delays borne by fillers and swappers just you have the the uni swap the classic uni

swap ux um I think I'm pretty big unlock here is actually native asset swaps so I think you know swapping uh you know chains native to ethereum so tokens like ethon ethereum to you know op or Matic or you know native tokens of other chains uh avex Etc um and what this actually does it reduces exposure to bridge risk so today most uh you know the way that most of these if a lot of people want to move tokens between trades simply because they want to make between chains simply because they want to make trades and what happens you know you you let's say you like my you you move your tokens into a bridge that then has a representation of that token on another chain and then that token is sitting and then you swap that in like an amm uh and

what that means is that liquidity providers on the other chain are exposed to bridge risk kind of perpetually um with uh with this sort of cross chain design that we have here Bridge risk is really only born while the transactions are in flight and until they settle and so and with the native asset swaps you sort of reduce the amount of tokens that are just sitting idly in bridges which kind of act as like a bit of a honey pot and we sort of all know uh the the bridge space today and how that has sort of played out um you can quickly talk through the um the life cycle of you know a cross chain border um so basically you know to start we have a signed order and the uh the um you know it's a normal Dutch order so

fillers are competing actually that's this is this one but uh failures are competing to offer the best price for that order and whoever wins basically and submits a transaction on the uh origin chain uh to basically claim that order uh that locks the swappers input tokens uh right so we're no longer we're no longer synchronous we are asynchronous so the swappers input tokens are now locked in a Esco smart contract on the input chain um and then the filler now have to fill the the swapper on the uh destination chain so they send the swapper the chain uh the the output tokens on on that chain and that initiates a message through a bridge which uh you know releases the funds back to the info tokens back to the filler and so in this

way the bridge latency is borne by this filler and the swapper can have very quick uh settlement um now this this sort of bridge uh thing can actually also be further improved because this proof doesn't need to be this proof can be optimistic so rather than waiting for the bridge you can assume that it was filled unless someone does some sort of challenge so kind of similar design space to like optimistic Roll-Ups where you can have an optimistic settlement game here um which which we like and uh so so how does this kind of all work together I think that like you know one thing to think about is that unusual V4 is really you know aiming to be like this this really powerful amm platform for LPS and developers so you can think about amms as ways of creating liquidity

um and ways of building on top of liquidity as a as like a as like a primitive as a money Lego as we call it and it's not um and but but interacting with amms and on-chain liquidity which is a really powerful force is something that you you know that like is always going to need a lot of complex logic like there's there's always going to be like gas issues and Mev and there's like a whole design space around this so you can think of unisoft X as like a tackling from the other end how do we optimize trades for swapping um and and it should be like very highly synergistic with universal V4 um so before we have liquidity creation uh units of X we have you know uh trade routing you know trade execution

um aggregation and just creating a better user experience for swappers um so this is like a this is a first step I I really want to highlight this you know the goal is building this like highly decentralized uh filler Network um there is like a broader ecosystem-wide effort working on very similar project uh problems um so so what we're doing is starting to step into the same space as people who say words like intense and Mev and ofas and you know all these conversations on like the routing problem um there's a lot of work to do it's like a very complex design space that is in in its kind of early days and there's still a lot of improvements to make over

where we are today um just you know better scaling uh you know user privacy I think privacy is like a really important way for further um you know optimization of trade execution and I just want to say like generally we are at unusual I was really excited to kind of collaborate with all the other teams in the space you know projects like flashbots Etc um that are working towards these shared goals with us um so uh sometimes sometimes we feel like this um which is you know like what okay so like it's the first step but it's you know a first step towards what and uh you know I'd say that

generally what we're working towards is we want to decentralized markets to outcompete centralized ones and and there's a reason because you know decentralized markets uh I believe can really achieve much better outcomes for users uh far greater transparency you know removing Central points of failure Central points of control uh but also actually competing you know creating like more efficient market structures uh faster you know Market structure iteration um and uh just you know uh really creating systems that Empower users and and create like highly competitive products built on top of them um I think maybe like an even under stated uh benefit is like the the sort of ability for people to build on top uh without getting kind of like rugged by

the platform they're building on so when you think about like the Twitter API or the Reddit API and sort of the changes that happen there um but we don't want to do this you know like today I think people who use decentralized platforms tend to do it because they uh you know care about decentralization I actually believe this um I think that you know today it's still like more expensive to use decentralized platforms by a good amount Market structures are still a little bit less efficient um the user experiences are still much more complicated and that's not really like a you know if we want adoption of decentralized markets we can't compete like we have to actually compete kind of like on Merit and uh even for people who

don't purely care about decentralization um in the abstract but we need to actually deliver like more tangible value that that uh you know can can be directly realized um and so you know I I think that the important thing here is that like we we don't We're Not Afraid like if we want you know I I personally think that like all in the long run basically all value should be tokenized um all values should be traded on chain uh because I think that we can really memes are the most important form of value um clearly this is an actual uh slide from a a I think the series B pitch deck I don't remember which one um but uh but did not change the size of the size of memes

um but uh yeah I think that like you know in the long run just having uh you know interoperable systems having all shared infrastructure for all forms of value um and having those these markets be you know highly decentralized just is a is like a far better more transparent um more kind of user aligned World um but if we want to get there I think that like the market structures that exist today are very far away from where they need to be um to kind of like fully realize this and so uh you know to me it's I'd say that like you know in the past we've kind of like reinvented you you know we went from unified V2 to unified V3 and it was kind of like a complete like upending of how you thought worked and I think that like to me like stagnation is

kind of the worst thing and so uh what I'm really excited for is to just continue to push at the Forefront and kind of like innovate on how Market structures can and should work there's like a huge amount there's like a huge open field design space here uh you know ZK proofs and and um and just uh you know further iteration on the like OFA design space um so that's mostly what I you know and and so like you know we can't I'd say that like maybe the one final thing is like I don't think that achieving this outcome is inevitable I think that like we can make it happen and like we should make it happen because I think it's a better world um so excited to do that um with you all uh it's a group effort um and that's mainly what I wanted to

talk about so thank you all um excited to be here sure [Applause]