Architecture Overview

Architecture Overview

The Vault architecture consists of one main smart contract called Pool. Underneath, the vault prices its underlying tokens along a weighted stableswap curve. The stableswap algorithm is a fork of yearn.finance yETH.

Afnixi+D=ADfn+Dn+1fnixiviA f^n \sum_i x_i + D = A D f^n + \frac{D^{n+1}}{f^n \prod_i x_i^{v_i}}

For the derivation, one can refer to this whitepaper.

A vault has 4 main components -

  • Pool

  • PoolToken

  • Vault

  • RateProvider

Specifications

  • The Pool is responsible for custodying deposited funds.

  • The Pool contains a maximum of 32 whitelisted positions/assets.

  • Each position in the Pool has a RateProvider.

  • The Pool contract keeps a track of asset balances, asset weights and asset rates.

  • The actual composition of an asset in the Pool is allowed to fluctuate within a fixed range around the weight.

  • If any operation increases or decreases the total amount of liquidity in the Pool, an equal amount of PoolToken is minted or burned, respectively. This mechanism ensures that the total supply of PoolToken is the amount of liquidity units in the Pool and is a way of accounting Pool balances. For example, if the RateProvider prices assets in USD and total supply of PoolToken is 10,000,000 the amount of money in the Pool is worth 10,000,000 USD.

  • Users can deposit any combination of whitelisted assets into the Pool. The stableswap invariant will be evaluated to determine the new PoolToken supply and an amount of PoolToken tokens equal to the increase in supply is minted to the user.

  • It is possible to perform swaps using the pool assets. Like a traditional stableswap pool, this is done by first updating the virtual balance of the input asset and solving the stableswap invariant for the new virtual balance of the output asset.

  • The Pool charges a fee on swaps, in the form of PoolToken minted to the Vault contract.

Pool Owner Rights

A Pool owner or a curator can

  • start a gradual amplification change.

  • can whitelist a new asset, which sets an initial weight, set the RateProvider, with an initial deposit.

  • can update the RateProvider for an asset in the Pool.

  • can set the Pool swap fee.

  • can trigger pause mode.

  • can trigger kill mode, which cannot be undone.

The deposit flow is:

  • addLiquidity to Pool and mint PoolToken

  • deposit PoolToken into Vault

The withdraw flow is:

  • redeem vault shares from Vault to receive PoolToken

  • removeLiquidity or removeLiquiditySingle from Pool by buring PoolToken

The Vault contract can be queried using the functions convertToAssets to accurately quantify the price of one share and is used to measure performance of the Pool.

The Pool contract is to be used to manage liquidity for an asset across multiple liquidity venues. Using RateProvider contracts and configuring Pool weights and amplification, is it possible to influence and incentivise real-time rebalancing of liquidity depending on market volumes.

This is useful for stablecoin, LST/LRT protocols that require monitoring of liquidity at multiple venues like Morpho, Pendle, Curve etc.

We encourage protocols to use this architecture source and manage liquidity.

Last updated