Set Engineering Retrospective and Changelog

Hey folks,

A short while ago, @dylan shared a post outlining the expanded capacity from Set Labs to take on new Simple Indices and Flexible Leverage products safely. This stabilization of existing product lines (Simple Indices & Flexible Leverage) allows us to invest more time into Index Coop’s engineering autonomy. The first step in this process is to have a common understanding on what we’ve been working on, what goes into a product’s life cycle, and share some of the guiding principles on how we at Set approach engineering.

One of the most difficult challenges we faced as a team this year was balancing preventing existing product regression with the desire to ship new products and features. In order to maintain the features that Index Coop was built upon such as rebalancing and metagovernance, the Set team has had to continuously ship new smart contracts that addressed both shifting liquidity profiles and external protocol upgrades. For example, to meet the requirements of rebalances for the DeFi Pulse Index, we wrote new exchange adapters to target liquidity for both old components (KNC liquidity moving from Uniswap to Kyber DMM) and new (BADGER requiring multi hop trades on Uniswap). For metagovernance, we temporarily regressed in being able to participate in Aave and Compound governance before adding the Aave Governance V2 and Governor Bravo smart contract adapters.

It has been widely shared that in order to support new functionality, we only need to write a new adapter X for protocol Y. Although this was the original intention of the Set Protocol design, each feature actually requires its own set of surrounding infrastructure to maintain safety. Safely rebalancing through a new exchange requires careful monitoring of the liquidity that the rebalances are targeting while metagovernance requires additional services to scrape the new proposals from each protocol that Index Coop chooses to participate in. At the start of this year, the DPI as originally designed was not even equipped with the capability to consume liquidity outside of Uniswap V2. This new functionality had to be designed, extensively reviewed, and audited (see General Index Module below). Every DPI rebalance thus far has incurred additional development costs (vs. operations costs) per sprint and it should be expected that future rebalances will incur costs as well as as new tokens are added and liquidity moves to new venues.

Context switching between launching new products and meeting these needs was further compounded by the safety processes we put in place for executing transactions. @dylan previously shared with the team what a sample execution doc looked like that outlined a rebalance. Prior to handing most of these processes off, a version of this was written for every transaction executed including meta governance votes, rebalances, methodologist distribution, liquidity mining incentives, and contributor rewards distribution. We effectively lost days out of the month to these operations to ensure their safety. Before it became obvious that the existing setup was not sustainable and we needed to invest in tooling here, we launched the leverage indices products which came with new, unique sets of dependencies.

While we had prepared for the drawdown of Black Wednesday, we quickly realized we needed to invest further and innovate in product reliability and scaling before the products could safely grow to the sizes the Coop was hoping for or launching more. This required studying the liquidity profiles of the major pairs further and designing tools like the AMM Trade Splitter, something that became a moving target as the ecosystem was shifting due to Uniswap V3 and liquidity fragmentation between L2s. Keeper infrastructure had to be continuously upgraded both to support the new smart contracts and to add additional monitoring.

It was upon my advice that the Index Coop team at Set shared with the community that we did not have capacity to take anything else on. We were taking too much water from keeping up with existing product maintenance, as well as getting ahead of FLI limitations. They were subsequently asked to shield us from further requests. I recognize that the context provided here would have gone a long way and that our execution was not conducive to forming a productive relationship. Thank you to those who showed support throughout these months. To those who remain skeptical, we are committed to further improving our communication and establishing common understanding. The changelog below serves as a ledger of the larger investment items required to create, distribute, and maintain the existing products and their functionality. My hope is that knowledge transfer empowers the Index Coop, prepares the engineering and product working groups to inherit these challenges, and aligns all of the working groups on costs for new autonomous endeavours. Once there is a level playing field, both Index Coop and Set can effectively plan for their own roadmaps and involve each other more cleanly.

To accelerate that vision, I want to continue shining a light on the overall development process. One of the most exciting properties of DeFi is the power of composability. Protocols maturing around us allow us to focus on unlocking new functionalities and strategies. While this solves the need for us to create our own spot and lending liquidity, it does not negate lengthy development cycles. Tapping into these integrations requires careful analysis of the underlying protocol source code as well as the protocol’s governance. Auditors who review our code, on top of being increasingly difficult to secure these days, must also be aware of how each of our protocols work to be able to assess the compounded risks. This is a lengthy process that requires lots of back and forth. These are all processes that the product and engineering working groups will need to take on and account for.

