Balancer: Custom AMMs and Liquidity Solutions - Fernando Martinelli. Ep. 584

31 Jan 2025 · 1:04:36

Epicenter host Friederike Ernst talks with Fernando Martinelli about Balancer's evolution from multi-token pools that mimic traditional finance indices to Balancer v3's hook-based architecture. They cover boosted liquidity pools that combine LP fees with money-market yield farming, MEV mitigation through CoW AMM, scaling automated market makers to layer 2s, and how Balancer works to prevent stablecoin depegs.

Speakers

Topics

Transcript

amms didn't need to be only the simple version of x x yal k which implies that the pool always has like the same amount of value in both in both tokens and discovered that it's possible to have uh any number of tokens with any weights that you want like pretty similar to uh what an index fund or an ETF would look like and that was Baler balancer V1 uh we launched in 2020 and um yeah since then we went more from an enduser Focus protocol to a developer Focus protocol where people can build their own amm Innovations uh on top of balancer so we went in that direction with balancer V2 there are people who say like emm are

what what they are now and there's not much to to do but then we see uh a lot of interesting things like priority fee mechanisms balance of V3 is a b that this is going to keep happening and we want to be this platform for people to try new things around amm design welcome to epicenter the show which talks about the Technologies projects and people driving decentralization in the blockchain revolution I'm FR an and today I'm speaking with Fernando Martinelli the co-founder of balancer protocol before I speak with Fernando um let me tell you about our sponsors this week though if you're looking to stake your crypto with confidence look no further than course one more than 150,000 delegators including institutions like

Bido Penta capital and Legend trust corres one with their assets they support over 50 blockchains and are leaders in governance or networks like Cosmos ensuring your stake is responsibly managed thanks to their Advanced me research you can also enjoy the highest staking rewards you can stake directly from your preferred wallet set up a white label note restake your assets on Iona or symbiotic or use the SDK for multi-chain staking in your app learn more at chorus. one and start staking today this episode is proudly brought to by nosis a collective dedicated to advancing and decentralized future nosis leads Innovation with circles nosis pay and metry reshaping open Banking and money with Hashi and nosis VPN they're

building a more resilient privacy Focus internet if you're looking for an L1 to launch your project nosis chain offers the same development environment as ethereum with lower transaction fees it's supported by over 200,000 validators making no chain a reliable incredibly neutral foundation for your applications nosis Dow drives nosis governance where every voice matters join the nosis community in the nosis Dow Forum today Deploy on the evm compatible nosis chain or secure the network with just one gno and affordable Hardware start your decentralization journey today at nosis doio Fernando

it's fantastic to have you back on um last time you were on the show was was actually four years ago it's a really long time remind us um in crypto it's a it's a generation or more yeah it's like in four years it's at least one generation so remind us how how did balancer um get started and how has it developed since 2020 when we last had you on yeah so um I've um always been a fan of um of crypto in general Bitcoin coin and and ethereum and got involved in the early days of maker Dow worked with run and Nikolai and um was active um active in the discussions around amms and it

was the early days in 2017 even before that and um the idea came in 2018 when I realized that amms didn't need to be only the simple version of x times y equals K which implies that the pool always has 50/50 like the same amount of value in both in both tokens so um yeah I I kind of slap Le little for some nights and and went through lots of maths um and discovered that it's possible to have uh any number of tokens with any weights that you want like pretty similar to what an index fund or an ETF would look like and um and that was Biser Biser V1 uh we

launched in 2020 and um yeah since then then how it evolved we went more from um like an enduser focused protocol to uh developer Focus protocol where people can build their own amm Innovations uh on top of balancer so we kind of um went in that direction with balancer V2 and even more so with balancer V3 which we can talk about now but it's been a a long journey and um yeah a lot a lot of people now Beauty and balancer so very very glad that uh we're here still like doing doing interesting stuff and yeah very happy to be here with you again Shri super nice um so maybe let's talk

about the very early days of amm so kind of like in my View kind of amms were very much developed as a stop Gap measure because kind of I mean people had been used to um Central order book exchanges offchain but um implementing them on chain is actually very difficult because everything is kind of is exante it's it's public right kind of like and you can front run things and so that's kind of how amms kind of started off um how how do you see um the evolution of amms in this space how have they matured yeah it's crazy how how we learn

things that today in h highsight uh feel just obvious but we it took us like uh a full four years maybe until today we're learning new new stuff but like only a year after we started amm we started discussing things about like uh impermanent loss and then um me which then evolved to lvr loss versus rebalancing and uh we realized that there were lots of U Dark Forest AR uh Bots that were being uh they mean in a way like sandwiching innocent users and then things like cow swap um came came around to to make ethereum more fair or

fairer and uh yeah so there there's been a lot of evolution and then Unis swap came with the with their V3 change in the the landscape with concentrated liquidity which was definitely groundbreaking but that itself introduced some uh new challenges like just in time liquidity where like um LPS put 100% of the liquidity in a very short tick or narrow tick when a big swap happens and then people who are providing liquidity with a longer range they just um yeah got that their they get their lunch eaten by by those guys who only apply to that narrow um tick because they they get proportionately

