Vault Design
Last updated
Last updated
Vault Architecture
Each vault (GLP++, GM, etc.) is a standalone unit made up of two key components: the Vault, and the Trader. The Vault is an ERC-4626 compatible single staking vault, which handles all deposit, withdrawal, and share accounting functions. The Trader is tasked to deploy the vault’s funds according to the vault’s designated trading strategy.
In V0 whitelisted proof-of-concept vaults, this address has been an EOA controlled by BWS Labs. For production vaults, the Trader will be a smart contract which provides an interface for executing the strategy safely.
Vault Process
The vault works in cycles called “epochs”. Each epoch has a funding phase, a trading phase, and a withdrawal phase. When the vault opens in the funding phase, users can deposit the vault’s underlying currency, or withdraw their assets if they have a balance from previous epochs. During the trading phase, users may not deposit or withdraw, and the trader may take custody of the vault’s funds. When the trader returns the vault’s funds, the epoch ends, and the vault enters a withdrawal-only state until another epoch and its associated funding window is started.
Each vault follows the same steps for each epoch:
Vault opens;
The user deposits the vault’s underlying token, ex. USDC, and receives share tokens representing an equivalent percentage of total vault funds;
The vault closes and the trader takes custody of the funds;
Strategies are executed by the experienced Investment Team through the Trader Smart Contract. Only designated traders from the BWS trading team can interact with the trader contract
The Trader Smart Contract restricts the traders to a specific set of actions, only for whitelisted DeFi protocols;
BWS Trading Engine uses the locked funds to execute trades;
The Trader unwinds all positions and returns the vault funds and profits/losses, less fees, to the vault;
The vault is in a withdrawal only state until the next funding window opens.
Vault Contract Structure
D-Squared has designed its trader smart contracts on a modular basis. The strategy’s modules are selected when it is built, and cannot be changed once deployed, providing assurance to the user that their funds can only be used as originally stated.
Initially, the strategies will have a limited selection of modules to choose from. Over time as more modules are developed and audited, more complex strategies will be possible, and the protocol will be well-positioned to take advantage of any emerging market opportunities by deploying a new Vault and Strategy with the appropriate mix of modules.