• Features
  • About
  • Resources
  • Community
  • Events
  • Blog
  • Jobs

Sommelier Liquidity AMA With Ari From Gelato Network

Ari Rodriguez from Gelato Network discusses all things Uniswap v3, providing liquidity, and some secret alpha with Sommelier cofounder and fellow Uniswap v3 pioneer, Zaki Manian

Gelato Network enables everyone to leverage the power of a decentralized network of bots to fully automate the movement of their money between different protocols on Ethereum and expanding to other chains. Core developer, Ari Rodriguez, talks with Sommelier Cofounder and fellow Uniswap v3 pioneer, Zaki Manian about their Uniswap v3 journey, make some predictions, and share some “secret alpha.” Ari, a smart contract developer and a cryptographer, explains how he got really into cryptography and blockchain technology a bit later in life:

“I totally was interested in other stuff. I’ve always been a pretty academic person but really wasn’t into computers at all and only got into the computer science space when blockchain was just rising a bit in 2016. I thought the concepts were super interesting. And, then I did a very deep dive into cryptographic math and thought that was fascinating. But, it all actually started because I thought these blockchain projects, Bitcoin and Ethereum at the time, seemed really exciting. So after a few years of doing a bunch of stuff around that space now I would call myself a smart contract developer hacking away on the Ethereum virtual machine. So, that’s what I do now.”

About Gelato Network

Gelato Network is the decentralized network of bots for generalized automation of smart contracts, Ari explains:

“So, Gelato provides automated start contract executions mostly on Ethereum though expanding to other chains, especially Layer 2s and side chains. And, so the idea is basically there are a lot of functionalities on the blockchain, as I’m sure you know, that involve bots interacting with the blockchain. This is because blockchains are fundamentally lazy. They need an external source in order to execute a little bit of code. You can’t run a cronjob on the Ethereum virtual machine. You can't say ‘do this in a few blocks or when this happens,’ you need this external impulse.

“So there are a lot of different use cases that could have automation. Of course, it’s not impossible to do automation yourself, but this involves having some back-end infrastructure, putting maybe a private key in a script so that you’re monitoring the blockchain and when the thing happens -- when it’s finally July 15th or when the price of some certain token goes below a certain price -- then you would automatically sign the transaction and and execute this transaction on the blockchain. But, this involves having your own back-end infrastructure. It has a bunch of little problems obviously that you might have to deal with -- re-submitting transactions, the gas fees.

“As well as it’s trusted, You see in the way I just said there you actually need to have the private key of the person who wants to do something automated. So, Gelato tries to find a way to do this trustlessly. So that on your behalf, bots will execute the transactions you want executed, based on the conditions you have. And, basically, we’re a for-hire bot network that will reliably execute transactions on your smart contracts when you want them executed. That’s what you’re looking at.”

Zaki relates: “We started Sommelier with a very similar vision of trying to do this. Our core differentiator is we’re trying to use a Cosmos SDK chain as sort of the coordinator mechanism, but very much fellow travelers in the space. But, I think the thing that brought us together on this is that there were a bunch of niche use cases for off-chain automation. And then, Uniswap v3 appeared on the scene.”

Why Uniswap v3 requires decentralized automation

Ari also credits the appearance of Uniswap v3 onto the scene with the need for decentralized automation.

“I would say it’s probably the most complex protocol that we have in DeFi. Also it’s worth remembering that DeFi is not that old and Uniswap was already a pioneer with v1 and v2 with showing how a trustless set of smart contracts could be used in so many ways -- that it could be this sub-protocol and you could start playing money legos. This is a pretty new concept that I feel like Uniswap was already a bit of a pioneer there. And, then Uniswap v3 takes this to a whole ‘nother level because, providing liquidity, now you have all of these choices. I would think this is the biggest thing for sure we’re going to be talking about a lot, but basically, it’s a very complex protocol that also has all these possibilities of integrations and periphery. As a developer, I really think all about almost like the way they structure their code, you know they have always had the core contracts and then the periphery. And, the periphery in Uniswap code is very dense -- that’s where a lot of stuff actually lies.