almost all the uh the fees so with new innovation comes new challenges and and uh I think we're still learning today there's lots of interesting things that we're doing at Baler and others are doing as well around uh mitigating math and and lvr and our profits and and really trying to return the um the let's say the profit or the the surplus of the operations to the end user instead of to validators or to the MAV Bots or or Arbors we really want to um to make sure that the users get all of the like the return for the risk they're taking by providing liquidity or by doing trades

as innocent good flow as we call them so very excited I think balance R V3 is all about this bat that amm are still in their uh in their infancy there are people who say like mm are are like what what they are now and there's not much to to do but then we see uh a lot of interesting things like priority fee mechanisms like discussed by Dan Rob who's a an OG uh and and and and someone we all look up to and uh yeah some some very interesting ideas that keep coming up so I I I think balance of3 is a bat that this is going to keep happening and we want to be this platform for people to try new things um around amm design

yeah there's a lot to unpack here and I think I kind of want to defer most of it until later in the episode so but I think it it we should note that amms um are extremely susceptible um to me and lvr just because you're always at a disadvantage if if you're the maker right kind of like you ideally want to be the taker and kind of like if you have stay liquidity and kind of like um prices have changed um that's uh really detrimental and then also on top of that if someone kind of um actually is somewhat sophisticated um taker um this potential

Revenue that should ACR to the to the makers it often actually goes to arbit Treasures so kind of they they they kind of lose on both sides um and kind of I think kind of we we should talk about how to um how to mitigate me a little bit later um so kind of um if if when I think about other things that kind of have changed for um amm over the past four years or so um it's kind of efficiency in cost reduction right kind of like so you talked about um this simple constant product Market maker and kind of this this also has changed dramatically right right exactly yeah I think that there

are like this is a a definitely a there are two examples of amm innovation where efficiency comes in terms of uh Capital efficiency which means how much price depth or how much um useful liquidity for Traders which uh is translated in terms of that dep how much you can trade for a given amount of dollars you deposit into a pool and uh curve came with the the first in my opinion innovation in in that regard for packed tokens and uh we also have an implementation of of um yeah stable swap on on baler and uh yeah and Unis swap also innovated in terms of uh making

those positions nonf fungible so anyone can express their opinion in terms of what range they want to provide liquidity in which has also its challenges so yeah I think there is different ways you can talk about efficiency and different challenges that those those um yeah ways you solve efficiency bring to the tableh so you you already kind of mentioned kind of the main competitors in the amm landscape so there's Unis Swap and curve and curve very much launched with um staes in mind where kind of say you you trade one USD stable coin against another and then kind of there's um very there's um very high

liquidity kind of at um kind of at the point kind of at uh in the middle so kind of you can trade them against each other um really if efficiently kind of like even large sums which is not usually the case with you know vanilla amm and the other one's Unis swap so kind of how how would you how would you say balances positioned with respect to both of these yeah we're a bit in the intersection and really exploring like the like build build your own amn so amm's made easy it's it's really kind of you have those two and then you have balancer kind of an action but also

expanding through third- party teams um like some of which we're going to talk about like cow swap uh building the CM with Baner and and gyroscope and safe finance and U and lots of others so yeah we I think we we are really positioning ourselves as a platform not taking um any preferences or any favorites saying like we're going to be just like many token pools you know that that is something that um curve can do but it's not in a way that we can do like with flexible weights and flexible amm logic so we can have uh up to eight tokens per pool and uh the main thing that we're not decided is strategically not to

chase after because we we think that they already do a good a very good job at is concentrated liquidity so Unis swap has um pioneered that that concept and we believe that we uh can add more value to the Space by focusing on fungible liquidity so whenever you think of baller you have uh a pool token that is like a representation of a share of a pool where all the users are equal so there's no risk of like there are sophisticated players doing just in time liquidity so there are LPS just for the transaction and take all the fees from the other poor LPS that are uh humans so we we uh solve this by focusing on

fungible liquidity but within fible liquidity you can have concentrated liquidity as well which is something that gyroscope is pioneering within balancer so um yeah it's a it's a invariant shape that follows the the shape of an ellipse that's why it's an elliptical pool uh eclp concentrated liquidity elliptical concentrated liquidity pool so there are other ways to do interesting stuff without giving up on the fungibility so that that that that's how I I would put baler amongst the other competitive when you look at non-fungible and fungible liquidity so to me it's pretty clear why nonf fundable liquidity um would be

preferable in in many instances just because you can kind of you can do very concentrated Li liquidity where you're comfortable kind of providing it and kind of you you it's much better um apy potentially if you're doing it right um why what are the advantages of doing um fungible liquidity yeah so fungible liquidity is really about uh setting a Level Playing Field like you you ensure that sophisticated players cannot come and and and grab your lunch using uh just in time liquidity so it it kind of sets um a known and and easy to manage like

