Launch App

Sommelier This Week - April 15th 2021: Providing a Best-in-Class Experience for Uniswap Liquidity Providers

This week, Jack Zampolin, Sommelier’s VP of Product fills us in on changes on the protocol side not only to accommodate users on v3, but to improve performance with some interesting new properties.

NOTE: Sommelier Uniswap LP Impermanent Loss management application is live at https://app.sommelier.finance. Make LP positions and receive rewards from our pool partners announced each week!

Jack tells us that sharing project updates on our new YouTube broadcast Sommelier This Week is becoming the favorite part of his week. Here, he continues the discussion of addressing Uniswap v3 with the team’s changes to Sommelier on the protocol side rather than on the app side, which he addressed last week. This week, he fills us in on changes on the protocol side not only to accommodate users on v3, but to improve performance with some interesting new properties. “I think they are going to be really exciting,” says Jack, who reveals in today’s update a bit about a new experience Sommelier will be launching on May 5th.

But, first, a quick recap on the purpose of the Sommelier chain: We’re here to provide a best-in-class experience for liquidity providers. “If you’ve got a few thousand dollars, up to hundreds of thousands of dollars, and you want to deploy that liquidity over a number of Uniswap pools we at Sommelier want to provide you the best experience doing that,” says Jack. “With Uniswap v3 there’s a lot of active management that’s required and the Sommelier chain is going to provide that active management in return for some fees. And in order to get those fees we want to bring in as many liquidity providers as possible to run on top of our system. So providing accurate prices gives those liquidity providers more fees and, in turn, the system earns more.”

Ch-ch-changes make it scalable

The first protocol-side change that happened this week is that validators now will be voting on where they want the liquidity in each of the pools that are managed by Sommelier to be deployed.

Jack explains what that means:

“In Uniswap v2 when you’re a liquidity provider you're providing liquidity over all possible price ranges within an asset pair. That has positives and negatives. The huge negative is impermanent loss, which is what we had designed the initial version of the Sommelier protocol to help protect against. We would automatically pull your liquidity out if the impermanent loss got to a certain percentage. But with Uniswap v3 you have to say ‘I want only to provide liquidity between these price ranges in this pool.’”

This is a feature called concentrated liquidity and the more you concentrate your liquidity, i.e., the tighter that price range is, the more fees you’re going to end up making. So, the best way to make money on Uniswap v3 is to move your liquidity to where the trading is happening and to do that dynamically. That obviously requires some knowledge of what’s going on in those markets as well as potentially other markets, and this is actually an unbounded data problem.

Jack explains the reason for the change: “The way we were doing it previously, bringing a very specific look at the Uniswap markets into consensus is not really scalable and it’s not going to work for 32,000 different pairs that exist on Uniswap. So instead what we’re going to do is have validators pull in data from a bunch of different sources and then use that to make a decision on where the liquidity they’re managing in a given pair needs to be deployed. In that way we can chase where the market is and deploy that liquidity in a way that’s going to maximize the amount of fees that our LPs in Sommelier are getting.”

Said another way, validators will have to compute where the future position on the price will be on their own. “We’ll give them some sort of puzzle, then they’ll submit their answer and we’ll average those, throw out some outliers and do a little clean up on that data,” Jack says. “We then compare their answers with where the liquidity actually is over in the Uniswap pool and then there’s a transaction that’s sent over to Ethereum to move that liquidity over to the new position.”

Let’s use the price range around $2,000 as an example. The validators would say, ‘We want to deploy all this liquidity between $1,900 and $2100’ and if the price starts going up and edging up toward that $2100 the validators would see that and their votes would say ‘ok the price is going up, we don’t want to risk being in a position where our position is inactive risk, there is risk of loss there as well as we’re losing opportunity cost, so we need to move where the liquidity is deployed from $1950 and then all the way up to $2150.’ And every period, like every five blocks or so, the validators might vote and if there’s enough votes for a new position then the position will be moved.

New: A back-testing oracle

Jack points out something else he and the team are working on in Sommelier app protocol that will likely in v2 of the protocol will be “a back-testing oracle where we will also be bringing in price data from these various pairs into consensus and we’ll be rewarding validators based on them keeping their votes within the range where the price has actually ended up,” says Jack, “so we’ll do that on a back-testing basis. In much the way that a fund manager back-tests strategies, we will be back-testing the validator decisions on where to deploy this capital.”

Validators by their nature are going to have some tokens and those are going to be stake-earning rewards and a chunk of those rewards are going to come from fees from these pools. They are incentivized to get as much return out of this liquidity that they’re deploying on Uniswap as possible. So whatever sort of data that they can use to better calculate that will quickly spread throughout the entire validator set. However, the validators already are incentivized to deploy that liquidity in the most advantageous way possible.

Refactoring the gravity bridge

The refactoring of Sommelier’s gravity bridge has been going on for a little while. ”The team has run into a couple of roadblocks,” Jack explains. “One is doing protobuf-based transactions in Rust, currently the orchestrator which is the piece that sits between Ethereum and Cosmos listens to events over on the Ethereum chain and submits them to the Cosmos chain.”

That piece of infrastructure is written in Rust and there is some work that needs to be done to enable transactions in the new Stargate format in the Rust code. “That’s been more of a blocker than we anticipated.” says Jack, “So, that’s taking some time in order to validate the new interface that we have that changes some naming and makes the system a lot more stable. That’s one slice of what’s going on. Justin from the Althea team, Tony from the Occlusion team, and Marco from Interchain Berlin are all working on that piece together right now and that’s progressing as quickly as it can.”

