Osmosis v13.0.0 — Fluorine Upgrade

RoboMcGobo
Osmosis Community Updates
7 min readDec 5, 2022

--

December has arrived at Osmosis, bringing with it some exciting news that is sure to bring some holiday cheer to the Osmosis community: The Osmosis v13 upgrade.

Dubbed Fluorine, this upgrade is scheduled to take place at block height 7241500, currently scheduled for Thursday December 8th, at UTC 15:00. Be advised that because block times are variable, the upgrade may take place up to a few hours before or after the scheduled time. You can view a real-time countdown to the upgrade height on Mintscan.

The Fluorine upgrade promises to be one of the more significant Osmosis upgrades in the last several months, as v13 is packed with major features like Stableswap AMM curves, IBC rate limiting, multi-hop discounts, and more! Read on to find out more about these exciting new features.

Note: During the upgrade, you will be unable to use the Osmosis DEX. Staking and governance features will also be unusable until the upgrade is complete. A full changelog of upgrade features can be found here.

Stableswap AMM

The v13 upgrade will bring with it the much anticipated stableswap AMM curve, which will allow Osmosis users to create liquidity pools that are more optimized for pairs that are intended to be tightly correlated. Examples of this could be stablecoin pairs like USDC / BUSD or different representations of the same asset, like axlWETH / grav.WETH. In these cases, the assets in the pairing are expected to trade very tightly within a 1:1 ratio. So long as this occurs, price impact and slippage on trades routed through this pool will be minimal, allowing for traders to move between assets at a lower cost.

Why is this important? Sophisticated DeFi users have a number of reasons for moving between stable assets. For example, An individual may have bridged WETH over to Osmosis from the gravity bridge with the intention of buying OSMO, only to find very little liquidity for grav.WETH on Osmosis. A deep grav.WETH / axlWETH pool will provide an efficient multi-hop trading route to get from the low-liquidity grav.WETH to OSMO at minimal cost by trading from grav.WETH > axlWETH > OSMO.

Similarly, users looking to take advantage of leverage to borrow Cosmos-native stablecoins like USK or IST may want to take advantage of DeFi opportunities on chains that don’t support those assets. Those users can easily trade between stable assets to take advantage of those opportunities while incurring very little cost to do so. Osmosis has the potential to become the hub for this activity throughout the ecosystem. Minimal slippage and lower swap fees should thus drive significant volume through some of these pools, creating yield opportunities for stable asset holders.

One key feature of the stableswap curve being utilized here is the ability to set different scaling factors for assets that may have a pricing ratio other than 1:1. This customizability might be useful in a number of situations:

  • Leveraged assets / Perpetuals: Some assets may have a value that is intended to be pegged to an asset at a certain multiple of the base asset’s value. These are often called leveraged assets. For example, you can envision an ATOM2x token that is intended to be equivalent to 2 ATOM. Where the value of ATOM changes, the value of ATOM2x would be expected to change by a factor of 2*(ATOM value change). If such an asset finds its way onto Osmosis, it can be paired with ATOM in a stableswap pool to enable a low-cost and efficient way to enter or exit a leveraged ATOM position.
  • Staking Derivatives: Staking derivatives are assets that accrue value at a rate corresponding to the staking APR of the base asset. For example, let’s say you liquid stake 1 ATOM through Stride Protocol, receiving 1 stATOM in exchange. Assuming the current 21.33% APR holds for the next year, after one year you’d be able to redeem that stATOM for 1.2133 ATOM. Waiting another year to redeem it would give you 1.472 ATOM, and so on. As you can see, these assets diverge in price, albeit much more slowly than traditional assets. In this case, the stableswap curve can adjust to reflect this relatively slow and predictable price deviation.

You can find the full details related to the stableswap curve, including the relevant math involved, in the official readme file.

IBC Rate Limiting

The last several months have seen an unprecedented uptick in the number of exploits occurring on cross chain messaging protocols and bridges. Following the exploit of the Binance bridge, core Cosmos Hub and Osmosis contributors began auditing the IBC tech-stack and a critical vulnerability was discovered. Thankfully, a patch for the vulnerability was quickly implemented before an exploit occurred, but this event underscored the importance of having additional protections in place to protect Osmosis users from any unknown IBC vulnerabilities.

IBC rate limits are one such protection. The Fluorine upgrade will introduce the capability for Osmosis governance to set limits on the net inflows or outflows of any non-native asset via IBC. This will limit the number of a specific asset that can be moved off of (or on to) Osmosis within a defined time window. This is expressed as a function of the total TVL of that asset on Osmosis. Different rate limits may also be set for inflows and outflows of the same asset.