something that I call set and forget or uh yeah the positive forget uh whereas if you're dealing with concentrated liquidity of course you can be more efficient and say like I want to trade if between 3,200 and 3,300 and I'm going to make more fees than people who have a univ V2 pool or basard uh pool but like you have to be very active you have to make sure that as soon as your um your liquidity goes out of range then you need to Reby half of the tokens to uh to go back to to the play or position your your position um your your op position closer to where the price is which means you're re buying for more than you sold for or

you're selling for less than you bought for though it it it it comes with a lot of uh caveat so I would say concentrate Equity is better for active more sophisticated uh professional market makers and uh and fungible liquidity is better for uh in I would say like um passive LPS might be uh have a not a bad connotation but I think that's what it is like there's a lot of people who want to just um put the money in an in an LP position and forget so um those are safe because the environment does not let uh active Traders kind of come and eat their lunch for example through just in time liquidity or

through more advanced techniques that um the normal human passive LPS are not um in a in a position to do or to perform that makes a of sense um so uh balance of V3 just came out or came out a short while ago um so what are um what are the main goals of V3 over V2 yeah so V3 is really taking that idea of uh balancer is a platform for amm Innovation stad further so a lot of the hard work we put and yeah we spent like almost two years working on V3 uh maybe more is is really towards like making easier for anyone to develop their own

pool or to innovate uh with their own amm idea so Dev The devx Experience improved by 10x at least it's very much easier a lot easier to create your own pool you only need to Define an invariant um and and that's it all the functions like swap or add liquidity remove liquidity they all stand from this definition of invariant whereas in V2 you had to Define all the different function functions like swap in for out swap out for in and they could be um conflicting so you could have an amm that is uh not consistent so it took more more care for uh amm designers to make sure that everything was uh

consistent whereas V3 as I said you just like have this invariant like the the shape of of the of the curve of your amm and then uh bouncer does everything it does um scaling it does grounding it makes sure that your amm cannot be um exploited through rounding because we we do like rounding at the Vault level uh in the direction of the pool um so we we're kind of taking away a lot of the burden that am ammen designers needed to to carry about um uh to worry about sorry nv2 uh to the to the Vault we have this idea of um transient accounting so you can do lots of transactions add

liquidity remove liquidity Swap and then at the end you settle your um your tab let's say like like your at a bar and you you drink and then just at the end you pay your bill so it's it's similar um and and by the way a lot of the things we we did for balancer um V3 are similar to some things that uh unisoft V4 also has we even changed our names to make sure that we we have the same names as as unit before because we want people to like yeah that are used used to unisoft before to also look at Baler V3 and and see if it's a good or better fit so we also have hooks which make it easy for um specific things that you do before and after swap to be applied to a

different set of of pools without having to rewrite all the pool code which was possible in between to so you can always deploy a pool with uh with a specific code that uh is customized by you so with the hooks on BAL of V3 you can just reuse hooks that exist and we have a few examples of of that and the maybe the coolest thing for the end user I think about Bal of3 is the the new idea of um boosted pools 100% boosted pools we we had that in balance of V2 and uh we're improving that by making like before they weren't 100% boosted uh we're making them 100% boosted and we do that

by and it's kind of technical so yeah maybe I I'll just stop here and I can talk more about how it works for but I'm very excited about boo so which means that instead of like having to choose between Landing uh your say D or usdc on a or adding liquidity uh to an LP with your usdc and die or usdc and E you can do both like you can um add liquidity using your die and then under the hood balancer will deploy all that d die to um to B to a um and turn it into a die so uh people are trading D in USC or D and and W but in the like under the hood

balancer is making sure that this is being lent out to a and uh all of your position is earning yield so this is pretty cool and that's super cool because um yields on particularly US dollar Sables are really high so kind of competing with this um kind of as a liquidity provider is really difficult um tell us how this works under the hood and kind of why it was difficult to going from partially boosted pools to fully boosted pools great question yeah so the way it so first why why is it difficult like in in essence it's not hard like we what you can do and curve does that but um

it's not very popular because of the the reason why it it's not um yeah simple to do it which is like you could just have all the liquidity go to um a tokens let's use a as an example but it could be other Ling protocols so if uh you want to have like both the swap fees like being an LP and also have the lending protocol you can just put your a um paired with a an A usdc on Baler and then uh people can trade a DI for a usdc but this is not what people want to trade people have die people have usdc they don't have a usdc or a d or the WAP version of those tokens so really the

trading happens in the underlying token right in in D and USC not in uh lending wrapped versions of those tokens um so you could solve that by having very um kind of sophisticated aggregated like logic which one in has and and others uh like kof also have you can uh abstract away that from the end user and say to the end user you're trading die for USC but I am going to a I'm gonna wrap it and then I'm going to trade on bacer and then I'm going to give it back to a you know and do all that back and forth which costs a lot of gas so this is quite hard to do because of uh a lot of

