Launch App

Sommelier Liquidity AMA With Sunny Aggarwal From Osmosis

In our continuing series on projects that help liquidity providers in the Uniswap v3 world manage more complex market making strategies, Sunny Aggarwal of Osmosis, joins Sommelier cofounder, Zaki Manian, to talk about liquidity provider needs and the first Cosmos DEX.

Osmosis founder, Sunny, and Sommelier’s Zaki Manian, talk about liquidity provider needs

Osmosis is roughly a little over a week old. It’s a brand new, first IBC-enabled automated market maker (AMM). Sommelier founder, Zaki Manian, explains:

“Osmosis has created a lot of new exciting opportunities for liquidity providers [LPs] for farming, locking up liquidity. It’s the first experience in the Cosmos IBC world we’ve all been waiting for for five years. They’ve done a bunch of really awesome stuff in terms of gamified airdrop, some pretty sophisticated LP reward mechanisms, and vast political debates have already broken out in the Osmosis community. It’s all very exciting. The AMM space is expanding at an exponential clip in terms of different LP experiences.”

Osmosis founder, Sunny, discusses his project’s early focus on liquidity providers at a time when Uniswap was the only AMM that existed:

“When Osmosis started, one of our sayings was ‘as easy as possible for the users, but give power tools to the LPs.’ One of the early substantiations was about a year and a half ago. I wrote a blog post called DAOifying Uniswap AMM Pools that said ‘Uniswap is really cool, this AMM thing seems really interesting, but they’re too simple and we need to have way more powerful curves and stuff.”

What about the curves?

A curve of an AMM is the algorithm that it uses to do market making. Sunny explains:

“Uniswap basically uses this algorithm, we can call it X x Y = K. What it means is it just has quantities of assets in its pool and it uses the relative quantities to do pricing. This thing works surprisingly well. You wouldn’t expect it to work this well but somehow it does. But it’s also one of the simplest possible algorithms that you could be using. What’s beautiful about it is that it works so well for being so simple.

“But, there are things that I think could be done better, and especially when it comes to different asset types, I think different styles of curves might be needed.

“And so, after that post came out within a few months you suddenly had two big new entrances, Balancer protocol and Curve protocol. Curve basically said, yeah, you’re right: Different types of asset pairs do need different types of curves. And, they came up with this idea called a constant sum, which is just way better for assets that are mean reverting -- which means a Stablecoin to a Stablecoin or some type of bitcoin to a different type of bitcoin. And this is optimized for market making like two assets that should be relatively similarly priced.

“And then meanwhile, Balancer took Uniswap’s thing and said ‘Hey, we know how to generalize it a lot.’ Where Uniswap said ‘you have to have 50% of one asset in a pool and 50% of the other asset in another pool.’ Balancer said: ‘why do we have to do that? What if we made it 80/20 or 90/10 or 30/70.’”

From the liquidity providers’ standpoint, that means you can be more exposed to one asset than the other. Sunny explains:

“Let’s say you go into a pool that’s 80/20, OSMO to ATOMs. And let’s say you have a million dollars to provide liquidity. That means you’re putting down $800,000 worth of OSMO and only $200,000 worth of ATOMS. And, this is what you would want to do if you were more bullish on OSMO than ATOMS because you want to have your portfolio still weighted more towards holding more OSMO than ATOMS. It also has an impact on the impermanence loss that you take.

“To explain that you can look at it from the other direction, which is what happens to the traders. What happens when you have a higher weighted pool is that the slippage when you’re buying

or selling that asset decreases. Meanwhile when you’re buying and selling the asset with the lower weight, the slippage gets magnified. So, for every $1 that you buy of the lower weight asset, it will move the price more than if you had bought $1 on a 50/50 pool. And then the converse for the higher weighted asset.

“This also has an impact on the impermanent loss side as well because of the asset that has a higher weight. Because you’re weighted more heavily towards it, you’re taking on less impermanent loss. It’s based on half if the price moves more because of the fact that you have more weight you can offset changes in demand there.”

Role of IBC in forming these pools

IBC is how you get assets on this chain in the first place. Sunny explains:

“Unlike something like Ethereum, where all the assets are there and you can just make a pool using any ERC-20s. On Osmosis, there are technically only two assets on the chain. In order to make a pool with OSMO and ATOMs, for example, there are no ATOMs on this chain unless you bring them over via IBC. So one of the things we spent a lot of time doing with Osmosis is really getting the UX and user flow around IBC to be as simple as possible. I don’t think we even mention IBC on our web page, we just have it laid out as a deposit and withdrawals page that you would normally see on a centralized exchange. So, what you can do is a user will go in, go to the assets page and click deposit for whichever asset you want.”

“Our web page makes very good use of a lot of the features that Kepler provides. For context, the Kepler team is also the Osmosis team so we’re working on both of these products. And, so, taking advantage of this ‘suggest chain’ feature that Kepler has, we basically make it easy for the user to make a transaction on the other’s chain and have the assets be automatically IBC’d over. And so once they’re on this chain, then if a user has both OSMO in their account and they have this IBC's ATOMs over now they can take these two assets and put them in the pool together.”

Zaki observes: “All you need to do to get a new asset on Osmosis is get a Cosmos chain up and connect over IBC. And if I’m part of a Cosmos chain, all I need to do is get connected by IBC, get a pool created, and then I’m off to the races.”

The Osmosis team added what Sunny calls “a little extra step around some of the UX stuff where you just have to make a PR to add yourself to the asset list.”

He explains: “This is just how the front end knows what asset it is and can provide more helpful data to the users. But, if you don’t want to be integrated into our front end, anyone can make another front end. And, you can make a front end that’s specifically just for trading your own asset if you want it.”

The APYs are coming currently from OSMO liquidity rewards. Sunny adds: “Hopefully by the end of the day there will be additional liquidity rewards.”

OSMO token distribution

Sunny describes the way token distribution of OSMO works as follows:

“There is a total supply of 1 billion tokens that will ever be minted. Of that,100 million existed in genesis, which was distributed to the strategic reserve as well as the quadratic pair drop. And so basically most of these tokens are in the hands of ATOM holders. We treat this as an invitation to ATOM holders to come in and be part of the Osmosis community.

He explains how to become part of the Osmosis community:

“We have these daily epochs that mint new tokens and release them to a couple of different categories. First is the community pool, which people should be familiar with because it’s pretty standard in Cosmos chains. The second is staking rewards, so 25% of rewards go to the staking rewards. Then the other is the developer team, so about 25% go to the development team on a daily epoch basis, and then, finally are the liquidity rewards. So, 45% -- the largest chunk, because we were trying to build a platform that’s great for the LPs and want to make sure they sort of own the platform.

“So, 45% of daily epoch rewards are distributed to LPs. So how they are distributed to LPs: What happens is there is a process called bonding your liquidity. What we wanted to avoid in Osmosis was this sort of mercenary capital which comes in and sucks up rewards and then just leaves. One of the things that we also wanted to do is make it easy for passive liquidity providing. We want to make it easy for anybody to put their liquidity in a pool and set and forget. And when you have people who come in and move liquidity rapidly, this hurts the more passive liquidity providers. We wanted to do something to give the passive liquidity providers an extra edge. And, that’s why all the OSMO rewards are only given to these bonded liquidity providers. What that means is that you take your LP shares from a pool and you bond them into a lock. It works very similar to staking where you stake and then there’s an unbonding period whenever you decide to unstake. The same thing happens with LP bonding as well. And, then governance basically decides which of these pools to incentivize and what is the minimum bonding time that we want to incentivize these pools to have.”

Sunny explains with an example:

“Let’s say governance says ‘hey, we want to give 5% of the LP rewards to the ATOM OSMO pool for people who bond their liquidity for at least one day. Then, basically 5% of that 45% will be given to -- we call those gauges -- and then it’s distributed to everyone that qualifies for that gauge. So the API numbers can change based on how many other people are also bonding liquidity for the same amount of time.”

External incentives are a plus

Osmosis also makes it very easy for external parties to add incentives beyond just the base Osmo incentives. So, a number of the teams behind the tokens already on Osmosis are going to be adding these additional incentives.