“I think it’s the combination of those two things: One, that it’s a very complex protocol and that now also there are a lot of complex parameters for interacting with it. We used to be one-size-fits-all for the liquidity providers. And now, of course, liquidity providers have many choices and dials to play with. And then that, plus the fact that there are all these different ways that it could be a subprotocol of something else, that it can be used under the hood by other DeFi products. But, it’s very complex. So, I think those two facts mean that these helper side products are going to be very important in the Uniswap v3 ecosystem.”

Two Uniswap v3 Pioneers Talking

Zaki shares the day-to-day challenges of working on Uniswap v3: “I think when we say that Uniswap v3 is very complex, I’m sure we’ve encountered similar things. The math is very subtle and sophisticated, and so far the API surface area around all of the tick management functions and all this stuff. When we’re working on it we’re just banging our heads on trying to get this equation that exists in Solidity or Javascript, like implementing the language that we want. I’m sure you’re living that life, too, Ari.”

Ari agrees: “Yes, yes, very, very much so for sure. I think that even just the calls you have to make -- to make a swap or provide liquidity-- are now much more advanced. You need to know things about ticks and putting 1.0001 to the power something, and all these. Oh yes, for sure that 100 percent.”

Sharing his own insight, Zaki says,

“I think the core of what Uniswap v3 is, the conceptual framework, is actually quite understandable and elegant and it’s easy to build in. You can build some nice intuitions around it. But, one of the things that I think is also really fascinating is the number of potential products that can use Uniswap v3 as a core parameter.

“I’m curious where you fall on this. You’re investing time and energy in trying to solve the problems of liquidity range management. So, there’s a whole camp out there that thinks that passive liquidity management is the future and that Uniswap v3 has taken the wrong turn by abandoning that. What’s your take on this, Ari?”

Batter up

Ari takes the opportunity to discuss why he thinks Uniswap v3 is on the right track.

“I feel like you’re almost setting me up for a home run there in that, of course, when you brave automation and more choices for the liquidity provider -- I guess our goal and we’re not the only ones, I’m sure very similar goals in Sommelier and across the people who are first working on Uniswap v3 and what to do with it -- one of the most obvious things to do is to provide liquidity providers with [a tool that] re-pacifies their experience. Give them a passive experience again but without losing out on the competitive fees. So basically allow yourself to be a competitive market maker, which would involve this active analysis of your position and tweaking it. And, allow people to have the passive experience of v2 but still be competitive in v3. Which means you need this active management. But, if that active management is automated then you get the best of both worlds. So, I feel like that’s the future. Passive liquidity provision is somewhat the future but mixed in with active. And, the thing is, the strong passive liquidity providers will be leveraging automation, in my opinion.”

Zaki says he’s fairly bought into the idea that concentrated liquidity is the future. He says:

“And what I think is particularly elegant about Uniswap v3 is the way in which you can converge multiple use cases for the liquidity pool for the person who’s swapping. They’re swapping against liquidity that is representing different use cases for different users. So, there’s the limit order use case where it’s like ‘If ETH goes over $3,000, I would just like to sell this position.’ You can drop liquidity right into the tick that’s closest to $3,000, if ETH goes past it you’ll be in a stablecoin and you’re all set. But, that use case is also reducing slippage for traders, which is fantastic.

“Then you can have the use case of I would just like to manage my portfolio. I would like to be buying ETH at a certain price and if ETH moons I’d like to sell some to take profits and you can represent that as a Uniswap v3 position.

“And, then you can have the case of someone who just wants to optimize around the spot price,” he adds.

“This is what we’ve figured out so far. I think what’s interesting and challenging is all of this stuff is hard to build, as I’m sure you are experiencing. Is there any particular challenge about building it that you’ve been thinking a lot about or working on recently -- other than like the day to day ‘How does the math work?’”