gas so what we did to solve this in balance of V3 uh and we don't have no one has that so it's a pretty unique Fe feature um which is what we call buffers so what we do is very simply we have um it's like a mini instance of a inside the balancer vault which has like a little bit of a and a little bit of D and then everybody who trades using balancer Vault they um they trade actually they see die as liquidity but they trade with uh in the pool that has a and aosc which is earning 100% of you for lpce but then balancer the The Vault looks at the buffer so the buffer is

kind of um has a die and die and Reps and wraps with the same rate as a but much cheaper because it only reads the rate um that a is offering without having to if you had to wrap using a or unrap you would have to do all the update of the accounting of of the whole like pool of of a so uh that's quite gas intensive even though a is super efficient and has improved efficiency over time it's still quite gas heavy so what we do is we use this buffer and then like let's say you trade uh a little bit of die for USC you put D in the vault The Vault put puts D in this buffer takes some wrapped uh or some a d

trades with the pool that has a usdc and then the a usdc goes to the buffer of usdc uh and then the user gets usdc so the user has the um like the the the experience of trading die for USC and there's no external calls to a because the buffer um the buffers of D and USC are enabling that trade then of course what can happen is the buffer doesn't have enough die uh or USC to give back to the user because the user is doing a big trade that that's where I think the the cool thing happens is um that when when the buffer so the buffer goes back and forth back and forth and then

whenever there's a big trade then uh the buffer doesn't have enough so balancer knows that the The Vault knows that and goes to a and then wraps or unwraps exactly the amount needed for the trade to be executed plus giving putting the the buffer back in the middle which means that this user that did a big trade they're paying for the buffer to be put Into The Sweet Spot which is right in the middle so for next trades smaller trades it can go back and forth back and forth and still um yeah save a lot of gas for subsequent trades so this is um this is something really neat that I think we are just starting to to explore and one one um one thing that I uh think a lot of people think is that

in Layer Two it's not very relevant um how much gas you spend because gas is so cheap more so on ZK rollups because um yeah it's really free processing but uh I think that it's still it still can make a difference between like two sources of liquidity say Baler and uniswap if Baler has slightly less gas for that trade then uh that liquidity will be used by solvers on C swap or by uh by one inch or whatever aggregator matcha so I do think that the gas discussion even though last relevant for l2s it's still uh it can still be like a a differentiator for sources of

liquidity it will also become more relevant again once blobs fill up right so kind of like I the only reason why l2s are currently as cheap as they are is because kind of blob space is uh pretty abundant 100% we'll always be reaching that scalability like moment where like all things are going to be expensive because we filled up the uh yeah The Ledger and we need we need more more space and keyso go up so yeah absolutely how baked um into the designers are could we could you in principle kind of switch this out for another money money market or does it does it have to be a or will there be um other versions that kind of use um a

different money market so a is definitely our preferred partner we've been uh together for a long time we're uh very close and they used bouncer for their 8020 pool for providing liquidity in the AV token so it's also the B like longest most battle tested protocol around so we're definitely um yeah kind of biased towards avoc but the protocol is neutral so the smart contracts work with uh um a wrapper which is a 4626 so as long as your uh token is 4626 compatible then you can you can use a boosted pool so other protocols like um like Moro and um Oilers looking into it

there's there's also already other protocal that have boosted pools on balance already so it's definitely an open thing but of course we um yeah we we we kind of uh have a at least in thei and thei is is controlled by its own team that has their own opinions but um I think the the standard option is a so it's just because we we trust them so much qu yeah that's that um makes sense um when you say kind of it's fully boosted um I I take it the part that's not boosted is the buffer right and I mean the size of the buffer kind of has to be um somewhat in relation to the total pool size and the the the average trade size I assume so kind of like when

you say fully it's probably like 95 or whatever percent right it it is full because that that's that's a great question it the buffer is not um paid or is not filled by the LPS so the okay yeah the LPS only put their liquidity in the pool and by the way if there is no buffer it's fine because that means that all the all the transactions will have to W add gas using yeah exactly so it's just a plus if you have a buffer it reduces gas for most of the trades and like I said perfectly put like depending on how big the buffer is the more trades it can um kind of um enable without having to resort to to an external call uh what

how how we deal with buffer so far is the projects are uh putting liquidity there because like protocols usually have uh protocol on liquidity so you don't need a lot to enable most of the trades in the buffers the uh protocols that are creating boosted pools are pretty 100K sometimes 200k in the in the tokens that they want to boost and very nice as well is that one token is uh so you only need one buffer to boost a token and that token can be in many different pools so if you have a buffer for a die and a die then a die can be in like a die USC a die eth you know a die whatever every time you do this lag

which is U boosted die then you use the same buffer so it's kind of a a shared uh common good that um helps everyone it's to Safe gas cool yeah that makes a lot of sense so when we talked about kind of like new features for um V3 kind of the the first thing that you kind of mentioned was improved Dev experience so kind of like making it easier for Dev to kind of build um uh good uh well-designed amm on top of um on top of balancer um and the other thing that kind of you mentioned but didn't really go into was hooks I'm interested in in this so kind of um hooks um are kind of modular customizations um tell us about um what

