本ページはコミュニティ翻訳です。参考用であり、内容は英語版を優先します。
英語の原文を見る ↗

HIP-3 デプロイヤーアクション

ビルダーがデプロイした永続契約 DEX をデプロイ・運用するための API には、以下の L1 アクションが関わります:

// IMPORTANT: All lists of tuples should be lexographically sorted before signing
type PerpDeployAction =
  | {
      type: "perpDeploy";
      registerAsset2: RegisterAsset2;
    }
  | {
      type: "perpDeploy";
      registerAsset: RegisterAsset;
    }
  | {
      type: "perpDeploy";
      setOracle: SetOracle;
    }
  | {
      type: "perpDeploy";
      setFundingMultipliers: SetFundingMultipliers;
    }
  | {
      type: "perpDeploy";
      setFundingInterestRates: SetFundingInterestRates;
    }
  | {
      type: "perpDeploy";
      setFundingClamps: SetFundingClamps;
    }
  | {
      type: "perpDeploy";
      haltTrading: { coin: string; isHalted: boolean };
    }
  | {
      type: "perpDeploy";
      insertMarginTable: InsertMarginTable;
    }
  | {
      type: "perpDeploy";
      setMarginTableIds: SetMarginTableIds;
    }
  | {
      type: "perpDeploy";
      setFeeRecipient: { dex: string; feeRecipient: address };
    }
  | {
      type: "perpDeploy";
      setOpenInterestCaps: SetOpenInterestCaps;
    }
  | {
      type: "perpDeploy";
      setSubDeployers: { dex: string; subDeployers: Array<SubDeployerInput> };
    }
  | {
      type: "perpDeploy";
      setMarginModes: SetMarginModes;
    }
  | {
      type: "perpDeploy";
      setDeployerFees: SetDeployerFees;
    }
  | {
      type: "perpDeploy";
      setPerpAnnotation: SetPerpAnnotation;
    }
  | {
      type: "perpDeploy";
      disableDex: string;
    };

// User-signed action to transfer collateral between the user's DEX account and its backstop liquidator.
// ntl must be positive and a multiple of 1_000_000_000.
type Hip3LiquidatorTransferAction = {
  type: "hip3LiquidatorTransfer";
  dex: string;
  ntl: number; // Integer amount in millionths of a collateral token: 1_000_000_000 = 1,000 tokens
  isDeposit: boolean; // true deposits; false withdraws
};

/**
 * RegisterAsset2 can be called to initialize a new dex and register an asset at the same time.
 * If schema is not provided, then RegisterAsset can be called multiple times to register additional assets
 * for the provided dex.
 * @param maxGas - Max gas in native token wei. If not provided, then uses current deploy auction price.
 * If the max gas is 0, then a reserve deployment will be used.
 * A reserve deployment allows deployment at the current price of the gas auction, even if it has ended.
 * Currently, 7 reserve deployments are allowed.
 * IMPORTANT: A reserve deployment will be used regardless of whether the auction has completed, so deployers should query the auction status first.
 * @param assetRequest - Contains new asset listing parameters. See RegisterAssetRequest2 below for details.
 * @param dex - Name of the perp dex (2-4 lowercase characters)
 * @param schema - Contains new perp dex parameters. See PerpDexSchemaInput below for details.
 */
type RegisterAsset2 = {
  maxGas?: number;
  assetRequest: RegisterAssetRequest2;
  dex: string;
  schema?: PerpDexSchemaInput;
};

// Same as RegisterAsset2 but uses RegisterAssetRequest
type RegisterAsset = {
  maxGas?: number;
  assetRequest: RegisterAssetRequest;
  dex: string;
  schema?: PerpDexSchemaInput;
};

type RegisterAssetRequest2 = {
  coin: string;
  szDecimals: number;
  oraclePx: string;
  marginTableId: number;
  marginMode: "strictIsolated" | "noCross" | "normal"; // strictIsolated does not allow withdrawing of isolated margin from open positions
};

type RegisterAssetRequest = {
  coin: string;
  szDecimals: number;
  oraclePx: string;
  marginTableId: number;
  onlyIsolated: boolean;
};

