Osmosis Updates from the Lab Recap, Void Protocol, July 06, 2022

Stevie Woofwoof
Osmosis Community Updates
8 min readJul 14, 2022

--

Osmosis Updates from the Lab occurs every Wednesday at 1 PM EST (5 PM UTC) on the Osmosis Zone Twitter Space. Replays are available on the Osmosis YouTube channel or the podcast.

Greetings, scientists! The 4th was fun, but Wosmongton is putting away his surfboard, and we’re back to work in the lab.

Osmosis Updates

First up, work continues on the Osmosis Rektdrop to restore all tokens to LP providers affected by last month’s exploit. At least three independent analytics teams are working to harmonize their data to make sure that the amounts returned are correct. Apologies for the wait!

On the chain development side, the devs are continuing to build out enhanced testing procedures (like mutation testing and the transaction simulator, as discussed in last week’s recap).

They are also building out important new functionalities: TWAP and Token Factory customizability.

TWAP: Time-Weighted Average Price: TWAP calculates and makes available on-chain the time-weighted average price of tokens. The code can calculate this by accumulating slices at whatever interval is desired (in the Uni example below, this is called priceCumulative), marking each slice with a timestamp (timeElapsed).

Ex. from Uni v2 docs

The priceCumulative can then be checked across any desired range of timestamps (priceElapsed) to arrive at the TWAP price. In the continuing Uni v2 example below, which is a one-hour TWAP, you subtract the beginning accumulated price from the end accumulated price, and the beginning timestamp from the end one. Here, you get 36,720 of accumulated price units during the interval, which you then divide by the hourly slices, of which there are 3600 (150 days), to get an hourly TWAP of 10.2 over the selected time period.

Ex. from Uni v2 docs

TWAPs make prices manipulation-resistant, which is especially important for lending/margin/liquidations. For example, you could easily change a token’s price for a block or two with a huge buy or sell, but it will generally be arbitraged back to the current price across markets (except for single-market, illiquid, and/or extremely low-vol tokens).

If liquidations were attached to this block-by-block price, attackers would constantly be moving prices in order to collect liquidation bounties, before buying/selling the tokens back that they used to move the price. This would not be entirely risk-free for the attacker, since bots and arbitrageurs would also be fighting each other, much as they do for MEV, but either way, it would be terrible for borrowers and lenders.

A properly implemented TWAP makes this kind of forced liquidation attack economically infeasible. An attacker would have to move the price for long enough for it to be substantially reflected in the TWAP, fighting the whole time against arbitrageurs making money off the “unnatural” token price change by driving it back to equilibrium.

Not only will TWAP be necessary on Osmosis itself, for Mars lending and the various derivatives protocols, but Osmosis TWAPs will almost certainly serve as reliable price oracles for the rest of the Cosmos and beyond.

Why not just use Chainlink, since it can aggregate multiple price feeds and tap into Coinbase and Binance APIs? Decentralized, on-chain oracles/price-feeds are more transparent. However, in reality, it is likely that most protocols will use a combination of oracles and on-chain TWAPs to make their price feeds more robust, and Chainlink (and others) will also continue to aggregate more sources, including decentralized TWAPs.

You can check out the on-going implementation of Osmosis TWAP here and here.

Token Factory customizability: Token Factory allows dapps (mostly) to mint native tokens on Osmosis. It is simpler and safer to burn incoming CW20 tokens and mint native coin versions of them to be used on Osmosis. If they are IBC’d back out to a CosmWasm chain, that chain can re-mint them as CW20s, if desired.

However, CW20s are more functional than native coins in that they can enact logic (charging a fee, logging/sending information, etc.) upon certain actions (transferring, staking, selling, LPing, voting, etc.). Adding customizability means that newly minted native coins will have hooks that allow them to interact with CosmWasm smart contract logic.

This logic is necessary for Circle to bring native USDC to Osmosis, since they require the ability to blacklist certain addresses. According to Sunny, Mars and other apps need the additional functionality as well. Mars, for instance, needs in some cases to be able to stop transfers of the collateral tokens it gives users when they deposit. This would occur if a user is borrowing against that collateral and a transfer of the collateral tokens (and with it, the underlying assets) would unacceptably lower their loan health factor. Quite a creative use case!