kind of logic um you see and what kind of logic you expect to see in the future great question so hooks are really like this uh very interesting way to open up experimentation without um creating dangers for developers or LPS and also kind of re reusing reutilizing code that's better tested so that that's the beauty of hooks in my opinion um an example of of interesting Hook is you change the the swap fee based on whatever like parameter for example priority fees those are uh very useful for mitigating math or lvr in uh in

chains that are priority C Fe sequenced an example l2s right l2s yeah so base is um it uses it can change there's nothing set and stone but differently from ethereum L1 they just take like the the uh the transactions and order them by priority and execute them the base like coinbase is not interested in uh in doing money with uh me at least so far thankfully yeah so if you are if you're trying to be an a MAV bot and you uh you want to capture a very good opportunity let's say sandwich someone uh to be able to get that opportunity what you going

to do is you're going to put a high priority fee for you to be like the first one to to get it right uh what we do is we we have a hook that says read the priority fee which is something that is like readable in the transaction um and then we say like that priority fee if it'sit above a threshold which is kind of to safeguard users that are using metamask or other wallets that always have some small priority fee um as standard uh know up up to five uh gay for example uh if you pass that threshold then you're considered to be a bot that's trying to extract ma from the poor LPS should because because kind of

you're you're paying to kind of be early in the sequence and kind of like get to fulfill um some sort of vulnerability or kind of like AR against something that won't be there for for a long time right kind of like exactly perfect exactly so what we do is like we we calculate the swap fee of the amm so we make the price worse less attractive as as much or or or proportionally to how much the priority fee goes up so if you if you if we read a transaction that has a very high priority fee uh we we increase the swap fee to uh extract more value to the LPS so uh this way we effectively make sure that if you're trying to get me by

paying too much the sequencer we say the price is worse so it's kind of a very very interesting way to say uh the the the share of profit that this MAV opportunity created will go to our users and not to to you bot like taex the Bots exactly it it's it's a it's based on a an article I don't I don't think it was the first uh article talking about that but then Robinson as I mentioned um wrote a very interesting uh paper this and we're we're like implementing it I think it's the first first amm that's doing that so the like the very flexible um infrastructure of balance of V3

allows that and we're I think we're launching it like next week or so we're already uh it's already audited so and also the cool thing as I mentioned of hooks is that they only have a very small surface of um kind of a interaction or or or Surface of attack because with a with a swap hook you cannot uh it's it's a view function you cannot it it only Returns the swap the new swap amount and uh swap percentage and that itself cannot um it's provably not something that can drain the the amm or for LPS in Risk because the worst it gets is uh fee goes to 100% And then the trade is like it no one is going to trade with that pool but it cannot be

negative which would be uh draining the pool so it's it's something that people can just interact and interact and and innovate iterate a lot without the risks uh that amm design um bring with it cool what other hooks are you working on or looking forward to yeah so we have uh the priority fee hook we have the stable surge hook which is very interesting as well so if you have a a stable pool so to asset that are um correlated like USC and I if the the peg is lost or is broken then you have like I don't know let's say die for 70 cents the the stable surge hook what it does is it

charges a higher fee towards the side that you don't want the pool to go so if you if you want to dump more die and and make the pack go even worse there's a higher fee whereas the fee that brings the pool back to the the pack to where we want it to be is is lower or even zero can't be negative because that opens up problems but uh it can be virtually zero so we kind of incentivize the spread to go towards where we want the pool to go so that that's an interesting one what do you do with um a stable kind of DS for a good reason right kind of like so for instance um say um someone has invoked the global settlement with maker and then kind of

die deegs I mean that's pretty reasonable um wouldn't you have to kind of disable this hook uh no because that's a good question like what the hook would would do is it would just like not enable trades in that direction so uh let's say the the the swap fee or spread grows a lot so there's no trades between 80 cents or a die and 60 cents so even though the price is like um 79 right it's almost almost 80 which is the upper margin where we want the the amm to trade it still uh has all that margin to go back and forth to the 60

where our amm is just saving our users so in a way it's protecting the LPS by not giving away more let's say usdc which is the one that's still at $1 because yeah it it's not worth it so it's a tradeoff between swap fees so we we give up on being traded on so generating swap fees because there's a lot of cases or most cases when the peg is broken it's something that could be dangerous and it could mean that uh there's a problem in one of the tokens and then the the pool will just uh get drain or or or drain all the good tokens so uh that's another cool thing of the stable Sur the more you get to uh to the

peg being broken the the more you protect the token that's still in pack and you don't you don't sell it so yeah it's it's it's fine it's you don't need to deactivate AC at but um you still like we you you trade blast it's it's like um giving up on swapping fees swap fees for um yeah the chance protecting LPS and and in in the event that that dpeg is not going to be permanent or is something like uh temporary or related to a bug or or some instability of the system but as an LP you're always um allowed to withdraw assume anytime yeah that's that's a a premise that b also