Challenges, examples, real talk

Ari discusses some memorable challenges to date.

“The math and just the actual underlying work of the integration is super serious. You feel the difference from your classic DEX where you might have a function where you have a swap or something inside your smart contracts. And, it’s pretty smooth. You just need to know the interface. But there are tons of these math complexities you just mentioned that are definitely there and I’m bashing my head all the time against that.

“My big work has basically been in taking a non-fungible position and fractionalizing it so that we can make it fungible again. Which was a pretty well understood idea and problem, but even there, there were a lot of subtle concerns So, besides just the math, there were some interesting subtle security issues that I ran up against a couple of times. For instance, we are G-UNI pools so these Gelato Uniswap v3 pools are pretty simple. Currently, the idea is we have a position, you can own a portion of that position. And, the position, we don’t change the ticks at all, we don’t actively rebalance changing the range, but just automated fee reinvestments. So, as you know Uniswap v3 doesn’t bring your fees back in so if you want those to be earning fees and being used in the automated market maker you have to do this manually yourself.

“So, we’re just doing automated fee reinvestments. But, even with that there are these subtle issues of ‘if we don’t continuously count the fees, like in the first version of the protocol that I invented that turned out not to be secure, if you don’t actually account for the fees earned since the last rebalance -- I thought ‘oh ok there will be some fees earned but we don't have to think about those. Every so often we’ll just throw them into the principle so we’ll just count the principle when people join and exit the pool. But, this has a very subtle attack, where someone could, of course, withdraw all their liquidity right before we rebalance and they get a certain rate and then there’s a rebalancing where we basically invest those fees and then when they reinvest what they just pulled out they’re going to get a slightly bigger portion. So, you can basically front run the automated fee reinvestment for your own profit and this would be a big problem. So, little, subtle security issues like that were slightly more unexpected.”

Zaki seems to make a mental note as he says, “That definitely makes me want to take a look at how we’re handling that in our automated reinvestment smart contracts. I think this gets again to complexity. The act of re-fractionalizing something that is discrete may not be the most compelling product in the world, but it’s a reasonable trade-off between a sort of safety and getting started somewhere.”

Ari agrees and says: “Exactly. That’s totally not where we started.”

Product evolution

Ari gives an overview of what the team at Gelato is doing. He describes the product that he started working on was ‘we’re going to be hyper-concentrated liquidity and we’re going to be following the market price and whenever the price moves in a certain way will automatically adjust the bounds of the position.

“But, of course, there’s a lot of risk and subtlety in basically how this automated strategy works can either very easily bleed money or be wildly successful, potentially. But, here’s a huge rabbit hole of figuring out, of course, what is that strategy. Based on all the complexities of off-chain stuff, like basically predicting volatility of certain assets. So, I totally started there but then slowly we realized that that’s going to take longer to smooth all the kinks out. But there’s already something helpful in this very simple, very vanilla thing of just making it fractionalizable and also just bringing those fees in since that’s something that happened in Uniswap v2 so we just want the same thing in Uniswap v3. We got to that place by going through, actively working and going, you know, this is safer and there’s already something here and we understand the risk profile a lot better.”

Zaki says he thinks these are the really interesting questions: “One is: ‘yes I think a lot about the opportunity or the risks in any of these fractionalized pools, like flash loaning the liquidity into the pool before a rebalance or something else. I think we’re going to see pools get bit by these subtle subtle effects.” He adds: “Cool! This is a great introduction to what you guys are doing.l I think it’s fantastic.”

Looking ahead, waiting for secret alpha

Zaki mines for secret alpha gold: “We probably could check in once a month with each other for the next year as we figure this out. But, what’s coming down the road? G-UNI is live, I believe, correct?”

Take it away, Ari:

“Correct, yeah. So, what’s coming down the road -- first, not exactly alpha because it’s all public, but it’s all just started. We’ve been experimenting for the last few months. We had a few things on mainnet but only on a small scale, not very public, not giant amounts of liquidity in there but enough to see how it’s working and analyze what we’re doing -- including even those active rebalancing. The first thing we had on mainnet did the active rebalancing but we quickly realized that making sure we were going to have a money-making strategy there, or that we weren’t going to lose the user’s money.”

Zaki notes: “I think people don’t appreciate how many ways there are to lose money in active rebalancing.”

Ari continues: “Exactly, exactly. It sounds really nice on the surface. What’s interesting is, it sounds super exciting. You can have these beautiful graphs showing ‘look how well we’ve concentrated our liquidity around the current trading price,’ and it would look like this strategy must be making a killing, but actually it’s probably draining money because of this fact that -- the thing that I learned I’m not the first to say it but I think people should hear it over and over is that ‘every time you change your range you take your impermanent loss and you make it permanent.’

Zaki puts it differently. “I’m trying to figure out if that’s the right way to say it to give people the right intuition for it. The way I like to explain it to people is it’s like ‘Every rebalance is at least sort of at a local time window that is selling low and buying high. Everybody knows that’s not a very effective investment strategy, right?”

Ari agrees and adds: “Exactly. That’s what I find so funny. You can look at the graph of this automated reinvestor tracking the price amazingly, and it looks great but actually all it’s doing is over and over buying high and selling low. So, it looks really great, wow, it followed the price -- but actually all it’s done is made a bunch of bad limit trades over and over and you’re losing money. So, the more you look at it, the more you understand the subtleties, the more you see that there’s actually a lot of demons in there. It’s very complex. And, the less the more you just see ‘oh, I could actually concentrate my liquidity and get all these extra fees and you just see that on the surface. It sounds amazing. So, I think we’re going to see that. I guess we’re all just going to learn through suffering if we don’t learn through the analysis.”

Zaki thinks that “in the future more these vaults are going to look like what people in finance call ‘structured products’ where it isn’t just like ‘hey we’re just going to hold a Uniswap v3 liquidity position. It’s going to be ‘we’re going to put a bunch of money legos together, we’re going to allocate capital between them and this is going to allow a reasonable equilibrium liquidity management position that works for a bunch of people. My prediction for the future: I think when we look back, probably about a year from the launch of Uniswap v3 and a lot more of this stuff is going to be figured out and the passive liquidity management world is going to look pretty obsolete.”

Ari agrees and emphasizes his earlier point: “I guess that the new version of the passive will be just like you say, these products that are synthetic that are like a big jumble of money legos where they say ‘you can get involved in this product and sort of it automatically has these parameters of how it’s moving its investment around -- and, do you want to be a part of it? This will be the new passive experience, but it won’t be passive. What will definitely be obsolete is ‘I put my money in Uniswap v2 and we all just live with that one curve’ and this one passive liquidity providing experience. Yeah, that’s going to be gone, I think.”

And now, secret alpha

Ari tells us “a tiny bit about what we’ve launched, a few things that are really exciting alpha of what we have. We have a proposal with MakerDAO for our G-UNI tokens to be a G-UNI/USDC Dai pair to be a collateral type on MakerDAO so this is moving through that system currently. So that’s pretty exciting.” He adds:

“We also have this. G-UNI has now fully launched a factory so that anybody can deploy a pool. Basically, anybody can deploy a version of a fractionalized position on a Uniswap v3 pair of their choice. And we have this model basically where there can be a manager.The manager can be the zero address so that’s more trustless but that also you can specify a manager and that manager could do an active rebalancing of the range but that’s handled manually because of course this is very subtle for all of the reasons we’ve just been talking about. And, that manager account can also basically take a small cut of rebalancing as well. So, it has all these possibilities of all the models you could have people basically where you could use our autofee reinvestment, but also have your own active strategy on top. Of course, it's a slightly more trusted model, not fully trustless. What we’re doing with MakerDAO if it passes would, of course, be nobody has control over the pool, nobody’s allowed to change the ticks. Which works well, of course, also on Stablecoins because the ticks really don’t ever need to be adjusted.