Furthermore, Index Coop’s objective is “to make crypto investing simple, accessible, and safe for everyone”. Every new feature must have coverage across all three axes of creation, distribution, and maintenance. Even for an integration protocol like ours that seeks to generalize interactions across functions such as trading and metagovernance, we need to study and acknowledge risks of every protocol we integrate. A product that supports feature X does not mean that it is immediately supported for other product types across any of these dimensions, though it generally signals that we have some ideas about how it would work. An example of this is mint and redeem fees. The existence of these on leverage indices does not mean there is coverage for simple indices. Distribution (IndexCoop and Tokensets) and maintenance (rebalancing, monitoring) for products looking to enact these fees need to be rethought and implementation re-written as both flows are affected. I encourage everyone reading to promote asking, early and often, how a proposed product or feature maintains accessibility and safety for Index Coop’s customers and to understand the entire surface area of how creation, distribution, and maintenance are achieved.

All of these steps need to be carefully considered so we can continue delivering code and product at the highest levels. We continue to be non compromising regarding safety and security because they are the pillars of our products and our brand. We will continue to do more here to explain the requirements as we are made aware based on the proposals that are being considered, and working closely with the EWG to further decouple Index Coop’s products dependencies from Sets’ systems such as TokenSets. Going forward, we will also be maintaining a board to display work that we are currently performing to enable Index Coop products. More from @punia on this to follow.

Lastly, why Polygon and what was our investment there? At the start of this year, there was urgency within our team to learn more about L2s and the fragmentation of liquidity. This began with LRC liquidity dropping significantly during DPI rebalances which was due to the success of Loopring and its community and users migrating off of L1. I sought to gain an understanding around how to evolve our internal engineering culture to accommodate the multi-chained future. Polygon was the first application of this research and made sense because the ecosystem within Polygon had matured to a point where the simplest dependencies were sufficient to enable a self-serve experience on TokenSets. Launching this gives our engineering team insights into under the hood requirements on how gas fluctuates, how reliable our node providers are, basically everything we would need to develop a mastery with before doing anything substantial such as launching an Index Coop product on an L2. For this reason, most of the infrastructure required to deploy Index Coop structured products on Polygon have not yet made it to production, only the minimal viable set of contracts required to begin interacting with it self serve via TokenSets. The chain and dependency research was completed early Q2 and we attempted to ship this much sooner, but we instead diverted our resources to solving the bottlenecks described above. This continued to be driven in the background part time around the review and analysis cycles detailed below and I’m proud that this has enabled us to feel more confident about its usage in the future. I do not yet understand the full scope of the impact it made within Index Coop, but we have discussed and understood the importance of sharing important roadmap updates going forward.

Updates highlighting new features and contract improvements made from Q1 through Q3. As always, our smart contract repositories (set-protocol and index-coop-contracts) are available, while some of our monitoring services are not. This does not serve as an entire proof of work (omitting operations, smart contract design and audit phases), but captures the development highlights affecting Index Coop.

