Skip to content本文へ移動

Vault Development · Vault Fundamentals · 3/7

Vault Deposits & Withdrawals

How Deposits Work

When a user deposits USDC into a vault, they own a proportional share of the vault's equity. Hyperliquid tracks each depositor's equity rather than issuing share tokens, but a share-price model is a useful way to reason about it:

Shares Received = Deposit Amount / Current Share Price
Share Price = Total Vault Equity / Total Shares Outstanding

Example

If the vault makes a 10% profit:

Reading Vault State

The SDK has no dedicated helper for vault details, so post the vaultDetails request directly (info endpoint docs):

from hyperliquid.info import Info
from hyperliquid.utils import constants

info = Info(constants.MAINNET_API_URL, skip_ws=True)  # read-only

# Get vault details
vault_details = info.post("/info", {"type": "vaultDetails",
                                    "vaultAddress": vault_address})

print(f"Vault Name: {vault_details['name']}")
print(f"Leader: {vault_details['leader']}")
print(f"Leader fraction: {vault_details['leaderFraction']}")
print(f"Allow deposits: {vault_details['allowDeposits']}")
print(f"APR: {vault_details['apr']}")

# Get vault equity and positions
vault_state = info.user_state(vault_address)
print(f"Account value: ${vault_state['marginSummary']['accountValue']}")
for pos in vault_state["assetPositions"]:
    p = pos["position"]
    print(f"  {p['coin']}: {p['szi']} @ {p['entryPx']}")

Withdrawals

Depositors can withdraw once the lockup has passed: 1 day after the most recent deposit for user vaults, 4 days for HLP (depositor docs).

# Testnet only. Withdraw 500 USDC (usd is an integer in micro-USDC)
exchange.vault_usd_transfer(vault_address, False, 500_000_000)

Important Considerations

  1. Withdrawal Impact — If there is not enough free margin, open orders using margin are canceled first; if that is still not enough, 20% of positions are closed repeatedly until the withdrawal can be paid (vault leader docs)
  2. Lockup Periods — Fixed by the protocol (1 day for user vaults, 4 days for HLP), not chosen by the leader
  3. No Withdrawal Fee — The only fee is the leader's 10% profit share on gains
  4. Proportional Close Option — Leaders can set the vault to always close positions proportionally on withdrawals, keeping liquidation prices similar
  5. Leader Minimum — The leader cannot withdraw if it would drop their share below 5%

Profit Distribution

Profits are distributed through the share price mechanism:

The docs give an example: deposit 100 USDC into a 900 USDC vault (10%); the vault grows to 2,000 USDC; withdrawing yields 200 USDC minus a 10 USDC profit share (10% of the 100 USDC gain), so 190 USDC, before any slippage from closing positions.

Fee Calculation

Depositor Profit = (Exit Share Price - Entry Share Price) * Shares
Leader Fee = Depositor Profit * Profit Share Rate
Net Depositor Profit = Depositor Profit - Leader Fee

Monitoring Vault Performance

Key metrics to track:

vault 開発 · vault の基礎 · 3/7

vault への入金と引き出し

入金の仕組み

vault に USDC を入れると、vault の資産のうち、入れた額に応じた持ち分を持つことになります。Hyperliquid は持ち分のトークンを発行するのではなく、預けた人ごとの資産額を記録しています。それでも、1口あたりの価格で考えると分かりやすくなります。

Shares Received = Deposit Amount / Current Share Price
Share Price = Total Vault Equity / Total Shares Outstanding

例

vault が10%の利益を出すと、次のようになります。

vault の状態を読む

SDK には vault の詳細を取る専用の関数がありません。vaultDetails のリクエストを直接送ります(info エンドポイントの資料)。

from hyperliquid.info import Info
from hyperliquid.utils import constants

info = Info(constants.MAINNET_API_URL, skip_ws=True)  # read-only

# Get vault details
vault_details = info.post("/info", {"type": "vaultDetails",
                                    "vaultAddress": vault_address})

print(f"Vault Name: {vault_details['name']}")
print(f"Leader: {vault_details['leader']}")
print(f"Leader fraction: {vault_details['leaderFraction']}")
print(f"Allow deposits: {vault_details['allowDeposits']}")
print(f"APR: {vault_details['apr']}")

# Get vault equity and positions
vault_state = info.user_state(vault_address)
print(f"Account value: ${vault_state['marginSummary']['accountValue']}")
for pos in vault_state["assetPositions"]:
    p = pos["position"]
    print(f"  {p['coin']}: {p['szi']} @ {p['entryPx']}")

引き出し

預けた人は、ロック期間が過ぎれば引き出せます。ユーザーの vault では最後の入金から1日、HLP では4日です(預ける人向けの資料)。

# Testnet only. Withdraw 500 USDC (usd is an integer in micro-USDC)
exchange.vault_usd_transfer(vault_address, False, 500_000_000)

気をつけること

  1. 引き出しの影響 — 空いている証拠金が足りないと、まず証拠金を使っている未約定の注文が取り消されます。それでも足りなければ、引き出しを払えるまで、ポジションの20%ずつを繰り返し閉じます(vault リーダー向けの資料)
  2. ロック期間 — プロトコルが固定しています(ユーザーの vault は1日、HLP は4日)。リーダーが選ぶものではありません
  3. 引き出しの手数料はない — 手数料は、利益に対するリーダーの10%の取り分だけです
  4. 持ち分に応じて閉じる設定 — リーダーは、引き出しのときに常にポジションを持ち分に応じて閉じるよう設定できます。こうすると清算価格が大きく変わりません
  5. リーダーの下限 — 引き出すとリーダーの持ち分が5%を下回る場合、リーダーは引き出せません

利益の分け方

利益は、1口の価格を通じて分けられます。

資料には次の例があります。900 USDC の vault に 100 USDC を入れます(10%)。vault が 2,000 USDC に増えます。引き出すと 200 USDC から 10 USDC の取り分(100 USDC の利益の10%)が引かれ、190 USDC になります。ポジションを閉じるときのスリッページは別です。

手数料の計算

Depositor Profit = (Exit Share Price - Entry Share Price) * Shares
Leader Fee = Depositor Profit * Profit Share Rate
Net Depositor Profit = Depositor Profit - Leader Fee

vault の成績を見張る

追いかけておきたい指標は次のとおりです。