/**
 * The markPxs outer list can be length 0, 1, or 2. The median of these inputs
 * along with the local mark price (median(best bid, best ask, last trade price))
 * is used as the new mark price update.
 *
 * SetOracle can be called multiple times but there must be at least 2.5 seconds between calls.
 *
 * Stale mark prices will be updated to the local mark price after 10 seconds of no updates.
 * This fallback counts as an update for purposes of the maximal update frequency.
 * This fallback behavior should not be relied upon. Deployers are expected to call setOracle every 3 seconds even with no changes.
 *
 * All prices are clamped to 10x the start of day value.
 * markPx moves are clamped to 1% from previous markPx.
 * markPx cannot be updated such that open interest would be 10x the open interest cap.
 * @param dex - Name of the perp dex
 * @param oraclePxs - A list (sorted by key) of asset and oracle prices.
 * @param markPxs - An outer list of inner lists (inner list sorted by key) of asset and mark prices.
 * @param externalPerpPxs - A list (sorted by key) of asset and external prices which prevent sudden mark price deviations.
 * Ideally externally determined by deployer, but could fall back to an EMA of recent mark prices.
 * Must include all assets.
 */
type SetOracle = {
  dex: string;
  oraclePxs: Array<[string, string]>;
  markPxs: Array<Array<[string, string]>>;
  externalPerpPxs: Array<[string, string]>;
};

/**
 * @param fullName - Full name of the perp dex
 * @param collateralToken - Collateral token index
 * @param oracleUpdater - User to update oracles. If not provided, then deployer is assumed to be oracle updater.
 */
type PerpDexSchemaInput = {
  fullName: string;
  collateralToken: int;
  oracleUpdater?: string;
};

/**
 * A sorted list of asset and funding multiplier.
 * Multipliers must be between 0 and 10 and are used to scale the funding rate.
 */
type SetFundingMultipliers = Array<[string, string]>;

/**
 * A sorted list of asset and 8 hour interest rate.
 * Interest rates must be between -0.01 and 0.01 and are used as the interest rate
 * component in the funding calculation.
 */
type SetFundingInterestRates = Array<[string, string]>;

/**
 * A sorted list of asset and 8 hour funding clamp.
 * Clamps must be between 0 and 0.01 and bound how far the funding rate can move away from the
 * average premium toward the interest rate. Defaults to 0.0003.
 */
type SetFundingClamps = Array<[string, string]>;

/**
 * A sorted of asset and margin table ids.
 * Margin table ids must be non-zero.
 */
type SetMarginTableIds = Array<[string, number]>;

/**
 * Inserts margin table to dex
 */
type InsertMarginTable = {
  dex: string;
  marginTable: RawMarginTable;
};

/**
 * marginTiers must be sorted in order of increasing lower bound and decreasing maxLeverage
 * marginTiers has a maximum length of 3.
 */
type RawMarginTable = {
  description: string;
  marginTiers: Array<RawMarginTier>;
};

/**
 * lowerBound is a position notional value above which the leverage is constrained by maxLeverage
 */
type RawMarginTier = {
  lowerBound: int;
  maxLeverage: MaxLeverage;
};

/**
 * Max leverage is in the range [1, 50]
 */
type MaxLeverage = number;

/**
 * A sorted list of asset and open interest cap notionals.
 * Open interest caps must be at least the maximum of 1_000_000 (1 size unit of collateral asset) or half of the current open interest.
 * null removes the custom cap for an asset.
 */
type SetOpenInterestCaps = Array<[string, number | null]>;

/**
 * A modification to sub-deployer permissions
 */
type SubDeployerInput = {
  variant: string; // corresponds to a variant of PerpDeployAction. For example, "haltTrading" or "setOracle"
  user: String;
  allowed: boolean; // add or remove the subDeployer from the authorized set for the action variant
};

// A sorted list of (coin, marginMode). See RegisterAssetRequest2 for margin mode definitions.
type SetMarginModes = Array<[string, "strictIsolated" | "noCross" | "normal"]>;

// Let the user normal rate be `x`. Let the user rate be `y` after accounting for aligned quote collateral.
// In other words, `x = y` for non-aligned collateral.
// User pays or receives rebate `P + D` where `P` goes to protocol and `D` goes to deployer.
// If `x > 0` and `scale < 1`, `P = y` and `D = scale * x`
// If `x > 0` and `scale > 1`, `P = y * scale` and `D = x * scale`
// If `x < 0` and `scale < 1`, `P = y / (1 + scale)` and `D = y * scale / (1 + scale)`
// If `x < 0` and `scale > 1`, `P = y / 2` and `D = y / 2`
// On Mainnet, rate limited to one change per 30 days.
// Note that there are currently no aligned quote assets on mainnet.
type SetDeployerFees = Array<
  [
    string,
    {
      scale: string; // Decimal string in [0.0, 3.0], or [0.0, 10.0) when growthMode is true
      growthMode: boolean;
    },
  ]
>;

// category <= 15 characters
// description <= 400 characters
// displayName <= 9 characters
// <= 2 keywords, each keyword <= 10 characters
type SetPerpAnnotation = {
  coin: string;
  category: string;
  description: string;
  displayName: string | null;
  keywords: Array<string>;
};