has it's actually enforced by The Vault uh we have functions that allow the LPS to withdraw their liquidity without even talking to the pool contract at all so uh yeah and that that's that's just super important like any any pool uh that has code that could be broken because of a bug or whatever uh balance the Vault enable it's almost like now that I think of it it's almost like the L2 kind of uh having this um forced exit mechanism you know if the L2 stop creating blocks then you can go to the L1 um and and and just force a withdrawal of your L2 funds uh and

Bridge them back so it's it's kind of similar The Vault doesn't need to talk to the pool to allow users to withow their funds yeah I I think I think a lot of l2s don't actually have this implemented yet but they say they have or they say they will have or they should have but we're going to get to this eventually it's one of the stages of yeah the ladder of elus right cool you alluded to this kind of like in the very beginning of the podcast so kind of you um talked about Meb mitigation kind of we already touched on this kind of with and the priority fee hook where kind of you surmise that kind of like anyone who's willing to pay a um higher tip um is uh uh is probably trying to do

um extractive and it's not just trying to be nice to um the sequencer um so um there there's another me resistance U mechanism uh with cow amm um can we talk about that because kind of like that's um uh that's less circumstantial in a way kind of right with um the priority um fee hook um kind of you're just assuming that because someone's willing to pay for first uh for the first spot that they're trying to do something malicious or extractive how does how does it work with um the CM great question yeah as always it's

like a a a trade of I think uh my personal preference is uh What uh cow swap does or the CM that's powered by by cow swap which is really the like so to to to take a step back like M stems from the the fact that there is adverse selection so there is a um an unfair as it said uh s dry like the the the the LPS are like they are onchain like you cannot update prices instantly there's like block times and that there's gas cost to change things on chain whereas Traders they they have instant information you have like all sorts of

uh flow of transactions and me so you have a lot more um oversight of the price of assets you have access to all the offchain information so it's it's really an unfair game what cow swap does and I'm big fan of cow swap um by the way is like they they bring this knowledge to the table by having this competition between solvers and they they make sure that the there's a surplus that has to go to the users and the the solver that maximizes Surplus to the users in in this case the cimm is considered a user which is uh like the whole the whole novelty of of this design like usually only users that put

trades uh on cow swap are considered users and they get the Surplus for CM the amm itself is like a user so it also has like the surface included in the calculation for the for the winning solver so it it really so cop allows this um this this kind of disadvantage of um onchain LPS to to kind of um yeah be counteracted counterbalance so with with KM you are sure that you are selling whatever you have in your uh in your uh amm pool for the market price because there is competition between solvers and the one that provides the km

with the most Surplus is the one that's going to win so it's really like you you have like a a a swap fee that is um it's not it's varable so like I said like you can increase the swap fee to give more value to the LPS by looking at the priority fee or you can increase the the swap fee uh by looking at how the competition between the the solvers is willing to to give more to the LPS to get this trade so it's it's two ways of uh returning value to the lce and uh yeah I I like it a lot because it's um it's just it has more information from the whole ecosystem it's not just some

some mad Bots that are doing uh like trying to extract and giving to the sequencer through priority fees it really involves all the solvers of cow swap which is getting bigger and bigger and has more and more uh participants so it's it's fair and fair but the the problem is the the the downside is that it's not permissionless as the priority fee hook so the priority fee hook the beauty of it is that anyone it's like open anyone can post their transaction on on the base sequencer uh whereas for km it works if you uh allow only solvers of C or C swap to interact with that with that liquidity so it it's that trade-off but in my opinion as C swap

grows bigger and bigger and and there's lots of uh solvers and a lot of U uh diversity in the solver ecosystem I think this is a a trade-off that we're willing to do and we're going to publish some results soon but we're super excited like with smaller pools on um C mm we have much better APR uh aprs from SWAP fees than like compared to Baler vanilla weighted pools or Unis swap V2 pools like like even being a lot bigger CM pools are doing a lot more APR uh so kind of protecting the users and and giving back um uh yeah swap piece to them as compared to the conventional unisoft V2 or balancer amm which is amazing

something we're going to be building on more and more and we're going to expend km to uh to Baler V3 which is something we're working on right now are there kind of like benchmarks that you can give us so kind of like how much um more APR can I expect to kind of get as an as a Ka M MLP so I I've I've just today seen some some numbers by the cow uh swap team and uh it's sometimes like four 5% annualized um in pools that are much smaller so the results are really like really promising and I'm not going to give you any hard numbers because uh I might be wrong and more like more uh

judicious analysis has to be done but it it's as as much as like 5% annualize more but it makes sense right because like what cost does is really like it it lets people trade with the price of the market uh even though the pool has uh stale price like you said it the the competition ensures that the pool gets its uh its fair value for the the assets which increases the um the APR considerably so toxic waterlow is effectively just filtered out perfect that's right yeah cool one more thing that we also kind of like tangentially already touched on and that's kind of um scalability and um kind of your L2 and