And, then on the other side of things, Sommelier co-founder, Federico Kunze, has also started on the internal state refactor, which is going to optimize as well as clean up a lot of the internal code and document it along the way. That’s happening in parallel.

When we’re talking about making cross-chain contract calls from inside modules and doing automated transactions over on Ethereum the gravity bridge is a really crucial piece to get right.

“The reliability needs to be extremely high,” observes Jack, “otherwise everything else we build on top of it will fail. So, we’re working really hard with a number of stakeholders across the ecosystem who also rely on this technology to ensure we get it right and we’re testing it with Sommelier’s own code as well so that work is moving along as quickly as it can. We’ve got a large group of stakeholders and we have the people we need to make the changes that are needed to make it as stable as it should be.”

Kicking off Uniswap assistance

The team also kicked off efforts to assist Uniswap this week. “We had a chat with the team and we are going to help them with the Uniswap v3 subgraph,” says Jack. Because of the work he and the team had done on v2, he says “we actually did quite a bit of performance engineering on the Uniswap v2 subgraph that led to a [$1MM] grant with the graph itself to help improve indexing performance. Through that work we gained some experience as a team building those subgraphs and modifying them.”

As soon as the Uniswap v3 contracts came out Jack says one of the first things the team said was: “Where is the subgraph?...because we need to use this data to hydrate the front end and to give users the data that they need to make good decisions about where to deploy their liquidity.”

New Experience on May 5th

In the app side Sommelier is going to be launching an experience on May 5th that allows users to submit liquidity to the Uniswap pools. “The way that we’re going to do that is by showing them data about these Uniswap pools and giving them the data that they need to make the decisions,” says Jack. “We’re also going to be using this on the protocol side. So this subgraph is a dependency on a lot of the things we need to do and the data formats that are coming out of it are going to determine direction for a few things. So that was a really critical piece to get right moving forward. We’ve worked closely with the Uniswap team to provide an initial version of that. Kevin Kennis from our team is doing that work and doing a great job. I also did a little bit of work on it.”

We have deployed an initial version of the v3 core subgraph on some internal infrastructure and are doing some testing on that. We should have a final version late this week, early next week. We’re still waiting for the v3 periphery contracts, which have some specific information around individual positions to finalize over on the Uniswap Repo.

And you could actually go over to the Uniswap Repo and look at those v3 periphery contracts and the team is pushing updates to those still. Good to see them doing some debugging and adding things like some safe math and migration utilities and things. That’s the kind of code that’s going in now, but as soon as those finalize we should also have a subgraph for those as well.

DEX Tech, a Private Repo

DEX Tech is a private Repo on additional data to help hydrate these front ends and to help users make good decisions about where to deploy their liquidity. One of the major issues we had in building on top of Uniswap v2 is how long it takes to index the subgraph.

“It is on the order of months right now if you want to index it for all Uniswap historical data,” says Jack. “We’re building an internal method to get some alternate price and volume data from Uniswap as a backup in case we’re not able to fully index the Uniswap v2 subgraph before launch. We want to show users what’s been happening in the markets over the last couple of weeks as a way to help them make their decision on where to deploy liquidity. Give you some moving averages, some Bollinger Bands, all of the fun stuff so that you will be able to see where the market has been, and where it might be going, and where you’ll want to deploy your liquidity.”

The protocol is undergoing a substantial refactor so Jack doesn't anticipate a test net before May 5th. “A lot of my time and some of the other folks on the protocol team we're working hard to shore up the data infrastructure that we have for that launch. And a lot of the protocol stuff that we have happening right now is in the design phase, and the spec phase. So we’ve made a lot of progress on specing out the Decision Module.”

This week and next week we’ll see progress on specing out the Cellar Module. This is the model where you’ll get a pool share. It’s going to make the experience of providing liquidity on Uniswap v3 a lot like it was on Uniswap v2.

What is the Cellar Module and how does it work?

In Uniswap v3 the liquidity positions are non-fungible tokens and they’re not immediately interchangeable. In Uniswap v2, when you deposited liquidity, you got back this ARC20 pool share token that represented a share of the fees in the pool. It’s not the same in Uniswap v3. And that fungibility of those pool shares has gone away.

What the cellar module does is makes liquidity in Uniswap v3, the stuff that Sommelier is managing, fungible again. So when you provide your liquidity to Sommelier, the chain will go and deploy it and it will give you back a share of this pool on Sommelier. The game plan is for users to be able to trade their shares of the pools on Sommelier.

Work on the new Sommelier app is going well with some progress on the UI/UX.

“We’ve had some initial wireframes of the experience for depositing liquidity for Uniswap v3,” says Jack. “We’re going for a really minimal experience and trying to use data to drive the experience for end users. We want it to feel a lot like deploying liquidity on Uniswap v2 but still give users enough information to make accurate decisions and understand the risks of deploying their liquidity in v3. So, we’ve got the initial wireframes, we’re working really hard on the data structure to support this.”

We’ll have more to share soon. Join our Community to stay updated 👉 https://t.me/getsomm

NOTE: Sommelier is live at https://app.sommelier.finance. Make LP positions and receive rewards from our pool partners announced each week!

More articles


© 2024 Sommelier by Bajanss OÜ –Maakri 36-50, Tallinn, Estonia 10145

Bug Bounty
Privacy Policy
Documentation
Telegram
Discord
Twitter