“Hopefully by the end of day, the Akash Network team will be adding AKT incentives on top,” says Sunny. “That way if you are providing liquidity and qualify for one of the gauges for one of the two main AKT pools you’ll be earning both OSMO rewards but additional AKT rewards as well.”

Sunny describes how the code flow works:

“Tokens get put into a gauge and all the tokens that are in a gauge get distributed at the end of the epoch and so the OSMO rewards also just use the same process. To the incentive module it’s not any different, where it’s our Mint module that puts OSMO liquidity rewards into all of the relative gauges, but anyone else can say I want to put some AKT rewards in as well and at the end of the epoch all of the rewards from the gauge will be automatically distributed.

“One option is to have a 24 hour fill cycle, someone has to IBC the AKT over and send them to the gauge. We also have the ability for someone to set up a program, we call it, where you can say I’m going to put up 1 million AKT tokens and I want these to be distributed over the next 14 epochs or something, for example. It will split them evenly and do that automatically so you don’t have to refill every single day.”

Zaki notes: “Our Secret Alpha: AKT rewards are likely coming and in general Osmosis is all set up for liquidity mining for any Cosmos product. We have an imminence on mainnet so that’s something to keep an eye on too.”

Swap Fees

As to swap fees, Sunny says:

“Our code base is currently a clone of Balancer. In the Balancer model the swap fees stay in a pool and end up being reflected in the quantity of assets in a pool because they get charged in the tokens being swapped. And so basically you’ll realize this swap fee returns when you withdraw your liquidity. Because when you withdraw your liquidity proportional to the number of LP shares withstanding, you’ll get back your percentage of tokens in the pool. And, because the swap fees were added to the pool, that’s how you’re going to get your cut of the swap fees. So, your liquidity position is increasing. It’s what people always wanted for staking as well in Uniswap v2 -- why aren’t my rewards auto-compounding?”

Zaki observes: “Cosmos SDK does give us a lot of pools. The epoch system that Osmosis has introduced will show up all over the Cosmos.”

Interestingly, the Osmosis team actually built it as a generalized epochs module. “We should probably try to upstream that to SDK soon,” Sunny notes, then explains:

“We realized what was happening is that in all of our different modules we kept trying to reimplement epochs. There’s a different developer working on each module, so each model has slight differences and then synchronizing epochs across modules was annoying. Instead we said let’s just build one generalized epochs module and use the hooks system. We love the hooks system.”

Hooks is a mechanism by which events in one module can trigger actions in another module.

Sunny says: “I think the hooks system is one of the features that the Cosmos SDK has had for a long time but it’s not very heavily utilized. We like to utilize it all over the place in our code base. When we were talking about the interesting features that only the Cosmos SDK can give you, we all talk a lot about endwalker, but hooks is also a huge one.

For example, Sunny describes the Airdrops module, the claims module:

“When you’re claiming your Airdrop, you don’t have to do anything to claim it. As soon as you did your first staking transaction or first governance vote the tokens automatically ended up in your account. That's because we took advantage of the hooks. The claims module was able to hook into the governance module and say as soon as this account does its first vote let me know so I can automatically distribute their Airdrop to them.”

There’s a lot of design space where we can take Osmosis now. We’re trying to focus on three main things now: One is improving the AMMs. Osmosis started with more powerful AMMS and we took the most powerful one that we saw at the time, which was Balancer, and we kind of cloned it onto the Cosmos SDK. But, I think there’s a lot of design space left to go. Dave and I were actually designing something with concentrated liquidity, but we wanted something that’s more passive than Uniswap v3, so we were trying to design a concentrated liquidity system. And then about two or three weeks ago Curve v2 came out and we were like ‘oh cool, this is pretty similar to what we were trying to do.’ Which is nice to know we were on the right track.”

Pause for Sommelier’s analysis

Zaki offers the Sommelier analysis:

“Exponential moving averages are not the right way to drive concentrated equity. I think the curve question comes down to this: should concentrated liquidity for an entire pool move at once? Two projects on Ethereum are starting to explore this. The Integral Finance project and Curve v2 were saying we’re going to move the entire pool’s liquidity depth in order to provide a low slippage right around the spot price.

