linkedin logogithub logo
January 20, 2023

Modular Standard Vaults

Key Points

1. A Need For S̶p̶e̶e̶d̶ Automation

If you’ve ever taken a ride on the DeFi roller coaster , you’re probably aware that high yield opportunities in respected projects and protocols are short lived. There was a time when tech savvy users and degen investors could exploit these financial opportunities manually, but with the advent of big players and institutional investment in crypto, there is a pressing need for preparing ahead by having the tools ready to execute the strategy as soon as it becomes profitable. And that’s what automation is all about. 

For this project, automation takes the form of highly abstracted smart contracts: elaborate pieces of code imprinted with the knowledge to exploit DeFi strategies as fast as you hit deposit. 

1.1 Use Case: Delta Neutral Vaults 

To illustrate the potential of the system designed, this case study is going to focus on one type of DeFi strategy, considered “Delta Neutral”. 

1.1.1 What Is A Delta Neutral Strategy 

A Delta Neutral strategy is defined as one that takes into account multiple positions (assets investment possibilities) whose response to market variations of the price is of different sign and compensates mutually, making the overall variation (delta) of the strategy neutral with respect to the market variations. The hypothesis of the delta neutral strategy often comes with assumptions on the market, and how much it can actually vary, meaning that these strategies have a context in which they work as expected.

In this case, the strategy consists in depositing an asset of stable value in a lending protocol, and using it as collateral for a loan of an asset considered unstable. The unstable asset provides access to higher risk investments with higher yields, and after some time, when the investment is done, the user collects the profits generated with the borrowed assets, paying back its debt, and getting its stable tokens back. Provided that the variation in price (delta) is not such that the borrow position gets liquidated, the market variations in price did not affect the investment substantially.


2. Why Standard 

The proliferation of Vaults to handle users’ assets in DeFi has led to the need for standardisation in the field; with the introduction of EIP-4626, a token standard for tokenised vaults was defined. But standardisation is not just about agreeing to do something in the same way. It also brings the possibility of abstracting above layers, knowing always that the higher ones can speak to what’s underneath in the same way, no matter the complex logics lying beneath. 

Rather Labs’ Modular Standard Vaults take advantage of this abstraction by separating the logics of its vaults in layers of increasing complexity. In layer 1, one can find vaults that know how to handle specific protocols, whereas in layer 2, complex financial strategies are implemented. This means one can invest in one or more of the vaults of the underlying layer.

3. Why Modular 

Among each layer, every vault is treated modularly and categorised in “families” of protocols. For instance, a vault that knows how to interact with the Aave protocol belongs to the same “family” as a Compound vault, both being lending vaults. As such, they’re interchangeable for any higher layer vault that uses any lending protocol for its strategy. Moreover, forks of these projects (projects that use the same codebase) can be interacted with just as easily; CREAM finance, a fork of Compound, can be used with a Compound vault, with some parameter adjustments.

4. A Composable Solution 

Rather Labs’ Modular Standard Vaults take a composable approach. What does this mean? Every kind of vault, be it a layer 1 or 2, comes with an “Implementation” and a “Factory” smart contract. When a user wishes to exploit a strategy (say, a Delta Neutral strategy) investing a given token (USDC, stable) using given underlying protocols (CREAM finance and SushiSwap on Polygon), all it needs to do is ask such layer 2 Factory (Delta Neutral Factory) whether or not there is a specific smart contract for a layer 2 vault with such parameters. In case there isn’t, the Factory can instantiate a gas efficient proxy smart contract for this layer 2 vault, whose function is solely storing the needed variables in memory, while for the logic it always turns to the original implementation of this strategy’s contract. For this, the Clones library by OpenZeppelin is used.

Below the surface, the layer 2 Factories work in the same way with the layer 1s: checking the existence of a vault for a specific protocol and asset to invest, and if there isn’t a new clone proxy is deployed.

5. Delve Deeper Into The Code

At Rather Labs we’re excited to share our work with the community, and we believe that when knowledge like this is spread, everyone grows. That’s why we’ve made this development open source and available in this repo.

You can also check an implementation of the smart contracts deployed on Polygon, and interact with them through the Polygonscan interface using the following links:

Rather Labs’ PoCs 

This article is written in the context of a series of Proof of Concept projects being developed by the Rather Labs Team. Using an approach of fast iterations for market validation, the aim is to explore new technologies and share knowledge publicly with the community. 

The cycle of work comprises 1 to 2 weeks in which the project is designed, developed, and published. The time constraint is one of the most important challenges of each iteration, so that’s why it should be noted that none of the content and code produced is in its final form. Everything is still in the works, but we love to share the updates with you!

Macarena López Morillo
Head of People
Get the Full Picture
For an in-depth understanding of this topic, don't miss out. Learn more here and elevate your knowledge.
right arrow

More articles

Web3 —
Blockchain Technical Partners

Uncover our Web3 creations and discover how we're redefining tomorrow.
Learn More