Feature Date Description
Lend Migration Wrap Adapter Smart Contract (SC) January 2021 Migrate LEND within the DPI to AAVE via the Wrap Module to participate in Meta Governance
Metagovernance Adapter SC for Uniswap, Compound, Aave January 2021 Enables metagovernance voting via DPI’s balance of AAVE, UNI, and COMP
Governance Proposal Scraper Keeper Service (KS) January 2021 Scraper service that alerts IC and Set on when new proposals are generated, automates creation of Index SnapShot proposals
Exchange Issuance SC - Audited January 2021 Enables (distribution) buys with any token that doesn’t rely on secondary liquidity. User uses one token, purchases all of the required components from DEXs, and mints the Set (high gas cost). Allows larger players to get into indices with low slippage as opposed to buying off of the Uniswap V2 pools.
Compound Leverage Module SC - Audited February 2021 Enables creating debt positions through Compound markets on Set Tokens utilized in the ETH FLI and BTC FLI
Debt Issuance SC - Audited February 2021 Enables users to mint ETH FLI and BTC FLI using cWETH and cWBTC
Debt Arbitrage SC February 2021 Enables arbing of FLI debt position against Uniswap V2 AMM pool
Debt Arbitrage KS February 2021 Arbitrage system to keep the FLI price on Uniswap AMM in line by arbing against ETH pools
TokenSets Debt Issuance Support February 2021 Enable (distribution) minting and redeeming of FLI through DebtIssuanceModule on TokenSets
FLI KS February 2021 Keeper system for monitoring and maintaining FLI leverage. Also included is monitoring and updating the oracle that Compound markets rely on.
FLI Strategy Adapter SC - Audited March 2021 Smart contract that encapsulated parameters that could be configured to enact the FLI rebalancing strategy
TokenSets Buy/Sell Refactor March 2021 Refactor on all existing issue, redeem, buy, and sell modals to provide more accurate gas pricing, and prepare for Exchange Issuance
Compound Bravo and Aave V2 Metagovernance SC March 2021 Enables metagovernance voting via DPI’s balance of AAVE and COMP on next generation governance contracts from Aave and Compound
TokenSets Exchange Issuance Support March 2021 Enable TokenSets to utilize the Exchange Issuance SC for all existing Sets
Sushiswap Debt Arbitrage SC March 2021 Upgrade existing Debt Arbitrage SC to support Sets hosted on Sushiswap AMM component
MVI Deployment SC April 2021 Deployment scripts, enabling trade quote scraping, arbitrage bot, and creating Featured Set configurations for MVI
Sushiswap Trade Quote Generator April 2021 Caching reserves and generating trade quotes on Sushiswap to prepare for BTC FLI launch. Quotes consumed by IndexCoop and TokenSets
General Index Module SC - Audited April 2021 Enables existing simple index rebalances to tap into new DEXs via adapters. Upgrade of Single Index Module which could only rebalance Indices via Uniswap. Previously unable to satisfy MVI and DPI requirements
Uniswap V2, Sushiswap V2, Balancer Index Trade Adapters SC April 2021 First set of diversified adapters to tap into liquidity outside of Uniswap V2
Snapshot Governance Adapter SC for Balancer, YFI April 2021 Enables metagovernance voting via DPI’s balance of BAL and YFI
Debt Arbitrage KS Sushiswap Upgrade May 2021 Upgrade existing KS to monitor and arbitrage against pools hosted on Sushiswap AMM
BTC FLI Deployment SC May 2021 Deployment scripts, enabling trade quote scraping, debt arbitrage bot, and creating Featured Set configurations for BTC FLI
BTC FLI Deployment KS May 2021 Deploy new set of parallel monitoring infrastructure to secure BTC FLI
FLI Risk Modeling V2 May 2021 Modeling risk in collaboration with Leveraged Indices Pod at Index Coop to understand FLI and what is needed to maintain safety. Continued support of the leverage indices pod (Cormac, Alan, Matt)
Axie Migration Wrap Adapter SC May 2021 Enable migration of Axie legacy on MVI
Kyber Migration Wrap Adapter SC May 2021 Enable migration of KNC legacy on DPI
Index Sale SC June 2021 Enable trustless sales of INDEX / vesting
Trade Splitter SC - Audited June 2021 Enabled trade splitting on FLI to consume multiple DEX liquidity sources to safely raise supply cap for ETH FLI and BTC FLI
Uniswap V3 Index Trade Adapter SC June 2021 Enable General Index Module rebalances to support Uniswap V3 liquidity, large UNI trades in DPI rebalances
Kyber DMM Index Trade Adapter SC June 2021 Enable General Index Module rebalances to support Kyber DMM, large KNC trades in DPI rebalances
FLI Strategy Chainlink Adapter Update SC June 2021 Upgrade FLI Strategy to use Chainlink oracles to calculate leverage ratio once Compound proposal passed, to improve reliability and safety of the FLI suite of products
FLI KS Chainlink Update June 2021 Update FLI KS monitoring to consume new adapter update and target Chainlink oracles
Metagovernance Operations Dashboard OD July 2021 Create tool for simplifying and increasing safety of Metagovernance vote execution process, mitigating creation of execution docs for metagovernance
FLI Execution Parameters Configuration OD July 2021 Create tool for generating FLI parameters configuration, mitigating creation of execution docs for FLI strategy updates
Component Rebalance Configuration OD July 2021 Create tool for generating rebalance parameters configuration, mitigating creation of execution docs for rebalances
Trade Hopping Index Trade Adapter SC July 2021 Enable General Index Module rebalances to perform trade hops on Uniswap and Sushiswap, target BADGER in DPI rebalances
Base Manager Extension SC Upgrade July 2021 Upgrade BaseManager for IC products to limit exposed interfaces and improve safety
BED Deployment SC July 2021 Enabling trade quote scraping and creating Featured Set configurations for BED
TokenSets 0x Buy Flow August 2021 Updating TokenSets to be able to consume secondary liquidity through any exchange via 0x to prepare for DPI liquidity migration
Base Manager SC Permissioning Update August 2021 Upgrade BaseManager for IC products to accommodate methodologist asks for guarantees around fees not changing
28 Likes

Thank you @asoong It really is impressive to see the amount of work that the Set Labs Engineering team are doing behind the scenes to launch, maintain and improve INDEXcoops products.

Thank you

:pray:

9 Likes