For example, let’s assume the total number of STARS currently on Osmosis is 50 million and Osmosis governance decides to set a rate limit of 20% on STARS outflows and 40% on STARS inflows. In this case, only 10 million STARS would be able to be sent off-chain within a given time window. The purpose of this is to limit the resulting depeg that would occur in the event of an exploit of Osmosis, Stargaze, or IBC itself. This will also allow the relevant development teams to take action to ameliorate the exploit before a malicious party drains the protocol’s liquidity.

Similarly, in the event of an exploit or consensus attack on Stargaze, the number of STARS that can be sent to Osmosis (presumably to be dumped) will be limited to 20 million. This latter type of rate limit would have helped to mitigate (or at least better socialize) the damage to Osmosis from Terra’s collapse, and will offer additional protections in case such an event occurs in the future.

One obvious tradeoff to IBC rate limiting is liveness. In periods of high volatility it will be possible to reach an asset’s rate limit despite there being no underlying issues with Osmosis, the counterparty chain, or IBC. Were this to occur, all IBC transfers of that asset will fail until the designated time window has elapsed.

When setting rate limits, governance will need to balance the need for a security buffer with the potential user experience tradeoffs of being unable to move assets on and off of Osmosis for a short time. A data driven analysis may be necessary to find the optimal rate limits based on historical IBC volumes.

Multi-Hop Discounts

The v13 upgrade implements Osmosis Proposal 187, which was passed by governance back in March. When a swap is made on Osmosis between two assets and that trade is routed through two OSMO pools, the swap fees are automatically halved.

For example, when swapping from USDC to ATOM, the trade should route through Pool 678 (USDC / OSMO) to Pool 1 (ATOM / OSMO). The swap fee on Pool 678 is 0.2%, and the swap fee on Pool 1 is also 0.2%. Before the upgrade, this would have been a total swap fee of 0.4% or 4 USDC on a 1000 USDC to ATOM swap (not counting slippage or price impact). After the upgrade, the fees on this swap are halved to 0.1% per pool, for a total of 0.2% or roughly 2 USDC on a 1000 USDC to ATOM swap.

One would think that this mechanism is detrimental to liquidity providers, as the fees being charged on each swap will be reduced when v13 is implemented. In fact, it is anticipated that this multihop discount will actually cause fees earned by liquidity providers to increase by driving additional arbitrage volume to the DEX. When swap fees are reduced, a wider range of arbitrage transactions become profitable, allowing for increased arbitrage transaction volume which, in turn, generates more fees for liquidity providers.

IBC Memo Fields

IBC Memo fields allow for metadata to be passed as part of the message sent between chains. One of the key usecases for this feature will be the ability to perform cross-chain swaps on Osmosis. This will allow for front ends or wallets to enable the capability to send a token from its native chain to Osmosis and swap for another token by signing one transaction instead of two.

The usecases enabled by IBC memo fields won’t have an immediate impact on the Osmosis user experience, but this does open the door for a host of new possibilities for interchain transactions in the future. Coincidentally, the Interchain Foundation will also be implementing this feature in ibc-go v6.0.0. You can read more about the ICF implementation of this feature here.

Force Unlocking

With the v13 upgrade, governance may specify certain addresses to permit instantly unlocking bonded liquidity. This is useful in allowing for liquidation of bonded liquidity that has been used as collateral for a loan. While this is another feature that will not have an immediate impact on Osmosis users, it does signal a future in which Osmosis liquidity providers will be able to leverage their bonded LP positions to take out loans, potentially on the Mars Protocol lending outpost scheduled to launch on Osmosis early next year.

What’s Next for Osmosis?

Following this upgrade, there are even more exciting features due to be launched beginning in Q1 of 2023. Between interfluid staking, mesh security, concentrated liquidity, the launch of the ProtoRev module developed by Skip Protocol, the launch of Mars Protocol, and so much more, 2023 is sure to be an exciting year for Osmosis.

Enter the laboratory at Osmosis.zone, the first decentralized exchange powered by the Cosmos SDK and IBC. See our published lab reports at the Osmosis blog, our bench notes at Github and help plan future experiments in our Commonwealth

Connect with other DeFi Scientists by following us on Telegram, Twitter, Discord, Reddit, and the new Facebook and Instagram pages

Reach out to Osmosis Community Updates by Email or Twitter and the Osmosis Support Lab by Email or Twitter

--

--