Skip to content
Docs
Open app
Skip to Content

Vault operations

Follow a deposit or withdrawal request through the vault contract, from the wallet call to settlement, and the events each step emits.

Request lifecycle

A user never moves assets into a strategy directly. Each deposit or withdrawal is stored on the vault as a request, and the vault operator settles pending requests together during the vault’s settlement window. Submitting a request and settling it are separate transactions.

StepCalled byDepositWithdrawal
RequestUserDepositRequestedWithdrawRequested
Cancel, while still pendingUserDepositCancelledWithdrawCancelled
SettleVault operatorDepositExecutedWithdrawExecuted

A request that has been cancelled or settled is removed from the vault’s request buffer, so each request_id ends in exactly one cancelled or executed event.

Public entry functions

The user-facing functions live in the volo_vault::user_entry module. They are public functions rather than entry functions, so call them from a Sui programmable transaction block (PTB). Locate the package in the contract reference.

FunctionPurpose
deposit / deposit_with_auto_transferSplit amount from the coin and record a deposit request. Pass option::none() for the first deposit to be issued a new Receipt, or pass an existing receipt to add to that position. Returns the request_id. The _with_auto_transfer variant sends the receipt and the remaining coin back to the sender.
cancel_deposit / cancel_deposit_with_auto_transferCancel a pending deposit request and return the full coin amount.
withdraw / withdraw_with_auto_transferRequest the redemption of shares from a receipt. With auto transfer, the principal is sent to the sender at settlement. Without it, the principal is held as claimable for the receipt.
withdraw_with_swapRequest a withdrawal that the operator settles in TargetAssetType instead of the principal coin, within slippage_bps. Also emits WithdrawSwapRequested. The operator can still settle it as a plain withdrawal, which emits WithdrawSwapRequestDropped.
cancel_withdrawCancel a pending withdrawal request and return the shares to the receipt.
claim_claimable_principalTake principal from a settled withdrawal that was not auto-transferred.

Request rules

  • Slippage bounds. A deposit carries expected_shares and a withdrawal carries expected_amount. Settlement aborts if the vault would issue fewer shares or pay out less than requested.
  • Cancellation. A request can be cancelled only after the vault’s locking_time_for_cancel_request has passed since it was submitted, and not while the operator is running a settlement. Changes to the window emit LockingTimeForCancelRequestChanged.
  • Withdrawal lock. A withdrawal can be requested only after locking_time_for_withdraw has passed since the receipt’s last deposit. Read it with check_locking_time_for_withdraw. Changes emit LockingTimeForWithdrawChanged.
  • Fees. The deposit fee and withdrawal fee are deducted at settlement, not at request time. Read the current rates, in basis points, with deposit_fee_rate and withdraw_fee_rate. Changes emit DepositFeeChanged and WithdrawFeeChanged.

Settlement

During the settlement window the operator updates the value of the vault’s assets and then executes the pending requests.

  • Deposits. The vault deducts the deposit fee, converts the rest to shares at the current share ratio and emits DepositExecuted with the shares issued.
  • Withdrawals. The vault converts the shares to principal at the current share ratio, deducts the withdrawal fee and emits WithdrawExecuted with the amount paid. A swapped withdrawal also emits WithdrawWithSwapExecuted.

Strategy operations that take assets out of the vault are bracketed by OperationStarted and OperationEnded. When they finish, the vault compares its value before and after and emits OperationValueUpdateChecked. The transaction aborts if the accumulated loss for the current period exceeds the vault’s loss tolerance.

Strategy-specific work

The xBTC and wBTC examples use BTC-backed collateral. The operator monitors collateral and debt as their relative values change.

DEX vaults

In the Momentum stablecoin example, the operator allocates deposits to trading pools and adjusts liquidity ranges. See the strategy guide for the income and costs associated with these positions.

Further reading

For contract boundaries see the architecture diagrams. For an independent review, see the vault audits. The security section describes transaction screening, settlement checks and on-chain monitoring. For the user-facing view of the same cycle, see how a deposit request settles.

On this page