TheoDepositVault

TheoDepositVault is the vault contract responsible for Straddle deposits. Users deposit ETH or WETH in exchange for ERC20 vault shares which entitle them to strategy profits.

Overview

  • The vault operates in one week rounds.

  • Rounds are rolled over when the rollToNextRound method is called by VaultKeeper, a Theo smart contract.

  • When rolling over, the VaultKeeper provides the currentBalance (i.e. total value of the strategy's assets), thereby determining the pricePerShare.

  • Deposits and withdrawals are only processed when rounds roll over, at the given pricePerShare.

Core Methods

depositETH

function depositETH() external payable nonReentrant

Deposits ETH into the vault (for WETH-denominated vaults). This function can only be called if the vault is set to public.

Parameters

NameTypeDescription

msg.value

uint256

The amount of ETH to be deposited.

deposit

function deposit(uint256 amount) external nonReentrant

Deposits the vault asset (including WETH) into the vault. This function can only be called if the vault is set to public.

Before depositing, the sender must approve the vault to transfer the ERC20 token on their behalf.

Parameters

NameTypeDescription

amount

uint256

The amount of the asset to deposit.

privateDepositETH

function privateDepositETH(bytes32[] memory proof) external payable nonReentrant

Deposits ETH into the vault (for WETH-denominated vaults). This function is used for private vaults and can only be called if the sender is whitelisted.

The proof should be obtained from an off-chain service e.g. the Theo user interface.

Parameters

NameTypeDescription

proof

bytes32[]

The Merkle proof for the whitelist verification.

msg.value

uint256

The amount of ETH to be deposited.

privateDeposit

function privateDeposit(uint256 amount, bytes32[] memory proof) external nonReentrant

Deposits the vault asset (including WETH) into the vault. This function is used for private vaults and can only be called if the sender is whitelisted.

The proof should be obtained from an off-chain service e.g. the Theo user interface.

Parameters

NameTypeDescription

amount

uint256

The amount of the asset to deposit.

proof

bytes32[]

The Merkle proof for the whitelist verification.

withdrawInstantly

function withdrawInstantly(uint256 amount) external nonReentrant

Instantly withdraws the specified amount of the vault asset from a pending deposit made in the current round.

Parameters

NameTypeDescription

amount

uint256

The amount of the asset to withdraw.

initiateWithdraw

function initiateWithdraw(uint256 numShares) external nonReentrant

Initiates a withdrawal of the specified number of shares that can be processed once the round completes.

If the sender has a pending withdrawal from a past round, they must first call completeWithdraw before initiating a new withdrawal.

Parameters

NameTypeDescription

numShares

uint256

The number of shares to withdraw.

completeWithdraw

function completeWithdraw() external nonReentrant

Completes a withdrawal initiated in a past round. Uses the finalized price per share for that round.

Last updated