View Source Hyperliquid.Api.Exchange.PerpDeploy (hyperliquid v0.4.1)

Deploy and manage HIP-3 perpetual contracts.

Sub-action functions:

FunctionSDK keyPurpose
register_asset2/2registerAsset2Register a new perp (v2, margin-mode aware)
register_asset/2registerAssetRegister a new perp (v1, isolated flag)
set_oracle/2setOracleUpdate oracle / mark prices for a DEX
set_funding_multipliers/2setFundingMultipliersSet per-asset funding multipliers
halt_trading/3haltTradingHalt or resume trading for an asset
set_margin_table_ids/2setMarginTableIdsUpdate margin table IDs per asset
set_fee_recipient/3setFeeRecipientSet fee recipient address for a DEX
set_open_interest_caps/2setOpenInterestCapsSet OI cap notionals per asset
set_sub_deployers/3setSubDeployersModify sub-deployer permissions
set_margin_modes/2setMarginModesSet margin mode per asset
set_fee_scale/3setFeeScaleSet fee scale (0.0–3.0) for a DEX
set_growth_modes/2setGrowthModesEnable/disable growth mode per asset

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/hip-3-deployer-actions

Usage

# Register a new perp (v2)
{:ok, _} = PerpDeploy.register_asset2(%{
  max_gas: nil,
  asset_request: %{
    coin: "MYTOKEN",
    sz_decimals: 2,
    oracle_px: "1.5",
    margin_table_id: 1,
    margin_mode: "strictIsolated"
  },
  dex: "my_dex",
  schema: nil
})

# Halt trading for an asset
{:ok, _} = PerpDeploy.halt_trading("MYTOKEN", true)

# Set fee scale
{:ok, _} = PerpDeploy.set_fee_scale("my_dex", "1.5")

Summary

Functions

Halt or resume trading for an asset.

Register a new perpetual asset (v2) with margin mode.

Register a new perpetual asset (v1) with isolated margin flag.

Set the fee recipient address for a DEX.

Set the fee scale for a DEX (range 0.0–3.0).

Set funding multipliers for assets.

Enable or disable growth mode for assets.

Set margin modes for assets.

Update margin table IDs for assets.

Set open interest cap notionals for assets.

Set oracle and mark prices for a DEX.

Modify sub-deployer permissions for a DEX.

Functions

Link to this function

halt_trading(coin, is_halted, opts \\ [])

View Source

Halt or resume trading for an asset.

Parameters

  • coin: Asset coin symbol string
  • is_halted: true to halt, false to resume
  • opts: Optional keyword list (:private_key)
Link to this function

register_asset2(params, opts \\ [])

View Source

Register a new perpetual asset (v2) with margin mode.

Parameters

  • params: Map with:
    • :max_gas — Max gas in native token wei, or nil to use auction price
    • :asset_request — Map with :coin, :sz_decimals, :oracle_px, :margin_table_id,
                     `:margin_mode` (`"strictIsolated"` or `"noCross"`)
    • :dex — DEX name string
    • :schemanil or map with :full_name, :collateral_token, :oracle_updater
  • opts: Optional keyword list (:private_key)
Link to this function

register_asset(params, opts \\ [])

View Source

Register a new perpetual asset (v1) with isolated margin flag.

Parameters

  • params: Map with:
    • :max_gas — Max gas in native token wei, or nil
    • :asset_request — Map with :coin, :sz_decimals, :oracle_px,
                     `:margin_table_id`, `:only_isolated` (bool)
    • :dex — DEX name string
    • :schemanil or map with :full_name, :collateral_token, :oracle_updater
  • opts: Optional keyword list (:private_key)
Link to this function

set_fee_recipient(dex, fee_recipient, opts \\ [])

View Source

Set the fee recipient address for a DEX.

Parameters

  • dex: DEX name string
  • fee_recipient: Ethereum address string ("0x...")
  • opts: Optional keyword list (:private_key)
Link to this function

set_fee_scale(dex, scale, opts \\ [])

View Source

Set the fee scale for a DEX (range 0.0–3.0).

Parameters

  • dex: DEX name string
  • scale: Fee scale as a decimal string, e.g. "1.5"
  • opts: Optional keyword list (:private_key)
Link to this function

set_funding_multipliers(multipliers, opts \\ [])

View Source

Set funding multipliers for assets.

Parameters

  • multipliers: List of {coin, multiplier_string} tuples, sorted by coin
  • opts: Optional keyword list (:private_key)
Link to this function

set_growth_modes(modes, opts \\ [])

View Source

Enable or disable growth mode for assets.

Parameters

  • modes: List of {coin, enabled_bool} tuples, sorted by coin
  • opts: Optional keyword list (:private_key)
Link to this function

set_margin_modes(modes, opts \\ [])

View Source

Set margin modes for assets.

Parameters

  • modes: List of {coin, mode_string} tuples; mode is "strictIsolated" or "noCross"
  • opts: Optional keyword list (:private_key)
Link to this function

set_margin_table_ids(table_ids, opts \\ [])

View Source

Update margin table IDs for assets.

Parameters

  • table_ids: List of {coin, table_id_integer} tuples, sorted by coin
  • opts: Optional keyword list (:private_key)
Link to this function

set_open_interest_caps(caps, opts \\ [])

View Source

Set open interest cap notionals for assets.

Parameters

  • caps: List of {coin, cap_integer} tuples, sorted by coin
  • opts: Optional keyword list (:private_key)
Link to this function

set_oracle(dex, params, opts \\ [])

View Source

Set oracle and mark prices for a DEX.

Parameters

  • dex: DEX name string
  • params: Map with:
    • :oracle_pxs[{coin, price}] sorted by coin
    • :mark_pxs[[{coin, price}]] list of lists sorted by coin
    • :external_perp_pxs[{coin, price}] sorted by coin
  • opts: Optional keyword list (:private_key)
Link to this function

set_sub_deployers(dex, sub_deployers, opts \\ [])

View Source

Modify sub-deployer permissions for a DEX.

Parameters

  • dex: DEX name string
  • sub_deployers: List of maps with :variant, :user (address), :allowed (bool)
  • opts: Optional keyword list (:private_key)