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
.
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 of32
whitelisted positions/assets.Each position in the
Pool
has aRateProvider
.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 ofPoolToken
is the amount of liquidity units in thePool
and is a way of accountingPool
balances. For example, if theRateProvider
prices assets in USD and total supply ofPoolToken
is 10,000,000 the amount of money in thePool
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 newPoolToken
supply and an amount ofPoolToken
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 ofPoolToken
minted to theVault
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 thePool
.can set the
Pool
swap fee.can trigger pause mode.
can trigger kill mode, which cannot be undone.
The deposit flow is:
addLiquidity
toPool
and mintPoolToken
deposit
PoolToken
intoVault
The withdraw flow is:
redeem
vault shares fromVault
to receivePoolToken
removeLiquidity
orremoveLiquiditySingle
fromPool
by buringPoolToken
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