๐Ÿ›๏ธVault Architecture

Our vault smart contracts follow the ERC-4626arrow-up-right tokenized vault standard. The smart contracts code is available on Calculum GitHubarrow-up-right repository. Each vault also relies on two off-chain bots to function: TransferBot (in charge of moving funds between the vault and the perpetual future DEX wallet, and of collecting fees) and TraderBot (in charge of monitoring the market and executing the systematic trading strategies).

Below is a chart summarizing the high-level working of our vaults and the flow of funds when users deposit/withdraw capital:

Step
Description

  • Trading periods are divided into Epochs of 7-day duration each.

  • Every time a new users enter a vault, their capital is stored inside the vault smart contract until the start of the next epoch.

  • TransferBot is an off-chain bot using OpenZeppelin Defender to trigger a set of actions at the end of each epoch.

  • TransferBot retrieves the dy/dx wallet value (post P&L for the week) and feed it to the vault smart contract; it then calls various functions to calculate the management and performance fees, update the calcVault token price and calculate the amount of deposit asset to transfer.

  • TransferBot also handles the movement of funds between the vault and the dy/dx wallet at the end of each epoch; it is also responsible for transferring the Management Fees and Performance Fees accrued during the epoch to the DAO treasury wallet.

  • At the start of the next epoch, new users receive newly minted calcVault tokens which are a proof of deposit that represent their share of the vault.

  • The amount of calcVault tokens received is based on the calcVault token price at the end of the previous epoch.

  • TraderBot is an off-chain bot connected to the dy/dx API which monitors and analyses the markets in real-time and executes the vaultโ€™s trading strategy (this is where the magic happen!).

  • User can initiate a withdrawal request anytime and must wait until the end of the current epoch to get their funds back (maximum waiting period of 7 days if request submitted right at the start of a new epoch).

  • At the end of the current epoch, TransferBot will execute a set of actions, enabling the user to call the redeem() function anytime after epoch is over.

  • The redeem() function will burn the amount of calcVault tokens requested by the users and send them their share of deposit assets (e.g. USDC) based on the calcVault token price at the end of the epoch when the withdrawal was initiated.

Last updated