multichain strategy kind of like what we've seen increasingly in kind of like the etherum ecosystem is that um liquidity has splintered dramatically between different l2s and contrary to kind of what um what we had hoped for initially these l2s are very much not interoperable so kind of like despite the fact that um they have this um shared security layer um you you still have really long settlement time so in principle kind of like say go from arbitrum um to Bas and back um it'll take you two weeks you might as well send a postcard to the other side of the

world right so kind of um so what what you actually have is um you have um you know OB charage between different l2s and kind of like it's very liquidity intensive and and so on um H how do you guys think about um balances kind of multi-chain and multi- L2 strategy that's a very hard question and like I'm just representing My Views uh I can't speak for all the balancer Community but I I do think that this is such a hard problem and uh one that a lot of people are working on on very very good people much more intelligent

than than me for sure but uh probably than the than our team um and with a lot more resources so I I do think that we we should not try to create you know new uh prodical sport uh cross chain swaps or or or things like that I think we we should try to kind of stay uh in our lane and make sure what we do we do uh the best we can um and and yeah I I'm a I'm not a fan of going the app chain route I think this is going to cause even more uh fragmentation like you said even if you're part of the like the super uh optimistic chain um or you you have a base roll up I think there there

is always fragmentation that is going to happen maybe it's solved in future and again I hope that those Brilliant Minds in the in the ethereum space are are going to be able to to solve it uh as a user it hurts me a lot to to to have that um fragmentation I like I said it's not not good you ask and goes like in the direction of all the like salana versus eth uh like Northstar and everything that I think I don't think we we need to get into but uh so yeah we are trying to be as good as we can in uh in what we do but what when it comes to our strategy for multi chain we we want to be in the chains that our like our

partners require or want us to be so we don't want to be on all chains because it does kind of dilute you know like U capacity of the team and making sure we can execute uh with uh Excellence so but given we are a protocol for autos subul and top we have to be on the on the chains that our partners like you know Quant amm they have very interesting kind of uh strategies that use ZK proofs we don't haven't talked about them but uh uh I hope we have some time to but uh yeah teams like like like them like they want to be on you know ZK sync or whatever uh chain it's it's kind of uh how we're we're approaching our strategy

we want to be supporting the teams bu on top of baller and our close arners as much as possible and uh we're not tackling directly the the challenge of like cross cross chain swaps or or liquidity yeah at the moment at least yeah I think that's fair it's it's it's a hard problem let's kind of dive into the other um bigger projects building on top of balances so kind of you you already mentioned Quan amm that'd be super um interested to kind of hear more about them um the other thing that kind of really piqued my my attention was a gyroscope um so maybe you can give us kind of like a short

overview of what they do and how they leverage um balancer sure yeah so um disclo disclosure I am an investor and engine investor in both uh those protocols so I I'm biased um but I do think they're amazing gyroscope has been around for a long time they are basically um yeah this this the initial idea is and I think it expanded a bit but is to have this uh GID uh coin which is is a stable coin that is based on like how to compartmentalize risk and make making sure that whatever you have in your basket of assets that collateralize your

stable coin if something fails or goes off bag you still have the kind of the System Dynamics to avoid like a a dpeg of this uh coin that is basically built by uh collateralized bmm pools on top of Biser so it's quite big brain stuff but uh yeah has been created by by really brilliant guys um that yeah from from uh from the UK that I've been uh yeah very very much a fan of since the early days and I think they're they've been around for maybe four years already um so yeah they also created the E that I mentioned

it's a very gas efficient amm based on elliptical curves or elliptic curves um yeah so they they are amazing and they have built some balancer V2 and are are now migrating to balancer V3 and kind of an as an aside it was great to see how the devx increased or improved because most of the migration process was like deleting code you know you delete this this and it's very very much a watered down version of V2 is what they need for V3 so kind of validated our um our hopes of increasing improving ex uh Quant amm is really about like this initial like original idea of

balancer as uh an index fund and it's actually something we're pursuing not only with quantm but with uh with cow amm and cow swap as partners this idea of like um index funds and ETFs on chain like the main reason why and I I'll talk about that but just Quant mm it's really like how how to have in indices and um ETFs or exposure of like a pool of assets with uh a very smart kind of management that's done on chain potentially with uh ZK proof so you have very uh complex strategies that you don't want to um make public for people to kind of copy you or front run you so

they have strategies that are all implemented on chain but use ZK U ZK proofs or um yeah ZK chains to make sure that uh it can be implemented on chain without uh disclosing what it is and in a gas efficient manner so it's it's really like using balance of 3 as a an asset manager and um and doing very sophisticated strategies we're very excited about them they got a grant they got uh funding from other VCS and um yeah we're we're launching um I think they're already in beta and uh and they're going to going to be quite big I I think on B3 so I I was saying about the apart

from quantm this idea of uh indices and ETFs I think we have tried that in the past and I think it was just not the time uh it was too early you know it's like um I know that feeling you know like my space and then uh Facebook comes at the right time executing the right way so the I think the the one thing that was missing back then and was the C for indes like index Co-op uh which I I I love I think the idea was great like they leaked a lot of value because of uh this uh adverse selection like Arbors and Traders have onchain offchain information and they just extract slowly um the value from those indices by uh

