Amms didn't need to be only the simple version of X * y = K,
which implies that the pool always has like the same amount
of value in both, in both tokens and discover that it's possible
to have 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 that was Balancer, Balancer
V1 we launched in 2020. And yeah, since then we went
more from an end user focus protocol to developer focus
protocol where people can build their own AMM innovations on top
of balancers. So we went in that direction
with Balancer V2. There are people who say like
Amms are what what they are now and there's not much to to do.
But then we see a lot of interesting things like priority
fee mechanisms. Balancer V3 is a bad 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
and the production revolution. I'm Federica ANZ and today I'm
speaking with Fernando Martinelli, the Co founder of
Balancer Protocol. Before I speak with Fernando,
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 Bit
Go, Pantera Capital and Ledger Trust.
Course one with the assets. They support over 50 block
chains and are leaders in governance on networks like
Cosmos, ensuring your stake is responsibly managed.
Thanks to the advanced MEB 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 Eigenia or Symbiotic, or use the SDK for multi chain staking
in your app. Learn more at Chorus .1 and
start staking today. This episode is proudly brought
to you by Gnosis, a collective dedicated to advancing a
decentralized future. Gnosis leads innovation with
Circles, Gnosis Pay and Metri reshaping open banking and
money. With Hashi and Gnosis VPN,
they're building a more resilient, privacy focused
Internet. If you're looking for an L1 to
launch your project, Gnosis Chain offers the same
development environment as Ethereum with lower transaction
fees. It's supported by over 200,000
ballot errors, making Gnosis Chain a reliable and credibly
neutral foundation for your applications.
Gnosis Dow drives Gnosis governance, where every voice
matters. Join the Gnosis community in the
Gnosis Dow forum today. Deploy on the EVM compatible
Gnosis Chain or secure the network with just one GNO and
affordable hardware. Start your decentralization
journey today at gnosis dot IO. Fernando, it's fantastic to have
you back on. Last time you were on this show
was was actually four years ago. It's a really long time.
Remind us. 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 get started and how has it developed since 2020 when we
last had you on? Yeah.
So I've always been a fan of of Krypton General, Bitcoin and
Ethereum and got involved in the early days of Maker Dow worked
with Ruin and Nicolai and was active, active in the
discussions around AM NS. And it was the early days in
2017, even before that. And the idea came in 2018 when I
realized that AM miss didn't need to be only the simple
version of X * y = K, which implies that the pool always has
5050 like the same amount of value in both, in both tokens.
So, yeah, I, I kind of slept, slept little for some nights
and, and went through lots of maths and discovered that it's
possible to have 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, and that was Balancer.
Balancer V1 we launched in 2020. And yeah, since then how it
evolved, we went more from like a, an end user focus protocol to
developer focus protocol where people can build their own AMM
innovations on top of Balancer. So we, we kind of 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 yeah, a lot, lot, a lot of people now beauty and Balancer.
So very, very glad that we're here still like doing, doing
interesting stuff. And yeah, very happy to be here
with you again. Cedric, super nice.
So maybe let's talk about the very early days of AMM.
So kind of like in my view, kind of AM miss, we're very much
developed as a stop gap measure because kind of, I mean, people
had been used to central order book exchanges off chain, but
implementing them on chain is actually very difficult because
everything is kind of is ex ante.
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. How how do you see the evolution
of AM Ms. in this space? How have they matured?
Yeah, it's crazy how how we learn things that today in
hindsight feel just obvious. But we it took us like for four
years, maybe until today we're learning new, new stuff.
But like only a year after we started the AMS, we started
discussing things about like impermanent loss and then MEV,
which then evolved to LVR loss versus rebalancing.
And we realized that there were lots of dark forests, ARK bots
that were being there mean in a way, like sandwiching innocent
users. And then things like cow swap
came, came around to to make Ethereum more fair or fairer.
And yeah. So there, there's been a lot of
evolution. And then Uniswap came with, with
their V3 changing the the landscape with concentrated
liquidity, which was definitely groundbreaking.
But that itself introduced some new challenges like just in time
liquidity where like LP's put 100% of the liquidity in a very
short tick or narrow tick when a a big swap happens.
And then people who are providing liquidity with a
longer range, they just, yeah, got them there.
They get their lunch eaten by by those guys who only apply to
that narrow tick because they they get proportionally almost
all the the fees. So with new innovation comes new
challenges and I think we're still learning today.
There's lots of interesting things that we're doing at
Balancer and others are doing as well around mitigating math and,
and LVR and our profits and, and really trying to return the,
the, let's say the profit or the, the surplus of the
operations to the end user instead of to validators or to
the math bots or, or arbors That we really want to, 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 bouncer V3 is all about
this bat that AM miss are still in their in their infancy.
There are people who say like AM miss are are like what what they
are now and there's not much to to do.
But then we see a lot of interesting things like priority
fee mechanisms like discussed by Dan Robinson, who's a, an OG
and, and, and, and someone we all look up to.
And yeah, some, some very interesting ideas that keep
coming up. So I, I, I think balance of V3
is a bad that this is going to keep happening and we want to be
this platform for people to try new things 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's it.
We should note that Amms are extremely susceptible to MEV 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 prices have changed, that's really detrimental.
And then also on top of that, if someone kind of actually is
somewhat unsophisticated taker, this potential revenue that
should accrue to the to the makers, it often actually goes
to arbitragers. So kind of they, they, they kind
of lose on both sides. And kind of I think kind of we,
we should talk about how to how to mitigate MEV a little bit
later. So kind of if, if, when I think
about other things that kind of have changed for Amms over the
past four years or so, it's kind of efficiency and cost
reduction, right? Kind of like so you talked about
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 definitely there are two examples of AMM
innovation where efficiency in terms of capital efficiency,
which means how much price depth or how much useful liquidity for
traders which is translated in, in terms of bad depth, how much
you can trade for a given amount of dollars you deposit into a
pool. And Curve came with the, the
1st, in my opinion, innovation in, in that regard for packed
tokens. And we also have an
implementation of, of yeah, stable swap on, on Balancer and
yeah, and, and Uniswap also innovative in terms of making
those positions non 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's different ways you can talk
about efficiency and different challenges that those those,
yeah, ways you solve efficiency bring to the table.
So you, you already kind of mentioned kind of the main
competitors in the AM landscape. So there's unit swap and curve
and curve very much launched with stables in mind where kind
of say you, you trade one USD sable coin against another.
And then kind of there's very there's very high liquidity kind
of at kind of at the point kind of at in the middle.
So kind of you can trade them against each other really
efficiently, a kind of like even large sums, which is not usually
the case with, you know, vanilla AM Mississippi and the other
one's uniswap. 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 and really exploring like the like build,
build your own AMM. So AM Ms. made easy.
It's, it's really kind of you have those two and then you have
Balancer kind of an intersection, but also expanding
through third party teams like some of which we're, we're going
to talk about like Cal swap, building the Cal AMM with
Balancer and, and Gyroscope and safe finance and, and lots of
others. So yeah, we, I think we, we are
really positioning ourselves as a platform, not taking any
preferences or any favorite saying like we're going to be
just like many token pools. You know, that that is something
that curve can do, but it's not in a way that we can do it like
with flexible weights and flexible AMM logic.
So we can have up to 8 tokens per pool.
And 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 unit swap has pioneered that that concept and we believe that
we can add more value to the space by focusing on fungible
liquidity. So whenever you think of
Balancer, we have 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 they're sophisticated players
doing just in time liquidity. So they're LP's just for the
transaction and take all the fees from the other poor LP's
that are humans. So we we solve this by focusing
on fungible liquidity. But within fungible liquidity,
you can have concentrated liquidity as well, which is
something that gyroscope is pioneering within balancer.
So 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, ECLP, concentrated liquidity, elliptical
considerate 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 balancer amongst the
other competitors. When you look at non fungible
and fungible liquidity. So to me it's pretty clear why
non fungible liquidity would be preferable in, in many instances
just because you can kind of you can do very concentrated
liquidity where you're comfortable kind of providing it
and kind of you, you, it's much better APY potentially if you're
doing it right. Why?
What are the advantages of doing fungible liquidity?
Yeah. So fungible liquidity is really
about setting a level playing field like you, you ensure that
sophisticated players cannot come in and and grab your lunch
using just in time liquidity though it it kind of sets a
known and and easy to manage like something that I call set
and forget or yeah, deposit and forget.
Whereas if you're dealing with concentrated liquidity, of
course you can be more efficient and say like, I want to trade if
between 3200 and 3300 and I'm going to make more fees than
people who have a unity to poor balance or pool.
But like you have to be very active.
You have to make sure that as soon as you're your liquidity
goes out of range, then you need to rebuy half of the tokens to,
to go back to, to the play or position your, your position,
your, your LP position closer to where the price is.
Which means you're rebuying for more than you sold for or you're
selling for last than you bought for.
Though it it, it, it comes with a lot of caveats.
So I would say concentrated liquidity is better for active
more sophisticated professional market makers and and fungible
liquidity is better for I would say like passive LP's might be
have a not a better connotation, but I think that's what it is.
Like there's a lot of people who want to just put the money in an
in an LP position and forget. So those are safe because the
environment does not let active traders kind of come and eat
their lunch, for example, through just in time liquidity
or through more advanced techniques that the normal human
passive LP's are not in a in a position to do or to perform.
That makes a lot of sense. So balance of V3 just came out
or came out a short while ago. So what are what are the main
goals of V3 over V2? Yeah.
So V3 is really taking that idea of Bouncer is a platform for AMM
innovation step further. So a lot of the hard work we put
and yeah, we spent like almost two years working on V3, maybe
more is is really towards like making it easier for anyone to
develop their own pool or to innovate with their own AMM idea
so that the Dev X 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 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 functions like
swap in for out, swap out for in and they could be conflicting.
So you could have an AMM that is not consistent.
So they took more, more care for AM designers to make sure that
everything was consistent. Whereas V3, as I said, you just
like have this invariant like the, the shape of, of the, of
the curve of your AMN. And then bouncer does everything
it does scaling, it does rounding.
It makes sure that your AMN cannot be exploited through
rounding because we we do like rounding at the vault level in
the direction of the pool. So we're kind of taking away a
lot of the burden that MN designers needed to carry about
to worry about. Sorry, in B2 to the vault, we
have this idea of transient accounting.
So you can do lots of transactions, add liquidity,
remove liquidity, swap. And then at the end you settle
your, your tab. Let's say like, like you're at a
bar and you, you drink and then just at the end you pay your
bill. So it's it's similar And, and by
the way, a lot of the things we, we did for Balancer V3 are
similar to somethings that, you know, swapped before.
Also has we even changed our names to make sure that we, we
had the same names as as uni before?
Because we want people to like, yeah, that are used, used to
unisop before to also look at the Balancer V3 and, and see if
it's a good or a better fit. So we also have hooks which make
it easy for 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 V2.
So you, you can always deploy a pool with, with a specific code
that is customized by you. So with the hooks on Bouncer V3,
you can just reuse hooks that exist.
And we have a, a few examples of of that.
And maybe the coolest thing for the end user, I think about
Bouncer V3 is the, the new idea of boosted pools, 100% boosted
pools. We we had that in Bouncer V2.
And we're improving that by making like before they weren't
100% boosted, 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 and I can talk more
about how it works, but I'm very excited about boosted Puzo,
which means that instead of like having to choose between landing
your say, die or USDC on Avid or adding liquidity to an LP with
your USDC and die or your SDC and E, you can do both.
Like you can add liquidity using your dye and then under the
hood, balancer will deploy all that dye to to bad to Avi and
turn it into a dye. So people are trading dye and
USC are dying and and wet. But in the like under the hood
balancer is making sure that this is being lent out to Avi
and all of your position is earning yield.
So this is pretty cool and. That's super cool because here
it's on, particularly at U.S. dollar stables, really high.
So kind of competing with this kind of as a liquidity provider
is really difficult. 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 in curve does that, but it's not
very popular because of the the reason why it it's not yeah,
simple to do it, which is like you could just have all the
liquidity go to a tokens. Let's use Avi as an example, but
it could be other landing protocols.
So if you want to have like both the swap fees like being an LP
and also have the landing protocol, you can just put your
a die paired with an AUSDC on balancer and then people can
trade a die for AUSDC. But this is not what people want
to trade. People have die, people have
USDC, they don't have AUSEC or a DIE or the wrapped version of
those tokens. So really the trading happens in
the underlying token right in in die and USC, not in landing
wrapped versions of those tokens.
So you could solve that by having very kind of
sophisticated aggregator like Logic, which one inch has and
and others like COSOP also have. You can abstract away that from
the end user and say to the end user, you're trading the eye for
your CC. But I am going to Ave.
I'm going to wrap it and then I'm going to trade on Balancer
and then I'm going to give it back to Ave. you know, and do
all that back and forth, which costs a lot of gas.
So this is quite hard to do because of a lot of gas.
So what we did to solve this in Balancer V3 and we don't have,
no one has that. So it's a pretty unique feature
feature, which is what we call buffers.
So what we do is very simply we have a it's like a mini instance
of Ave. inside the Bouncer vault, which has like a little
bit of a dye and little bit of dye.
And then everybody who trades using Balancers vault, they they
trade actually, they see dye as liquidity, but they trade with
in the pool that has a dye and AOSEC, which is already 100% of
Ute for our piece. But then balancer that the vault
looks at the buffer. So the buffer is kind of has a
die and die and wraps and wraps with the same rate as Avi, but
much cheaper because it only reads the rate that Avi is
offering without having to. If you had to wrap using Avi or
unwrap, you would have to do all the update of the accounting of,
of the whole like pool of of Avi.
So that's quite gas intensive. Even though Ave. is
superficiency 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 a little bit of dye
for your STC. You put dye in the vault, the
vault puts dye in this buffer, takes some wrapped or some a dye
trades with the pool that has a dye in your STC, and then the
AUSTC goes to the buffer of USCC and then the user gets USCC.
So the user has the like the the, the experience of trading
die for USCC and there's no external calls to Ave. because
the buffer, the buffers of die and USCC are enabling that
trade. Then of course, what can happen
is the buffer doesn't have enough die or USCC to give back
to the user because the user's doing a big trade.
That that's where I think the the cool thing happens is that
when, when the buffer, so the buffer goes back and forth, back
and forth. And then whenever there's a big
trade, then the buffer doesn't have enough.
So balancer knows that the vault knows that and goes to Ave. 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 puts 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, yeah, save a lot of gas for
subsequent trades. So this is this is something
really neat that I think we are just starting to to explore.
And 111 thing that I think a lot of people think is that in layer
two it's not very relevant how much gas you spend because gas
is so cheap, more so on ZK roll ups because yeah, it's really
free processing. But I think that it's still it
still can make a difference between like two sources of
liquidity, say Balancer and Uniswap.
If Balancer has slightly less gas for that trade, then that
liquidity will be used by solvers on cost swap or by by 1
inch or whatever aggregator matcha.
So I do think that the gas discussion even though that's
relevant for L2's, it's still, it can still be like a a
differentiator or sources of liquidity.
It will also become more relevant again once blobs fill
up. Right?
So kind of like. I mean, the only reason why L2's
are currently as cheap as they are is because kind of BLOB
space is pretty abundant. 100% we'll always be reaching that
scalability like moment where like, oh, things are going to be
expensive because we filled up the yeah, the, the Ledger and,
and we need, we need more, more space and keys will go up.
So yeah, absolutely. How baked into the designers
ABBA could we, could you in principle kind of switch this
out for another money money market or does it does it have
to be ABBA? Will there be other versions
that kind of use a different money market?
So Abba's definitely our preferred partner.
We've been together for a long time where they're close and
they use Bouncer for their 8020 pool for providing liquidity in
the AVID token. So it's also the bad like
longest, most battle tested protocol around.
So we're definitely, yeah, kind of bias towards Avid, but the
protocol is neutral. So the smart contracts work with
a wrapper which is a 4626. So as long as your token is 4626
compatible, then you can, you can use a boosted pool.
So other protocols like like Morpho and Euler is looking into
it. There's, there's also already
auto protocols that have boosted pools on balance already.
So it's definitely an open thing.
But of course, we, yeah, we, we, we kind of have A at least in
the UI. And the UI is, is controlled by
its own team that has their own opinions.
But I think the, the standard option is obvious.
So it's just because we we trust them so much.
Correct. Yeah, that's that makes sense.
When you say kind of it's fully boosted, 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
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.
The buffer is not paid or is not filled by the LP's.
So the LP's, yeah, the LP's 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 two. Sections will have to write it
right. 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 kind of enable without having to resort to, to an
external call. What how, how we deal with
buffer so far is the projects are putting liquidity there
because like protocols usually have protocol on liquidity.
So you don't need a lot to enable most of the trades in the
buffers. The 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. 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 ADI can be
in like a DIUSCCAD i.e., you know, a DI whatever.
Every time you do this lag, which is boosted dye, then you
use the same buffer. So it's kind of a shared common
good that helps everyone to save, yes.
Yeah, that makes a lot of sense. So when we talked about kind of
like new features for V3, kind of the the first thing that you
kind of mentioned was improved dev experience.
So kind of like making it easier for devs to kind of build good
well designed AM Ms. on top of on top of balancer.
And the other thing that kind of you mentioned but didn't really
go into was hooks. I'm interested in the in this.
So kind of hooks are kind of modular customizations.
Tell us about what kind of logic you see and what kind of logic
you expect to see in the future. Great question.
So hooks are really like this. Very interesting way to open up
experimentation without creating dangers for developers or LP's
and also kind of reusing re utilizing code that's better
tested. So that that's the beauty of
hooks, in my opinion. An example of of interesting
hook is you change the the swap fee based on whatever like a
parameter. For example, priority fees.
Those are they're useful for mitigating MAV or LVR in in
chains that are priority fee sequenced.
L twos, right? L twos yeah so base is it uses
it it can change there's nothing set in stone, but differently
from Ethereum L1. They just take like the the the
transactions and order them by priority and execute them.
The base like Coinbase is not interested in in doing money
with Med, at least so far, thankfully, yeah.
So if you are if you're trying to be a math bot and you you
want to capture a very good opportunity, let's say sandwich
someone to be able to get that opportunity.
What you're going to do is you're going to put a high
priority fee for you to be like the first one to do to get it
right. 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. And then we say like that
priority fee if it's above a threshold, which is kind of to
safeguard users that are using Madamask or other wallets that
always have some small priority fee as standard minimum up up to
five GUI for example. If you pass that threshold, then
you're considered to be a bot that's trying to extract MAD
from the poor LP's because. Because kind of you're, you're
paying to kind of be early in the sequence and kind of like
get to fulfill some sort of vulnerability or kind of like AB
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, we, we increase the swap fee to extract more
value to the LP's. So this way we effectively make
sure that if you're trying to get MEV by paying too much the
sequencer, we say the price is worse.
So it's kind of a very, very interesting way to say the, the,
the share of profit that this MAV opportunity created will go
to our users and not to to you. Box text the box.
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 article talking about that, but Dan Robinson, as I
mentioned, wrote a very interesting paper on this and
we're we're like implementing it.
And I think it's the first, first AM that's doing that.
So the like the very flexible infrastructure Balancer V3
allows that. And we're, I think we're
launching it like next week or so.
We're already, it's already audited.
So. And also the cool thing, as I
mention of hooks is that they only have the very small surface
of kind of interaction or, or, or surface of attack.
Because with a, with a swap hook, you cannot, it's, it's a
view function. You cannot it, it only returns
the swap, the new swap amount and swap percentage and that
itself cannot. It's probably not something that
can drain the the AMM or put LP's in risk because the worst
it gets is the 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 draining the pool.
So it's it's something that people can just interact and
interact and innovate, iterate a lot without the risks that AMM
design bring with it. Cool.
What other hooks are you working on or looking forward to?
Yeah. So we have the priority fee
hook, we have the stable search hook, which is very interesting
as well. So if you have a, a stable pool
SO2 assets that are correlated like your SCC and die if the,
the PAG is lost or is broken, then you have like, I don't
know, let's say die for $0.70. The the stable storage 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 dye 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 0 can't be
negative because that opens up problems, but it can be
virtually 0. 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 if a saver kind of D pegs for a good reason,
right? Kind of like, so for instance,
say someone has invoked the global settlement with Maker and
then kind of dye D pegs. I mean, that's pretty
reasonable. Wouldn't you have to kind of
disable this hook? 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 let's say the, the, the swap fee or spread grows a lot.
So there's no trades between 80 cents or die and $0.60.
So even though the price is like 79, right, it's almost, almost
80, which is the upper margin where we want the the AM to
trade. It's still 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
LP's by not giving away more, let's say USDC, which is the one
that's still at $1.00 because yeah, it, it's not worth it.
So it's a trade off between swap fees.
So we, we give up on being traded on, so generating swap
fees because there's a lot of case or most cases when the pack
is broken, it's something that could be dangerous and it could
mean that there's a problem in one of the, the tokens and then
the, the pool will just get drained or, or, or drain all the
good tokens. So that's another cool thing of
the stable storage. The more you get to, to the pack
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 it, but you still like we, you, you trade blasts.
It's, it's like giving up on swapping fees, swap fees for
yeah, the chance protecting LP's and, and in the in the event
that that DPAG is not going to be permanent or is something
like temporary or related to a bug or, or some instability of
the system. But as an LP, you're always
allowed to. Withdraw anytime.
Yeah, that's, that's a premise that bouncer has.
It's actually enforced by the vault.
We have functions that allow the LP's to withdraw their liquidity
without even talking to the pool contract at all.
So, yeah, and that that's, that's just super important.
Like any, any pool that has codec could be broken because of
a bug or whatever. Bounce the vault enable.
It's almost like, now that I think of it, it's almost like
the L2's kind of having this forced exit mechanism.
You know, if the L2 stop creating blocks, then you can go
to the L1 and, and, and just force a withdrawal of your L2
funds and bridge them back. So it, it's kind of similar.
The vault doesn't need to talk to the pool.
To allow users to withdraw their funds.
Yeah, I, I think, I think a lot of L2's 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.
Exactly. It's one.
Of the stages of yeah, the ladder of L2's, right?
Cool. You alluded to this kind of like
in the very beginning of the podcast.
So kind of you talked about Med 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
higher tip is, is probably trying to do something
extractive and it's not just trying to be nice to the
sequencer. So there's another MEB
resistance mechanism with cow AMM.
Can we talk about that? Because kind of like that's,
that's less circumstantial in a way, kind of right with them.
The priority fee hook kind of. You're just assuming that
because someone's winning to pay for first for the first spot
that they're trying to do something malicious or
extractive. How does how does it work with
the cow AM? Great question.
Yeah, as always, it's like a trade off.
I think my personal preference is what Cal swap does or the cow
AMM that's powered by, by Cal Swap, which is really the like
to, to to take a step back. Like MEV stems from the the fact
that there is adverse selection. So there is a, an unfair, as I
said, Sir, tricky. Like the, the, the, the LP's are
like, they are on chain, like you cannot update prices
instantly. There's like block times and
there's gas costs to change things on chain.
Whereas traders, they, they have instant information.
You have like all sorts of flow of transactions and man pool, so
you have a lot more oversight of the price of assets.
You have access to all the off chain information.
So it's it's really a, an unfair game.
What COW swap does, and I'm big fan of COW swap, 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 COW EMM is considered a user, which is like
the whole, the whole novelty of of this design.
Like usually only users that put trades on COW Swap are
considered users and they get the surplus for COW EMM.
The EMM itself is like a user. So it also has like the surface
included in the calculation for the OR the winning solver.
So it, it, it really so COW soft allows this, this this kind of
disadvantage of on chain LP's to to kind of yeah, be counteracted
counterbalance. So with, with COW AMM, you are
sure that you are selling whatever you have in your, in
your AMM pool for the market price because there is
competition between solvers and the one that provides the Cao
AMM with the most surplus is the one that's going to win.
So it's really like you, you have like a, a swap fee that is
it's not, it's variable. So like I said, like you can
increase the swap fee to give more value to the LP's by
looking at the priority fee or you can increase the the swap
fee by looking at how the competition between the the
solvers is willing to give more to the LP's to get this
straight. So it's two ways of returning
value to the LP's. And yeah, I like it a lot
because it's just, it has more information from the whole
ecosystem. It's not just some, some mad
bots that are doing like trying to extract and giving to the
sequencer through priority fees. It really involves all the
solvers of Cal Swap, which is getting bigger and bigger and
has more and more participants. So it's, it's fair and fair.
But the, the problem is that 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 the transaction on, on the base
sequencer. Whereas for CAU MMS, it works if
you allow only solvers of cow swap to interact with that, with
that liquidity. So it, it's that trade off.
But in my opinion, as COW swap grows bigger and bigger and, and
there's lots of solvers and a lot of diversity in the solver
ecosystem, I think this is a trade off that we're willing to
do in we're going to publish some results soon, but we're
super excited. Like with smaller pools on Cao
MMS, we have much better APRAPRS from swap fees then like
compared to Balancer vanilla weighted pools or unit swap V2
pools. Like like they even being a lot
bigger. Cao MMM pools are doing a lot
more APR. So kind of protecting the users
and and giving back, yeah, swap piece to them as compared to the
conventional Uniswap V2 or Balancer AMS, which is amazing.
Something we're going to be building on more and more and
we're going to expand COW MMS to to Balancer 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 more APR can I expect to kind of get
as an as a cow AM MLP? So I, I've, I've just today seen
some, some numbers by the Cal swap team and it's sometimes
like 4-5 percent annualized 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 I might
be wrong and more like more judicious analysis has to be
done. But it, it, it's as as much as
like 5% annualized more. But it makes sense, right?
Because like what COSOP does is really like it, it lets people
trade with the price of the market even though the pool has
a stale price. Like you said, for anything it
the the competition ensures that the pool gets it's it's fair
value for the the the assets, which increases the the APR
considerably. So toxic would have lowers
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
scalability and kind of your L2 and multi chain strategy.
Kind of like what we've seen increasingly in kind of like the
theorem ecosystem is that liquidity has splintered
dramatically between different L twos.
And contrary to kind of what what we had hoped for initially,
these L2 are very much not interoperable.
So kind of like despite the fact that they have this shared
security layer, you, you still have really long settlement
time. So in principle, kind of like
say go from arbitrum to base and back, it'll take you 2 weeks,
you might as well send a postcard to the other side of
the world, right? So kind of, So what what you
actually have is you have, you know, arbitrage between
different L twos and kind of like it's very liquidity
intensive and and so on. How do you guys think about
balances kind of mighty chain and mighty L2 strategy?
And that's a very hard question. And like, I'm just representing
my views. I can't speak for all the
balancer community, but I, I do think that this is such a hard
problem and one that a lot of people are working on.
Very, very good people, much more intelligent than than me
for sure, but probably then the then our team and with a lot
more resources. So I, I do think that we, we
should not try to create, you know, new protocols for cross
chain swaps or, or, or things like that.
I think we, we should try to kind of stay in our lane and
then make sure what we do, we do the best we can.
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 fragmentation. Like you said, even if you're
part of the like the Super optimistic chain 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. As a user, it hurts me a lot to
to, to have that fragmentation. Like I said, it's not not good
you accent it goes like in the direction of all the like Solana
versus E like North Star and and everything that I think I don't
think we we need to get into. But so, yeah, we are trying to
be as good as we can in in what we do.
But what it 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 capacity
of the team and making sure we can execute with excellence.
So, but given we are protocol for others to build on top, we
have to be on the on the chains that our partners like you know
quant AM, they have very interesting kind of strategies
that use ZK proofs. We don't haven't talked about
them, but I hope we have some time too.
But yeah, teams like like, like them like they want to be on,
you know, ZK sync or whatever chain it's, it's kind of how
we're, we're approaching our strategy.
We want to be supporting the teams viewed on top of Bowser
and our close partners as much as possible.
And 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 bigger projects building on top of balances.
So kind of you, you already mentioned quant AMM, they'd be
super interested to kind of hear more about them.
The other thing that kind of really piqued my my attention
was a gyroscope. So maybe you can give us kind of
like a short overview of what they do and how they leverage
balancer. Sure.
Yeah. So disclosure, I am an investor,
an Andrew investor in both those protocols, though I, I'm biased,
but I do think they're amazing. Gyroscope has been around for a
long time. They are basically, yeah, this,
this the initial idea is, and I think it expanded a bit, but is
to have this GYD coin, which 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 stablecoin. If something fails or goes off
bag, you still have the kind of the system dynamics to avoid
like a, a, a DPAG of this coin that is basically built by
collateralized BMM pools on top of balancer.
So it's quite big brain stuff. But yeah, has been created by,
by really brilliant guys that yeah, from, from, from the UK
that I've been, 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.
So yeah, they also created the ECLP that I mentioned.
It's a very gas efficient AM based on elliptical curves or
elliptic curves. Yeah.
So they, they are amazing. And they have built on balancer
V2 and are are now migrating to Balancer V3.
And kind of an as an aside, it was great to see how the devacs
increased or improved because most of the migration process
was like deleting code. You know, you delete this, this
and then it's very, very much watered down version of V2 is
what they need for V3. So kind of validated our, our
hopes of increasing, improving the X quant AMM is really about
like this initial like original idea of bouncer as an index
fund. And it's actually something
we're pursuing not only with quantity MMM, but with, with Cow
AM Ms. and COW swap as partners. This idea of like index funds
and ET apps on chain, like the main reason why I'll talk about
that. But just quantity, MMM, it's
really like how how to have index indices and ET apps or
exposure of like a pool of assets with a very smart kind of
management that's done on chain potentially with ZK proof.
So you have very complex strategies that you don't want
to 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 proofs or yeah, ZK chains
to make sure that it can be implemented on chain without
disclosing what it is and in a gas efficient manner.
So it's, it's really like using balance of V3 as an asset
manager and, and doing very sophisticated strategies.
We're very excited about them. They got a grant, they got
funding from other VCs and yeah, we're, we're launching I, I
think they're already in beta and, and they're going to be
quite big. I I think on balance of V3.
So I'll, I'll say about the apart from quanti, MMM, this
idea of indices and ETFs, I think we have tried that in the
past and I think it was just not the time.
It was too early. You know, it's like, yeah.
I know that feeling. You know like Myspace and then
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 cause for indices like index Co-op, which I, I, I
love, I think the idea was great.
Like they leaked a lot of value because of this adverse
selection like arbors and traders have on chain, off chain
information and they just extract slowly the value from
those indices by having better prices than the market.
But now we have the tools we just talked about to prevent
MAV. So all of a sudden indices on
chain are a thing again. So you can have exposure to
NVIDIA and other other like assets, real world assets and
and have an index fund on balancing.
By the way, we launched with the like help of CARP, like actually
their initiative Carpet key, which is part of the Gnosis
family, as you know, amazing guys.
They, yeah, together with BACT, they launched the first spool
where you can like trade assets and in stocks like NVIDIA and
you can only do that in on Balancer.
So that, that, yeah, that that is something that excites me a
lot about the, yeah, the future of of Balancer and AMS in
general. And it's got an amazing yield as
well, so. Exactly.
It's like I'm, I'm I'll make sure my lawyers don't hear this.
Otherwise kind of like they'll they'll make me delete it for
financial promotion. But yeah, I mean, it's kind of
like the the years you can currently get on Jane.
It's kind of in things that are not inherently risky or not
inherently more risky than doing it on Robin Hood.
Is is is insane. Exactly.
So Fernando, kind of like when I kind of zoom out a bit, kind of,
I heard 22 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 want to let their capital sit there
and not be sophisticated traders.
And on the other hand, you're, you're kind of looking to cater
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 they these into kind of like B to C&B to B
to C kind of branches. How, How do you think about them
and how, how difficult is it to kind of like corral them into
one product suite? That's yeah, great question.
And, and I agree with you that that impression might be
floating around for, for listeners or, or 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 ideas.
So that the the focus is for others to build a balancer.
And I would say that we what we're doing by having our own
types of pools or joint projects like like the Cow AMM with Cow
swap and investing or, or being very closely related to quant
AMM and gyroscope. What we're doing is like we're
trying to give examples of successful projects or, or or
protocols that are built on, on Bouncer.
So with the priority fee hook, for example, our main objective
is to showcase how to use Bouncer B3's hooks and make sure
that other Babs or, or teams know like have an example of
something that works. So yeah, it's really like
bootstrapping Balancer V3 or Balancer in general for others
to look at us and see there is like cool things that we can
build on top of balancer. So once we have some traction
and lots of teams building on top of Balancer and, and, and,
and kind of creating 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.
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 in the balance ecosystem.
So that that's how I would if it makes sense how I would frame
it. Absolutely.
Then I want to zoom out even more.
So we kind of started off this episode by kind of elucidating
how AM Ms. were initially kind of this stopgap thing that kind
of enabled us to kind of do on chain trading without opening
ourselves up to being to being sandwiched to death.
Now that kind of we have much more advanced cryptography in
principle, we could put central Ledger order book exchanges back
on chain. So do you think AMM are going to
be an interim solution or is there is there kind of a long
term space for them in the ecosystem?
I think it's the it's the latter.
I think there is long term space for them in the ecosystem.
There is always going to be like the fast trading like high
frequency strategy teams or bots that are probably going to use
more concentrated liquidity or or obese centralized order limit
order books 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 Solana that want to be, you
know, like the, the ones where, where people can do that.
So it, it brings with itself scaling problems.
There will be L twos on, on Ethereum that will be kind of
more suitable for that. But I do think there's always
going to be some space for passive LP's who want to just
deploy capital to, 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
gonna be the case. Even in today's landscape, I
think there is space for AM Ms. But given that AM Ms. are
evolving and there's like ways you can mitigate LVR and, and
MEV, this is going to be, in my opinion, even more so the case
that there is space for AM Ms. This is my kind of bat.
I could be wrong, but I, I, I, I'm pretty sure like some people
called AM Ms. like dad, there's just like X * Y = K and that's
it. And then Unisol 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 Amms 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. I'm pretty sure.
And going on past data in four years is going to be when we
will have you on again. So kind of we.
We can. We can.
Kind of take take up where we left off then.
Exactly. So Fernando, where can listeners
learn more? Where can they kind of start
interacting with 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 dot balancer dot fi.
That's where most technical discussion take place.
Of course there's our forum, forum dot balancer dot fi and
our docs as well. If you go to balancer dot file,
you're going to see all the all those different links.
But also of course the the X handle at balancer is where we
talk about the latest and we have some some spaces and
discuss with partners. So yeah, I think that that's
where you should find us. Perfect.
Thank you so much for coming on, Fernando.
Thanks. Thank you for having us.
It was a big pleasure.