以下の例において、feeScale は SetDeployerFees の scale フィールドです。1 単位の正の通常ユーザー手数料と非アラインド担保(x = y = 1)を想定します。userFeeToProtocol と userFeeToDeployer は、ユーザーに課金される結果の手数料単位です。

growthMode feeScale userFeeToProtocol userFeeToDeployer
false "0" 1 0
false "0.5" 1 0.5
false "1" 1 1
false "3" 3 3
true "0" 0.1 0
true "0.5" 0.1 0.05
true "1" 0.1 0.1
true "3.01" 0.301 0.301
true "9.99" 0.999 0.999

永続契約デプロイオークションのステータスを照会する方法については、https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-information-about-the-perp-deploy-auction を参照してください。

建玉上限

ビルダーがデプロイした永続契約市場には、ノショナル(ポジションサイズの絶対値とマーク価格の積の合計)とサイズ(ポジションサイズの絶対値の合計)の 2 種類の建玉上限が適用されます。

ノショナル建玉上限は、DEX 内のすべての資産にわたる合計建玉および資産ごとに適用されます。永続契約デプロイヤーは資産ごとにカスタム建玉上限を設定できます。これは https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/hip-3-deployer-actions に記載されています。

サイズ建玉上限は資産ごとにのみ適用されます。サイズ建玉上限は現在、資産ごとに定数 1B であるため、初期マーク価格で最小サイズ刻みが $1〜10 になるように szDecimals を設定するのが妥当なデフォルトです。

バックストップ清算人

バックストップ清算人アドレスは 0x4000000000000000000000000000000000000000 + {dex_index} です。例えば、最初の HIP-3 DEX のバックストップ清算人アドレスは 0x4000000000000000000000000000000000000001 です。

ノードのユーザーアカウントサマリー

ノードフラグ --write-user-account-summaries <dex> は、指定された HIP-3 DEX のアカウントサマリーを ~/hl/data/dex_user_account_summaries/hourly/<date>/<hour> に毎時のファイルとして書き込みます。ここで date は YYYYMMDD です。各行は JSON 配列 [time, messages] で、time はブロック時刻、messages は DEX 上のすべてのユーザーの単一スナップショットまたはユーザーごとの差分のリストです:

["2026-09-24T09:00:00.123", [{ "Snapshot": { "0xUSER_A": { "a": "100.0", "b": "90.0" } } }]]
["2026-09-24T09:00:03.456", [{ "Diff": ["0xUSER_A", { "a": "105.0", "b": "90.0" }] }]]

a はアカウント価値、b は balance = accountValue - unrealizedPnl で、いずれもそのベニューの担保トークンで表されます。各ファイルの最初の行、およびノード起動後に書き込まれる最初の行はスナップショットです。その他の行には、サマリーが変化したユーザーの差分が含まれます: ベニューのオラクル更新時にはそのようなユーザー全員、または約定、清算、ファンディング支払い、ベニューへの/からの送金に関与したユーザーのみです。

HIP-3*(テストネット専用)

Star アクション

HIP-3 ベニューは、作成時に PerpDexSchemaInput で isStar: true を設定することで HIP-3* に指定できます。このオプションのブール値はデフォルトで false です。HIP-3* は HIP-3 仕様に加えて、許可リストやプロキシユーザーアクションなどのいくつかの機能を有効にします。

オペレーション

type Hip3StarAction = {
  type: "perpDeploy";
  star: { dex: string; operation: Hip3StarOperation };
};

type Hip3StarOperation =
  | { proxy: [address, Hip3StarProxyOperation] }
  | { setOracle: { oraclePxs: Array<[string, string]> } };

// CancelAction and OrderAction are the standard exchange actions.
type Hip3StarProxyOperation =
  | { modifyApproval: boolean }
  | { modifyBackstopLiquidatorApproval: boolean }
  | { setReduceOnly: boolean }
  | { cancel: Omit<CancelAction, "type"> }
  | { cancelAll: { assets?: Array<number> | null } }
  | { order: Omit<OrderAction, "type"> }
  | { sendAsset: { destination: address; amount: string } };
{
  "type": "perpDeploy",
  "star": {
    "dex": "test",
    "operation": { "proxy": ["0xUSER_A", { "modifyApproval": true }] }
  }
}
{
  "type": "perpDeploy",
  "star": {
    "dex": "test",
    "operation": { "proxy": ["0xUSER_B", { "cancelAll": { "assets": [100001, 100002] } }] }
  }
}
{
  "type": "perpDeploy",
  "star": {
    "dex": "test",
    "operation": { "setOracle": { "oraclePxs": [["test:BTC", "100000.0"], ["test:ETH", "4000.0"]] } }
  }
}
  • proxy — ユーザーアドレスと、そのユーザーに適用される 1 つのプロキシオペレーションのペアです。
  • setOracle — 以下のオラクルのセクションで説明するとおり、オラクル価格を更新します。