“The second question is: How should the pool decide? I basically think the future of AMMs is now: You’re going to run a competition between a passive LP system with some sort of on-chain automated computation and an active LP system where you have off-chain computation of where the deepest liquidity should be. I think it’s pretty exciting.

“The biggest problem with concentrated liquidity is moving your concentrated liquidity as a loss less function. So, if you have these fixed-weighted pools you have impermanent loss but you don’t have any realized loss as the spot price moves. In any sort of concentrated liquidity system you realize your losses when you move the concentrated liquidity. It is a loss less function to move the concentrated liquidity.

What something like Curve v2 is doing is we’re going to fill the profits of the pool up to a certain watermark and once the profit is across that watermark, relative to the cost of providing liquidity, then we move. Which has a degenerate condition. In a competitive marketplace where let’s say there’s a Uniswap v3 and there is a Curve v2 pool for the same set of assets, the spot price moves, then the spread on Curve v2 is now worse than the spread on Uniswap v3, because there's more liquidity moved there. Now, the trading volume on Curve v2 goes down or it takes a long time to reach that watermark where you have accrued enough profit to afford moving -- And that’s because everyone starts trading on Uniswap v3 because the slippage is low. That’s going to be an interesting thing to keep track of in the Curve v2 world. The thing everyone is asking about Uniswap v3 is when you have all of this volatility and suddenly you don’t have any liquidity where the spot price is now and slippage goes up. There’s that about Uniswap v3, but there’s a lot of work to mature the tooling around that. And so what the equilibrium of these systems are is I don’t know. But, Sommelier really believes that we can build great tooling for Uniswap v3 type systems.”

Zaki observes: “Probably my biggest Alpha right now is at the end of the day that liquidity providers -- especially when you get out of this bootstrapping era of liquidity rewards -- need access to options in order for any of this to work.

“Being a liquidity provider you need access to what is effectively a structured product. You need to be able to leverage long volatility because your LP position is short and wide. And that’s the only way in which you’re going to be able to make up the losses. This is especially true in any sort of concentrated liquidity system because you need to be able to offset the cost of realizing your losses and moving to a new spot price with the gains from an options position. This is the only way that this is going to work in the long run. I feel like we’re in an arms race to build these options. That’s the Sommelier view of the world. This is all really interesting insight about the Curve v2 stuff.”

Sunny continues the Osmosis view

Sunny observes: “This is all interesting insight about the Curve v2 stuff. To be honest, we were designing the Curve side of it right now -- the actual algorithm side -- and we were just saying ‘alright, we’re going to have some oracle pricing. Maybe we make a round about it as oracles.”

“...Which is similar to the Integral approach,” notes Zaki.

Sunny continues: “Our goal is to figure out how we can concentrate the liquidity, but then also make it so that liquidity providers don’t suffer some impermanence loss. So if it’s something like you concentrate liquidity around right this oracle price but then you decrease the concentration in the middle band -- a little bit farther away and then you bring it back to normal a little bit farther away -- that’s sort of how we were thinking about it there.”

Zaki says: “That to me looks functionally equivalent to a strategy that you see in the early generations of Uniswap v3 automated rebalancers, where what they do is have out-of-the-money limit orders, where you buy in to swings of the spot price, effectively that’s doing the same things with the pool. With ATT volatility, you buy into the swings of the pool to offset your losses. That is significantly worse than owning an option, like a call option, at that swing price. I really think a big part of the future of the AMM space is going to be merging the options work and the LP provider work into some sort of coherent system that makes sense. So that, instead of having a bunch of liquidity sitting further out from the spot price, you have to own a bunch of options further out from the spot price. It’s much more capital efficient.”

Sunny asks: “Would it almost be the same as the difference between using an option vs using a stop loss?”

Zaki replies: “Because at the stop loss you have to have the full amount of tokens, like not collecting fees and sitting out there, whereas you get some sort of either implicit or actual leverage depending on what options system you were doing on that so you can realize multiples of capital that would be deployed rather than only the capital that was deployed.”

