Introducing Smart Vaults

Facu Spagnuolo
Mimic Finance
6 min readOct 10, 2022

--

Mimic is a platform that allows you to deploy tailored infrastructure to automate DeFi operations in a secure, trustless, and non-custodial way. These operations include treasury management, index rebalancing, fee distribution, liquidity provision, etc.

Mimic achieves this through an innovative concept called Smart Vaults, an automated solution where a list of allowed actions can be defined and customized to suit any operational need. Smart Vaults are multi-layer and can be easily scaled up by deploying and connecting additional ones.

Unlike other solutions, Mimic provides enormous flexibility to embrace this constantly-changing ecosystem, making any DeFi interaction experience much easier and more secure than before.

How it works

Smart vault high-level illustration

To implement Smart Vaults, Mimic offers a list of pre-set primitives that can be grouped into actions to model any type of process for your Smart Vaults.

Primitives are pre-set atomic operations that can be executed on any Smart Vault, the main primitives are meant to cover the following concepts: collect, swap, bridge, join, exit, wrap, unwrap, withdraw, and call. Each primitive defines a set of parameters that can be configured for its execution. These can be forced to a hardcoded value, be limited within a specific range, or dynamically adjusted based on a network condition. For example, the slippage of a swap can be limited to a maximum value.

Moreover, to automate complex processes, primitives are not executed in isolation. As mentioned before, these can be grouped in different ways into actions to perform more complex operations. Actions can define how primitives are connected to each other and in which order these must be executed. Additionally, actions can be configured to base their execution depending on any transaction metadata like origin, gas price, gas cost, timestamps, etc. For example, an action can be configured to be executed only once a month, or only if its total gas cost is lower than 10 DAI.

Action example of how assets can be swapped and bridged from different layers to join an Ethereum protocol

These are just a few examples, Mimic opens the doors to model any other type of actions that could be automated to improve your DeFi experience.

Architecture

Smart Vaults are structured in different smart contract components:

Mimic Smart Vaults architecture

Smart Vault

This is the main component of the architecture, this is where all the assets are held and where their primitives are executed. This contract is also in charge of performing all the accounting logic related to investments and protocol fees. Smart Vaults also provide a built-in authentication logic to configure who is allowed to execute these primitives. Only allowed users can operate the Smart Vault’s assets, Mimic is never in control of their funds. Smart Vaults are replicated across different EVM-compatible chains to make sure users can interact with them transparently and in a unique way.

Strategies

Smart Vaults can use different strategies to allocate assets into different DeFi protocols. Strategies simply need to define how assets are allocated into a DeFi protocol, how to claim rewards to earn yield, and how to exit their position from the DeFi protocol. These can be managed dynamically, Smart Vaults are allowed to add or remove strategies to control their investment strategies at any time.

Mimic provides a standard interface to make sure all DeFi protocols can be accessed in a simple way from Smart Vaults. Additionally, Mimic facilitates a few implementations to integrate different DeFi protocols like Curve, AAVE, Balancer, Compound, Uniswap, and others. However, custom strategies can be developed in a really easy way. Any ERC-4626 vault or similar vaults can be used as a Smart Vault strategy.

Swap Connector

The Swap Connector is a smart contract that simply assists the rest of the components in a Smart Vault to swap assets. Having this kind of logic in a separate contract allows Smart Vaults to update it or replace it with another implementation in the future if desired. For example, the Swap Connector may allow swapping in different exchanges initially but it also may want to support some more in the future.

The Swap Connector simply interfaces with external exchanges to swap assets and it is mainly used by Smart Vaults. For example, it allows Smart Vaults to swap assets to join strategies to have a better position or to swap rewards to re-invest them.

Price Oracle

The Price Oracle can be used to query the price of an asset in a decentralized way. It can be used along with other components to achieve different operations. For example, it can be used to compute the minimum amount out for a swap based on a given slippage before calling the Swap Connector. It serves as a second source of truth to avoid having Smart Vaults depending entirely on what the Swap Connector says. Similarly to the Swap Connector, Smart Vaults can update or replace this dependency with new implementations in the future if they need to.

Mimic Registry

The Mimic Registry is where all the implementations of the contracts listed above are registered. It acts as a curated on-chain registry so Smart Vaults can check against it before updating their dependencies. For example, there could be two available Swap Connector implementations registered in the Registry that offer different exchanges. If a Smart Vault wants to update its Swap Connector dependency from one to another, it can simply validate that change using the registry to make sure they are not pointing to an invalid or malicious Swap Connector instance.

Actions

As described before, actions are where primitives can be combined together to achieve more complex operations. Actions can be granted with Smart Vaults permissions to execute different primitives. An action is a simple smart contract with Smart Vaults permissions that executes a specific set of primitives in a specific order. Context predicates can be defined in each action to control when this should be executed. Moreover, similarly to Smart Vaults, actions also can make use of their built-in authentication logic to control who is allowed to execute these. For example, actions can be triggered by Mimic bots if they allow that.

Bots

Actions can be triggered not only manually, but also automatically by Mimic bots. Of course, this needs to be allowed from the Smart Vault itself beforehand. Smart Vaults can allow Mimic bots to execute certain actions based on their pre-set conditions. Bots will monitor the blockchain and trigger these actions automatically only if said pre-set conditions are met. For example, a Smart Vault could be set to withdraw gains every month. Note that this action can be configured to be executed automatically by a Mimic bot with a gas cost limit or gas price limit.

What’s next

We are currently having tons of conversations with many projects and DAOs that are interested in automating some of their DeFi interactions. Some of these are Paraswap, Balancer, DXdao, Decentraland, Aragon, The Graph, Karpatkey, and others.

If you want to look deeper into what we achieved so far you can follow our open-source repositories in GitHub. Even though all our smart contracts have been reviewed and supervised by security researchers, currently we are going through a formal audit process with one of the top firms in the industry. We will disclose the results and takeovers as soon as we finish the process. The status of our contracts is considered experimental and should be used at your own risk.

Hopefully, soon we will be able to communicate a bug bounty program for the hacker community. However, if you found any potential issue in any of our smart contracts or in any piece of code you consider critical for the safety of the protocol, please contact us through security@mimic.fi.

Mimic Finance

Website | Docs | Discord | Twitter | GitHub

--

--