You can already use Token Factory to create your own token if you know how to use the CLI and have the requisite 10 OSMO fee. Sunny was not aware of anyone having done this previously, but since this Updates, our friend Nos has used it. So cool.

Void Protocol

Void is building an opt-in financial privacy service for Osmosis with the goal of offering financial privacy to all assets served within the ecosystem. The v1 version of Void will be a coin mixer similar to Tornado Cash on Ethereum. In this system, users deposit assets in fixed amounts, are provided with a cryptographic key made possible with zkSNARK technology, and wait for funds to mix as the anonymity set grows. After the waiting period, the funds can be deposited to any wallet using the key.

In practice, then, someone tracing your transactions would see you depositing to Void, and then they could see all the withdrawals from the protocol to various new and old addresses and would only be able to probabilistically attempt to trace further transactions. This protection only works insofar as the tracer can’t use other data to link the wallets, e.g. the gas used to pay for deposits and withdrawals comes from the same wallet, or various other leaks. See the Tornado docs for some other best anonymity practices, including the use of TOR, deleting your data, maintaining multiple wallets, and the like.

Future iterations of Void will be able to leverage the fact that they are building on an appchain like Osmosis into greater privacy protections. This is because the Osmosis chain logic is more flexible than Ethereum’s and can accommodate, for instance, the payment of fees with already anonymized funds. Similarly, Void plans to add the ability to earn yield on funds that are being anonymized (in the token(s) being anonymized, rather than in newly minted VOID).

The specter of money laundering was brought up during question time. Void’s stance on this is that anti-money-laundering is the province of the state to solve, and further, that Void does not hinder them in this pursuit. If criminals want to launder their funds downstream of Void, they must still re-enter state-monitored systems, at which time the would-be launderer can be called to account for the source of the funds.

Void has been disappointed in the joining of financial privacy with criminality in the popular consciousness (Kevin: “at the holiday dinner table”), and surprised that privacy has not been adopted more widely within crypto. They expect the tide to change eventually, with users recognizing the value of having your transactions shielded from governments, corporations, and other potentially prying eyes.

Sunny is especially excited for Void because Osmosis as originally pitched was called zkDEX, a privacy-oriented exchange with ZCash at its base. They pivoted to mempool privacy and front-running resistance, but it’s cool that Void is allowing a return to the original vision.

Void is converting their already-written Terra contracts for use on Osmosis, and has been deploying them onto the Osmosis testnet. They have integrated Keplr, and are currently converting the zk module. Very roughly speaking, they are hoping to be ready to launch in 4–5 months, at which time they will be airdropping 10% of the Void supply 50/50 to Osmosis stakers and select LPs. I look forward to it!

Governance Corner

Prop 273, tapering incentives from certain low-TVL “Other”-category pools to zero, and 274, redirecting incentives from low-TVL pools to the community pool, have both passed, in keeping with the DAO’s movement toward more strategic incentive allocation.

Prop 275 is the regular adjustment proposal. Prop 276 is for matching incentives to XPRT/OSMO and XPRT/USDC. Prop 277 is an announcement wrapped in a proposal that has been rather controversial. Some perceive it as spam, and some see the encouragement to vote YES on the proposal, “yes voters superintelligence maybe rewards in future” as an abuse of governance, even though the prop contains no actionable items.

That’s about it for this week, although our friend Will Szal from Regen brought up incentives towards the end of the meeting, prompting Sunny to re-iterate that with APRs down during this bear market, we may be over-paying for liquidity in many pools. Some of those OSMO could be going into the treasury, à la the just-passed Prop 274. Medium-term, as described more deeply in his Osmocon opening address, the AMM team is planning to move to a concentrated liquidity model. And beyond that, Osmosis should also be looking into Protocol-Owned Liquidity, using our incentives to purchase ETH or BTC, for example, instead of merely renting liquidity from LP providers that may leave.

And that really does wrap it up! There is much to think about, which is good, since Updates is taking a break this week, and as far as I know will be moving to a bi-weekly schedule moving forward. The Ministry of Marketing is planning something for the off-weeks, but that has not yet been finalized, so stay tuned.

The next Updates will be on July 20th. See you then!

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 the Osmosis Ministry of Marketing by Email or Twitter and the Osmosis Support Lab by Email or Twitter

--

--