プロキシオペレーション

  • modifyApproval — { "modifyApproval": true } はユーザーを許可リストに追加し、false はユーザーを削除してそのフラグをクリアします。承認されていないユーザーの削除は no-op です。承認済みユーザーの再承認は no-op で、ユーザーのフラグは保持されます。削除されたユーザーが再度承認されると、デフォルトのフラグから始まります。
  • modifyBackstopLiquidatorApproval — { "modifyBackstopLiquidatorApproval": true } は、ユーザーが hip3LiquidatorTransfer を通じてベニューのバックストップ清算人に入出金することを許可し、false はこれを取り消します。ユーザーは modifyApproval によって既に承認されている必要があります。
  • setReduceOnly — { "setReduceOnly": true } は、承認されたユーザーをベニュー上でポジションの減少のみに制限します。ユーザーはリデュースオンリー注文と TWAP の発注、注文のリデュースオンリー注文への変更、キャンセルのみが可能です。{ "setReduceOnly": false } は完全な取引を復元します。
  • cancel — { "cancel": { "cancels": [{ "a": <asset>, "o": <oid> }] } }、標準の cancel 取引アクションペイロードです。oid によってユーザーの待機注文をキャンセルします。
  • cancelAll — { "cancelAll": { "assets": null } } はこのベニュー上のユーザーのすべての待機注文と TWAP をキャンセルします。{ "cancelAll": { "assets": [<asset>, ...] } } は、リストされた資産のユーザーの待機注文と TWAP のみをキャンセルします。リストは 1〜10 エントリを含む必要があります。
  • order — { "order": { "orders": [...], "grouping": "na" } }、標準の order 取引アクションペイロードです。すべての注文がリデュースオンリー("r": true)でなければなりません。
  • sendAsset — { "sendAsset": { "destination": "0xUSER_C", "amount": "100.0" } }。プロキシ対象ユーザーの DEX 上のアカウントから、同じベニューの destination のアカウントへ担保を移動します。

オラクル

HIP-3* ベニューは setOracle star オペレーションのデプロイアクションで価格を更新します。oraclePxs は、資産とスポットオラクル価格の(キーでソートされた)リストです。外部永続契約価格とマーク価格は、デプロイヤーのスポットオラクル価格の入力に基づいてオンチェーンで導出されます。

  • 外部永続契約価格は、同じ名前のメイン DEX 資産から、額面を USDC に変換して導出されます。例えば、test:BTC は BTC の外部永続契約価格を使用します。
  • マーク価格は以下の中央値としてオンチェーンで計算されます:
  1. オラクル価格を、ミッド価格のオラクル価格に対するプレミアムの指数移動平均で調整したもの、
  2. 外部永続契約価格、および
  3. ローカルマーク価格(median(best bid, best ask, last trade price))。

これらの価格のうち 2 つしか利用できない場合、ローカルマーク価格の指数移動平均が 3 番目の入力として加えられます。

権限

HIP-3* の場合、SubDeployerInput.variant は以下に示すオブジェクトも受け付けます。

Operation Deployer Sub-deployer grant
modifyApproval yes { "hip3Star": "modifyApproval" }
modifyBackstopLiquidatorApproval yes { "hip3Star": "modifyBackstopLiquidatorApproval" }
setReduceOnly yes { "hip3Star": "setReduceOnly" }
cancel yes { "hip3Star": "cancel" }
cancelAll yes { "hip3Star": "cancelAll" }
order yes { "hip3Star": "order" }
sendAsset yes { "hip3Star": "sendAsset" }
setOracle yes { "hip3Star": "setOracle" }

各付与はそれ自体のオペレーションのみをカバーします。例えば、modifyApproval の付与は modifyBackstopLiquidatorApproval、setReduceOnly、sendAsset を許可しません。同様に、oracleUpdater に与えられるものを含む通常の "setOracle" 付与は、setOracle star オペレーションを許可しません。

ユーザー star ステート

userStarState info リクエストは、ユーザーが承認されたすべての HIP-3* ベニューにおけるユーザーの承認状態を返します。その後ユーザーの承認を削除したベニューでは、状態は null です。

{ "type": "userStarState", "user": "0xUSER_A" }
{
  "dexToState": {
    "test": {
      "isReduceOnly": false,
      "isBackstopLiquidatorDepositAllowed": true
    },
    "demo": null
  }
}
非公式のコミュニティ翻訳です。著作権は Hyperliquid に帰属し、内容は英語版を優先します。 出典: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/hip-3-deployer-actions-1