having better prices than the market but now we have the tools we just talked about to prevent math so all of a sudden IND indices chain are thing again so you can have exposure to uh Nvidia and other uh other like assets real world assets and and have an index fund on baling by the way we launched uh with uh the like help of car like actually their initiative carpet key which is part of the noses family as you know uh amazing guys they yeah together with backed they launched the first pool where you can like trade assets and stocks like n media uh and you can only do that in uh on balancer so that that

uh yeah that that is something that excites me a lot about the yeah the future of of balancer and amm in general and it's got um amazing uh yield as well so uh exactly it's like I'm I I'll make sure my lawyers don't hear this otherwise kind of like they'll uh not they may be deleted for financial promotion but uh yeah I mean it's kind of like the the years you can currently get on chain it's kind of in things um that are not inherently risky or not inherently more risky than doing it on Robin Hood um is is is uh insane exactly so Fernando kind of like when I kind of zoom out a bit kind of I heard two two

somewhat different stories about kind of like who you guys are catering to right kind of like on one hand you're catering to people who just W to let their capital is sit there and not be sophisticated Traders um and on the other hand you're you're kind of looking to cater um to protocols so kind of like if if I were kind of a business person kind of I would you know I would kind of differentiate the these into kind of like b2c and B2B Toc kind of branches um how how do you think about them and how how difficult is it to kind of like um Corral them if into one product Suite that's an yeah great question and and I

agree with you that that impression might be uh floating around for for listeners or or um for you so the way I would frame it is like the end goal is really to be a a platform for other others to build on top and innovate using their own amm idea so the the the focus is for others to build in balancer and I would say that we what we're doing by having our own types of pools or uh joint projects like like the C with C Swap and uh investing or or being very closely related to uh Quant amm and gyroscope what we're doing is like we're trying to give examples of uh successful

projects or or or protocols that are built on on balancers so uh with the priority fee hook for example our main objective is to showcase how to use balance b3s Hooks and um make sure that other bavs or or teams know like have an example of something that works so yeah it's really like bootstrapping balance of V3 or balance in general for others to look at us and see there is like cool things that we can build on top of balancer so uh once we have some traction and lots of teams building a tougher balancer and uh and and and kind of creating cool cool stuff then I think more and more our Focus

will kind of transition to help helping others like unblocking them as opposed to our team uh and there's like many companies or teams in the balance ecosystem as opposed to our teams directly involved in new projects like we want to be enabling others to build interesting stuff uh in the Bas ecosystem so that that's how I would uh if it makes sense uh how I would frame it absolutely then I want to zoom out even more um so we kind of started off this episode by kind of um elucidating how amms were initially kind of this stop Gap thing that kind of uh enabled us to kind of do um onchain trading

without opening ourselves up to being uh to being sandwiched to death um now that kind of we have much more advanced cryptography in principle um we could put Central Ledger order book exchanges back on chain so do you think amm um are going to be an interim solution or is there is there kind of a longterm space for them in the ecosystem I think it's the it's the latter I think there is long-term um space for them in the ecosystem there is always going to be like the fast trading like um high frequency

strategy um teams or Bots that are probably going to use more concentrated liquidity or or OBS uh um centralized order limit order books uh that that is just more efficient and if you can do that on chain it's it's even better and you have like chains like salana that want to be you know like um the the ones where where people can do that it brings with itself scaling problems U there will be l2s on on ethereum that will be kind of um more suitable for that but I do think there's always going to be some space for um passive LPS who want to just deploy Capital to uh to

let's say L1 or an L2 that has higher fees and they they don't want to be like actively trading or managing their positions so even in in today's landscape let's say in the future nothing like new is created there's no breakthroughs which I doubt I'm pretty sure not going be the case even in today's uh landscape I think there is space for amms uh but given that amms are evolving and there's like ways you can um mitigate lvr and and and Mev this is going to be in my opinion even more so the case that there is space for amms this is my kind of bad I could be wrong but I I I I'm pretty

sure like some people called amm like that there's just like x times of y equal K and that's it and then unisoft V3 came and then like lots of things that we're doing came and I'm sure like in four years it will be hard to recognize the the space and how much it will have evolved so I'm I'm on the not saying mm are going to dominate and be the one in all but I'm sure there's going to be room for them in the future pretty sure and going on past data and four years is going to be when we will have you on again so kind of we we can kind of take pick up where we left off then exactly so Fernando where can listeners learn more where can they kind

of um uh start interacting with um the balance ecosystem where can they start building their own protocols on top where can they kind of contribute Hooks and so on yeah I think the best way where you can ask questions and interact is discord. balancer. that's where um most technical discussion take place of course there's our Forum forum. balancer. um and our docs as well if you go to balancer. you're going to see all the all those different um links but also of course the the X handle app balancer is where we talk about the latest and we have um some some spaces and discuss with Partners uh so yeah I

think that that's where you should find us perfect thank you so much for coming on Fernando thanks we thank you for having us it was a big pleasure