Vesper Framework Levels
The architectural framework of Vesper Pool smart contracts has evolved over time. Each iteration of the framework is denoted by a version number. (These version numbers are sometimes incorporated into different implementations of the same smart contract — for example PoolStorageV1, PoolStorageV2, PoolStorageV3 . The table below lists attributes of the framework versions.
Vesper's modular architecture allows for upgrading of pools from one framework version to another. At any time contracts of different framework levels may coexist in the Vesper ecosystem, but over time they all tend to be upgraded to the most current version.
The diagram below illustrates how various contracts interact in the V3 framework. The description that follows gives a high-level overview of these processes work. More detailed explanations will be forthcoming soon.
Vesper pool and strategy interactions
Components of the pool system architecture include:
The Pool block represents an implementation of the VPool contract.
Pool rewards is a module for calculating and storing any VSP rewards associated with the pool.
The Pool Accountant keeps track of the strategies used by the pool.
Strategy represents one or more strategy contract for deploying assets to generate yield.
Let’s assume this vesper pool is vDAI pool meaning user will deposit DAI and receive vDAI in return based on pricePerShare at the time of deposit
The Target Protocol block represents the protocol to which the pool's assets have been sent, such as, for instance, Curve, Compound or Yearn.
- 1.The user initiates deposit of DAI in the vDAI pool.
- 2.If the PoolRewards contract exists, the pool sends an update to to the PoolRewards contract, notifying it that the user is depositing in the pool.
- 3.The pool issues shares of vDAI, also known as claim tokens, to the user. These claim tokens go to the user's wallet.
a. The user initiates withdrawal of DAI. To do this, the user must hold vDAI in their wallet.
b. If the PoolRewards contract exists, then the pool sends an update that the user is withdrawing from the pool, and rewards are calculated.
c. The pool maintains a local reserve of DAI in order to cover withdrawals. If the pool's reserve holds sufficient funds to cover the withdrawal, it burns the user's share of vDAI, and transfers to the user an equivalent amount of DAI. Otherwise, if the local reserve does not have sufficient DAI on hand, the pool initiates withdrawal from one or more strategies.
d. A strategy does not hold any collateral, (DAI in this case), so it withdraws DAI from target protocol.
i. Only the keeper can call rebalance on strategies.
ii. Strategies gather data to generate profit/loss and payback statements. In case of profit and/or payback, strategy will withdraw funds from target protocol, given it has deposited funds previously.
iii. The Strategy sends profit/loss and payback statements to the pool.
iv. The Pool passes this information to the PoolAccountant, which is responsible for doing all bookkeeping.
v. The PoolAccountant sends the final standing of the strategy back to the pool and the pool decides whether to give more funds to the strategy or take back from the strategy.
vi. If the strategy has received funds from the pool, it deposits these new funds in the target protocol; otherwise it must withdraw from the target protocol to give funds back to the pool.
Vesper pools supports ERC20 and EIP2612 permit standards.