For the complete documentation index, see llms.txt. This page is also available as Markdown.

Vault Contracts

Load the current vault and asset addresses from Fund Information before calling these methods.

These methods apply to an escrow_vault fund. A clob fund trades on the orderbook. Use Builder Codes in Trading for that builder fee, and do not call requestDeposit or requestRedeem.

Read methods

Method
Purpose

getAsset()

Return the underlying token address.

getMinDepositAmount()

Return the minimum raw asset amount accepted by a deposit request.

getMinRedeemShares()

Return the minimum vault-share amount accepted by a redemption request.

getNextDepositRequestId()

Return the next deposit request identifier.

getUserDepositIds(address user)

Return the user's deposit request identifiers.

balanceOf(address account)

Return the user's settled ERC-20 vault-share balance.

Direct deposit

  1. Approve the underlying asset for the vault.

  2. Call requestDeposit(uint256 assets, address receiver, bytes32 builderFeeData, bytes32 referral). Pass bytes32(0) for builderFeeData when this call does not register a builder. Encoding and approval are in Builder Integration.

  3. Wait for settlement.

  4. If not auto-claimed, call claimDeposit(address receiver, uint256 requestId). claimDeposit does not take builderFeeData.

Direct redemption

  1. Call requestRedeem(uint256 shares, address receiver, bytes32 builderFeeData, bytes32 referral). Pass bytes32(0) for builderFeeData when no fee applies. Encoding and approval are in Builder Integration.

  2. Wait for settlement.

  3. If a leg was not auto-claimed, call claimRedeem(address receiver, uint256 requestId) or claimDelayedRedeem(address receiver, uint256 requestId). These claim calls do not take builderFeeData.

Relayed deposit

requestDepositOnBehalf has no builderFeeData argument, and RequestDeposit has no builder-fee field. A relayer cannot attach a builder fee.

Two signatures are required:

  1. ERC-2612 permit on the underlying asset, with spender = vault. Failures are swallowed, so a prior approve also works and the permit can be empty/0x.

  2. Vault EIP-712 RequestDeposit, using the vault DOMAIN_SEPARATOR() (name = vault.name(), version = "1"). nonce is vault.nonces(onBehalf).

On-chain flow: _useNonce(onBehalf) → best-effort asset.permit(...) → verify RequestDeposit → _requestDeposit(assets, onBehalf, onBehalf, referral), which pulls assets from onBehalf and calls market.swapForShares.

Method

RequestDeposit fields, in order: owner: address, assets: uint256, nonce: uint256, deadline: uint256, referral: bytes32.

Relayed redemption

requestRedeemOnBehalf has no builderFeeData argument, and RequestRedeem has no builder-fee field. A relayer cannot attach a builder fee.

Only one signature is needed: Vault EIP-712 RequestRedeem. The vault uses internal _transfer(onBehalf, vault, shares), so no share approve / permit is required.

On-chain flow: _useNonce(onBehalf) → verify RequestRedeem → _requestRedeem(shares, onBehalf, onBehalf, referral), which moves shares to the vault and calls market.swapForAssets.

Method

RequestRedeem fields, in order: owner: address, shares: uint256, nonce: uint256, deadline: uint256, referral: bytes32.

Both vault requests use domain.name = vault.name(), version = "1", the current chain ID, the vault as verifyingContract, and vault.nonces(onBehalf).

Integration guide

Builder IntegrationVault Lifecycle

Last updated