Depositing to a Vault
For a full process overview please see the System Diagram
The User can Deposit through SmartVaultManager.sol for normal deposits or DepositSwap.sol if they would like to swap their assets before they reach the Smart Vault.
There are multiple actors during the deposit process, namely:
Owner: The address that holds the assets to be used for the deposit (the source of funds). This address also needs to initiate the transaction.
Receiver: The beneficiary of the deposited assets and the Deposit NFT. The deposit will be tracked internally under this address as well.
Process Flow
User deposits into a Smart Vault.
SmartVaultFlush is invoked. Vault Flush Implementation
DoHardWork (DHW) runs for all Strategies. DoHardWork (DHW) Implementation
Vault Sync. Vault Sync Implementation
User Deposits into a Smart Vault
The user has to approve SmartVaultManager.sol to transfer assets on their behalf.
NB: Deposited assets are not routed to the strategies/protocols immediately.
The system mints a Deposit NFT (D-NFT) with associated on-chain metadata (timestamp, deposited assets etc).
Assets are sent to the MasterWallet.sol to be held in escrow.
The system does internal bookkeeping and marks the assets to be included in the next "Smart Vault Flush".
Smart Vault Flush
This is a synchronization point for Smart Vault deposits and withdrawals.
Assets are market to be picked up in the next DoHardWork (DHW) cycle.
All subsequent deposits and withdrawals are marked to be included in the next Flush.
This process is to ensure that all Smart Vault members are treated equally with their shares being distributed fairly.
This process is executed by users.
Asynchronous DoHardWork
This is executed for each individual strategy.
Withdraws from or deposits into underlying protocols.
Pulls assets that have been deposited by the user from the MasterWallet.
Withdraws assets from the underlying Protocols back into the MasterWallet.
The time between two DHW instances for a specific strategy should theoretically be within 24 hours.
The time to execute DHWs for all strategies within a given Smart Vault takes no longer than 24 hours.
Only after all DHWs required for a specific Smart Vault have been completed can we accurately know how many SVTs/shares a user will receive. This is due to slippages and other fees.
The system also mints Strategy Share Tokens (SSTs) that are allocated to or claimed by Smart Vaults.
This process is executed by a trusted actor/Spool infrastructure.
Vault Sync
This step updates the vault state after DHW is completed. It runs automatically when the first user after DHW takes an action in the vault (deposits, withdraws, claims), but it can also be executed separately.
As part of this, the Vault Sync:
Transfers new strategy shares (SSTs) from a strategy to the vault
Mint appropriate amount of vault shares (SVTs)
Calculates management and performance fees
Last updated