XY=K Liquidity: Unstable by Design | ETHTaipei 2025
ETHTaipei·Thu, Oct 9, 2025, 12:00 AM
XY=K Liquidity: Unstable by Design | ETHTaipei 2025
Transcript
[Music] Okay. Uh my name is Foley and I'm here today to talk about um actually it's not uh unis swap, it's uh XYK liquidity. So um I realized that last night when I was making the slides and I you know I didn't want people to think I was like talking unis swap. I think a pretty good protocol. Uh but I do have some problems with the uh the V2 implementation that they have.
It's actually a very like commonly used uh you know AMM. Uh so it's this talk is specifically about how XYK is uh probably not the best liquidity structure. It has nothing to do with unis swap. Um but yeah, let's let's get started. Okay.
So, uh I I kind of want to get a gauge of like people's familiarity with uh this topic. So, uh just by show of hands, uh do people know uh how many people know like what XYK is or have heard of it? Okay. So, like decent decent amount. Uh yeah.
So, uh for those who don't know, um XYK is like a type of market uh automated market maker uh helps price liquidity on dexes. uh and it's actually the most like adopted onchain liquidity curve that we use today. So, if you, you know, did any kind of DeFi farming in 2020, um, if you've ever, you know, done a swap on Chain, uh, if you ever bought a memecoin on Pump. Fun, all of those things, uh, probably used the XYK curve. And so, you know, you actually interacted with this, uh, maybe if you didn't didn't know it.
Um, and the way it works is actually very simple. So uh in this pool when you make a trade uh this curve will just price you know your your trade based on how many tokens it has in the pool. Um so when you say XYK X refers to you know one side of the token supply times another side of the token supply that creates a constant. Uh and so when you you know do a swap you just have to make sure that the K stays the same when you change one of the supply you know numbers on the side. So like for example if you know we have a liquidity pool it has 10,000 USDC and 200 tokens in it then K would be 10,000 * 200 which is 2 million.
So if someone wants to buy two tokens that you take the 2 million which is the constant you divide that by 198 is the number of tokens that they're taking from the pool and you end up with 10,11. So in this example, someone would be paying $101 to receive two tokens from the the AMM and they would get an average price of like, you know, $50.50. And so that that's generally how it works. Um, and uh, first I kind of want to talk about why it's good.
Uh, because it's the most commonly used thing. Everyone uses it. Uh, and and the reason comes down to simplicity. So the nice thing about, you know, AMMs is they're they're very simple. You just put the tokens in and the whole system will handle the liquidity distribution, the liquidity rebalancing.
You never really have to worry about managing a position. Uh it's just going to, you know, generate fees for you and and it it's a very passive strategy. So uh there's other alternatives out there today. you know, there's unis swap v3, there's order books and things, but people don't really use them because you need to set up systems to integrate with them to, you know, rebalance them. Uh, so yeah, XYK is a very passive strategy.
But I would say aside from that, there's actually no real other benefits. Um, being simple is probably its only, you know, strong suit. Uh, but it it actually has a lot of problems and we'll go into them. So the first problem is that this curve is very dumb. Uh what I mean by that is the way that liquidity is provisioned uh actually has they they don't know anything about the tokens that they're selling or buying.
Um so the XYK curve is just a math equation that defines you know a a kind of arbitrary you know invariant. um it doesn't know like the tokconomics the the market cap of what it's trading and it always has to assume actually that there are infinite tokens that it can be buying and selling at any given time and uh because of this uh it means that there's always going to be liquidity in this XYK pool that will never ever be used. Um, so even if you know every single token is sold into, you know, one of these pools, you'll actually find that at the very end there's actually going to be some money left over in the, you know, in the pool and that money belongs to nobody. So it's kind of wasted. Uh, and you see this with like pump pump fun coins.
If you guys traded meme coins, um, even if you know all the billion coins get sold, you you'll see like six, seven soul in the pool left over for every single pump fund coin that's deployed. And it's because uh of this curve and so you know on a small scale maybe it's not a big deal it's one or two pools but over a large aggregate you know like industry where almost every coin has a V2 pool it's actually a lot of money wasted um because it doesn't really know what's going on about the liquidity that it's providing. Uh okay so it's not just dumb. Uh the other problem with that is uh uh it's very lazy. So XYK is a very passive strategy as I said but it doesn't react to things that are happening in the market.
So uh it only worries about how many tokens it has at any time and it doesn't take into account you know recent volume recent uh price action volatility um so it doesn't it's not very aware market aware of the behaviors of the people that are trading with it. Uh and I think that becomes a big problem as you know markets are getting more advanced. Maybe in 2020 it's not a big problem. You know, people are just trading doing whatever. But now that we have like real institution institutional players have like real uh significant flows uh and and at scale this is starting to become a lot of issues the the leakage right so uh because it's a static uh strategy it's very easy to manipulate and to gain this liquidity uh system.
Uh the common things that you know we see a lot is um there's like sniping and bundling. So the XYK pool will just you know gather a lot of the liquidity at the very you know beginning of the launch price. Makes it really easy if someone's coming in you're doing a fair launch for someone just snipe up the entire supply. You saw this with meme coins as well. There's like a lot of bundles.
People started talking about it. Oh, you know is it bundled? Who bundled it? Um and and it's because of this liquidity curve that allows that to happen. Yeah.
Uh the other issue is you know uh me and arbitrage attacks. People are able to clip out the prices on the the pool because it's very static. It doesn't respond to you know the outside price adjustments. So until someone comes in and takes the free money, it's not going to update its price. Uh and also uh the other issue with this is uh it's very easily exposed to oracle attacks because the liquidity is super thin.
It's easy to manipulate the price with not a lot of capital. And so recently I think a lot of people if you trade you saw like Hyperlid had to uh delist a token called Jelly Jelly. Uh it's traded on an XYK curve. It's a very thin curve and so they're able to you know uh do some price manipulation on that. Uh and so even you know some of the best projects uh can't really avoid the issues that um this curve like presents.
Okay. And uh I would say the third issue uh with XYK is that it's very inefficient. um it spreads the liquidity evenly across the entire curve. So, I kind of talked about this before, how there's always going to be a little bit of that money left over. Um but the other problem with this strategy is that you have a lot of money sitting in the pool, but it's never ever going to get used uh for any purpose.
It just sits there. It's completely wasted. Uh to me, it feels like, you know, with these pools, you have like you built a highway and this highway has like six lanes. uh but you only allow cars to drive through one of the lanes and the other five lanes just sit there for everyone to to look at and uh not use. And you know a lot of times when you're trading in these pools that's what it feels like.
Okay. So um the the reality is like uh we've been using this curve for basically everything that we've done in crypto. And we talk a lot about how oh you know crypto coins are very volatile. Things kind of you know always trend towards zero. Um, and we blame a lot of people for a lot of things.
Oh, you know, investors or the team is rugging or and I'm not saying that these things don't happen, but I also think that, you know, we have to look at what's facilitating these problems in crypto. And to me, a lot of it comes back to the XYK curve because, you know, if you're trying to do like the DeFi like staking yields or rewards and you're trying to sustain the value of those emissions, um, and you're doing this on this price curve, it's going to be very hard for people to create sustainable economic models when they don't have the right like, uh, liquidity infrastructure to support it. So, uh, it's kind of tongue and cheek, but, um, the solution is, uh, potentially a project that I'm working on called Baseline. Um, and what we're trying to do is we're actually trying to, uh, have a liquidity management system that's as simple as XYK. So, you just deposit tokens in, uh, you know, it autorebalances for you.
It's a passive strategy. You never have to worry about your pricing. Um, but it has a little bit, you know, uh, more intelligence as to how it's calculating the liquidity, right? So one of the things that uh we're going to try to do in baseline is we um deploy liquidity with more awareness about the tokconomics of the system. So instead of just saying oh how many tokens do I have in this liquidity pool for the price we actually think about what's the circulating supply you know how much of it is currently in you know outside the liquidity pool that we need to buy back uh in order to create something safe and uh create price ranges that help balance out that volatility.
So uh with something like baseline uh you can actually calculate the exact amount of liquidity that's required to buy back the entire circulating supply of any token. So you can know like okay this is the minimum value that we can guarantee in the liquidity pool. We can be more aggressive about defending certain pockets of value uh and things like that in ways that unis swap doesn't know. And I just want to kind of give um some uh uh ideas of what this might look like in theory. So one of the things that we've done is we've uh actually run simulations trading simulations where we deployed a baseline liquidity pool and unis swap liquidity pool um with the same starting parameters and um run uh some trading against it to see how the price charts will look.
So uh the in here you see that the blue is the baseline price and the red is the unis swap price. Both pools start with 40 ETH of liquidity in 200,000 tokens in this simulation. um it's 20% of the total supply into the pool uh with 100 uh 1 million total tokens and um uh we're running the same trades for both. So you can kind of notice that uh in the second uh in with the blue um the volatility is kind of dampened. Something you notice right off the bat, you don't have as much of the you know spiking on the top um near the top of the trades and then as the price cliffs off.
It's obviously not a a fun chart to look at cuz nobody likes to see the numbers go down. But what you do see is that you know the the liquidity can be buffered uh much higher and so the ending price um is is a little bit better than you know the unis swap pool. Um but then there are other things about this I think that make it interesting that you're you don't see under the hood. So for example uh on the right side uh is the supply of this simulation for both the pools. Um so it's not just the price that's really interesting.
If you notice um on the supply with the unis swap v2 curve uh by the end of the trading simulation there's actually still some surplus tokens that has sold. So it's been net dilutive to the market about 30,000 tokens extra. Uh even though the price has dropped all the way down there's still extra tokens that people bought that they need to kind of sell back to the curve. Uh and then in the baseline system uh we started out with you know a higher or we ended up with a higher price but we also actually created a uh less uh supply by the end of the trading simulation. So we did a net buyback of about 50k uh tokens in the pool and uh for for a total difference of about 80,000 tokens.
it's almost 10 uh like 8% almost of the entire supply uh in terms of supply difference just from you know the the uh curvature change in the liquidity we're able to create this better price action and the last piece that you can see is uh I would say the liquidity depth on the bottom right of the chart this is just showing what percentage of the supply you need to be buying or selling to move the price 2% so how much slippage do you actually get and we're able to consistently provide higher uh and deeper liquidity than the unis swap curve. We lose less money in the pool for doing it. And a lot of it just comes from the fact that we have more knowledge about how many tokens need to be traded and can be traded because you know we have the supply and tokconomics in in mind. Um and so uh that's just a quick simulation. Uh what does this actually mean for you and why is it important?
Like why why do I I care about talking about this? Uh and the reason is because if you trade crypto, it it means literally more money in your pocket. So when we did uh an ROI simulation, the the trading simulation was done with about 50 different randomized agents that would have these um you know randomized volume on certain conditions, bullish, bearish, and chop market. and able to find that if you take the ROIs of all these agents at the end of the trading simulation, you'll find that on average uh baseline uh pools generate more ROI both from an average and a standard deviation. So in in a distribution more people make more money uh from trading these pools and the maximum ROI also is is higher for baseline.
And so you can see that the liquidity uh of the pool is actually determining the outcomes of the market participants that are trading in it. And so if we want to have you know better projects, more success with our tokens, uh I think this is something that we actually have to look at more deeply and think about more deeply. Um and then I don't know if we have time for this, but I just show it really quickly. This is uh one of the things that we have in production. Uh it's it's our token.
Again, it's another chart that goes down. So, uh not that great to look at, but it's really important to highlight something here. Uh which is that we recently um in in uh a token we've launched called uh Yes, it was around uh 51 million market cap. We had someone sell I think almost $2.5 million uh in a single day.
Uh and the price went down about 15%. Uh which is not great. But in in this case, uh our project is still running and it's still smooth. uh if we used an XYK pool uh the the the price would have tanked by almost 65%. Instead of the 15% that we experienced um the market cap would have less than you know halfed uh and I think a lot a lot more troubles would have come from that.
So uh it's it's cool you know to see this kind of like price uh price action in in in production. Yeah. Okay. And uh that's all the the time I have for so uh thank you very much for coming to my talk. Uh if you guys want to learn more about like liquidity systems and you know what we're doing at Baseline, feel free to you know scan the QR code and give us a follow on Twitter.
Thank you very much. [Music]
Automatic transcript — names and jargon may be misspelled.