“To contrast that with what we’re also doing with Instadapp, which is also live. Instadapp just launched their INST token and they wanted to seed liquidity on Uniswap v3 and have staking rewards so they wanted it to be fungible so they’re using a G-UNI token underneath for the INST/ETH pair. And, originally they wanted to have just the ticks totally static as well. That’s part of how we went in this direction where it’s just fee reinvestment, but we’ve already seen actually that they’ve utilized their power to be able to move the ticks and basically it’s really cool to watch how somebody’s seeding liquidity for their new token. Using our new system can just easily move everyone’s liquidity all at once and move a few million dollars of liquidity in one transaction, which is the whole fractionalized position who knows who all the users and owners are and it all just, you know, gets moved really easily and they can basically have really fine-grained control over the INST/ETH pair and where they want their liquidity to be.”

Before the final question, Zaki says: “That’s really cool. Yeah, these are the early days of all of this stuff so…”

When multi-chain Gelato?

Good question. Ari says,

“We’re already doing some of this. So, Gelato has limit orders on Phantom. We have limit orders on Polygon and with QuickSwap. And, this is another cool place where you just want Uniswap v3 just to mention the range order as you talked about could use automation. Of course, because if you wanted to really act like a limit order, the Uniswap v3 range order, you need to withdraw your liquidity once it’s filled. So, this is another great place for Gelato. Very simple.

“Basically, my task when I first looked at Uniswap v3 was to find all the places where automation could be useful, and what are the lowest hanging fruits. And this is one that, of course, not that exciting, it’s not as cool as automatically moving all the liquidity on a pair but it could still be very, very useful. You have your range order but once it’s filled you actually want it removed so that it doesn’t get reversed.

“So, we’re already on Polygon, we’re already on Phantom, we’re looking into other L2s and side chains. And, another really exciting piece of Alpha for Gelato -- another thing we’re looking into. Nothing settled yet but is like cross-chain liquidity. So, making it possible to have like instant withdrawals from your Optimistic roll-up, instead of waiting a week if you have liquidity on both sides, both on the Ethereum 1.0 chain and on your Optimistic chain you can actually withdraw your assets right away, and you need Gelato automation in the background to basically take what’s built up on the Layer 2 and, actually, eventually move it to the Layer 1 liquidity providers. So, this quick, cross-chain bridge--which I’m sure you know all about over at Cosmos--is another thing we’re looking into.

See you online! It’s cool to talk to others who are hacking away in these very early days of Uniswap v3.

More articles


This website does not constitute an offer to sell or a solicitation of interest to purchase any securities in any country or jurisdiction in which such offer or solicitation is not permitted by law. Nothing on this website is meant to be construed as investment advice and we do not provide investment advisory services, nor are we regulated or permitted to do so. This website is provided for convenience only. Sommelier does not manage any portfolios. You must make an independent judgment as to whether to add liquidity to portfolios.

Users of the Sommelier website should familiarize themselves with smart contracts to further consider the risks associated with smart contracts before adding liquidity to any portfolios.

Note that the website may change, and we are under no obligation to update or advise as to these changes. There is no guarantee that the Sommelier Mainnet, including any software, products or token use cases mentioned on the website, will be built, or offered by Sommelier. In particular, actual results and developments may be materially different from any forecast, opinion or expectation expressed in this website, or documents contained in it, and the past performance of any portfolio must not be relied on as a guide to its future performance.

To the extent permitted by law, the company and its directors, officers, employees, agents exclude all liability for any loss or damage arising from the use of, or reliance on, the material contained on this website whether or not caused by a negligent act or omission. The release, publication or distribution of this website and any materials herein may be restricted in some jurisdiction and therefore you must inform yourself of and observe any such restrictions.