And now... the second and third pieces the Osmosis team is focusing on

About the team’s second focus, special decryption to stop front-running, he says:

“I think frontrunning is one of the biggest problems that is plaguing a lot of the decentralized exchanges, so we have a cryptographic solution that makes it impossible to front run. It’s a generalized solution that’s not just for DEXes the idea is -- like back execution stuff -- those are still only for DEXes and they don’t solve censorship issues and you really do need strong mempool privacy to solve it.”

The third priority is superfluid staking, which Zaki says he’s very excited about. Sunny explains:

“It’s a very specific type of staking derivative, where it’s taking the stance that you don’t want your staked assets to become liquid, but what you can do is instead is put stuff in the other direction where you allow people to use your staking in DeFi and then they can stake the DeFi asset. Specifically in our case, you are able to take an OSMO and some other asset, put them into an LP pool and then take your LP shares and stake them. There’s all this stuff you need to do in terms of risk accounting. This way users don’t have to decide between staking and LPing any more.

“One of the things people have shown a little bit of concern about is ‘hey, the staking rewards are only 25% of the total rewards on this system, isn’t this a little bit insecure?. To a certain extent it is right now. But, once you get the superfluid staking, the staking rewards and LP rewards will really start to combine into one thing. And so, that’s when we’ll get the proper security design of one system.”

Zaki observes:

With 45% of the OSMO creation going to liquidity provider rewards, eventually it doesn’t take that much staking of OSMO so that you’re getting net diluted by staking and you need to be providing liquidity to not be diluted. I think this is fine for two reasons. I’m not super worried that someone is going to show up with vast quantities of ATOMS and Akash and some of these other tokens and suddenly drain all of the OSMO out of the pool and then stake it and then take over the network. This doesn’t seem like that likely scenario to me. But, if you want us to keep your fraction of OSMO growing or keep it the same, you’ve got to learn to be a liquidity provider, which I think is a really cool set of game theory to set up. It was well-timed for me because I've been living the liquidity provider tooling and how do you build a liquidity provider life for the past six months.”

Did he say IONs on the chain!?

The history of IONs goes like this, Sunny explains:

“I wanted the smallest denomination of OSMO to be called IONs. Like X has waves, Bitcoin has Satoshis.”

But he was told this would make the life of all the wallets harder and to please stick to the Cosmos standards, which is to use a metric prefix.

He continues: “But then when it came to all the testnets, I thought well, it’s AMM, I need a second token with which to test our AMMS. So I just created a second token on the change called IONs. That way with all the test nets I was testing OSMO against IONs”.

Then, two nights before the launch of Osmosis, Sunny had a sudden stroke of inspiration. He thought:

“Hey, what if we just launched this on the mainnet and see what people do with it. We didn’t really have an idea of what it was for. I pulled an all nighter two nights before writing a script to create the distribution. And, we just airdropped it and had it on the chain. What’s really cool is a community started to form around it and they’ve been really running with it and trying to figure out cool use cases for it.”

Sunny says, the amount of debate and excitement around it really reminds him of the early Dogecoin community:

“I got into crypto because of Dogecoin. Early on the Dogecoin community was sponsoring Jamaican bobsled teams, funding clean water projects, and doing all of this cool stuff by using the token as this selling point for a community organization. I think IONs is doing something similar right now.”

Zaki concludes: “It reminds me a lot of the $SOCKS community and I think that’s a lot of the vibe and spirit of IONs. Thank you from the community for the IONs for giving us a cool shelling point to figure out. I’m excited to think how Sommelier is going to engage with Osmosis, and what we can build on top of Osmosis as well. Very probably the most exciting thing for us would be when we upgrade to a version of the Cosmos SDK that supports interchain accounts so that we could have similar to what we’re doing on Ethereum via the Gravity bridge kind of automated farming on Osmosis.

Sunny has the last word: “Integrated accounts is also important, so we’ll be working on that too.”

More articles


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

Bug Bounty
Privacy Policy
Documentation
Telegram
Discord
Twitter