View Source Hyperliquid.Api.Exchange.PerpDeploy (hyperliquid v0.4.1)
Deploy and manage HIP-3 perpetual contracts.
Sub-action functions:
| Function | SDK key | Purpose |
|---|---|---|
register_asset2/2 | registerAsset2 | Register a new perp (v2, margin-mode aware) |
register_asset/2 | registerAsset | Register a new perp (v1, isolated flag) |
set_oracle/2 | setOracle | Update oracle / mark prices for a DEX |
set_funding_multipliers/2 | setFundingMultipliers | Set per-asset funding multipliers |
halt_trading/3 | haltTrading | Halt or resume trading for an asset |
set_margin_table_ids/2 | setMarginTableIds | Update margin table IDs per asset |
set_fee_recipient/3 | setFeeRecipient | Set fee recipient address for a DEX |
set_open_interest_caps/2 | setOpenInterestCaps | Set OI cap notionals per asset |
set_sub_deployers/3 | setSubDeployers | Modify sub-deployer permissions |
set_margin_modes/2 | setMarginModes | Set margin mode per asset |
set_fee_scale/3 | setFeeScale | Set fee scale (0.0–3.0) for a DEX |
set_growth_modes/2 | setGrowthModes | Enable/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
Halt or resume trading for an asset.
Parameters
coin: Asset coin symbol stringis_halted:trueto halt,falseto resumeopts: Optional keyword list (:private_key)
Register a new perpetual asset (v2) with margin mode.
Parameters
params: Map with::max_gas— Max gas in native token wei, ornilto use auction price:asset_request— Map with:coin,:sz_decimals,:oracle_px,:margin_table_id,`:margin_mode` (`"strictIsolated"` or `"noCross"`):dex— DEX name string:schema—nilor map with:full_name,:collateral_token,:oracle_updater
opts: Optional keyword list (:private_key)
Register a new perpetual asset (v1) with isolated margin flag.
Parameters
params: Map with::max_gas— Max gas in native token wei, ornil:asset_request— Map with:coin,:sz_decimals,:oracle_px,`:margin_table_id`, `:only_isolated` (bool):dex— DEX name string:schema—nilor map with:full_name,:collateral_token,:oracle_updater
opts: Optional keyword list (:private_key)
Set the fee recipient address for a DEX.
Parameters
dex: DEX name stringfee_recipient: Ethereum address string ("0x...")opts: Optional keyword list (:private_key)
Set the fee scale for a DEX (range 0.0–3.0).
Parameters
dex: DEX name stringscale: Fee scale as a decimal string, e.g."1.5"opts: Optional keyword list (:private_key)
Set funding multipliers for assets.
Parameters
multipliers: List of{coin, multiplier_string}tuples, sorted by coinopts: Optional keyword list (:private_key)
Enable or disable growth mode for assets.
Parameters
modes: List of{coin, enabled_bool}tuples, sorted by coinopts: Optional keyword list (:private_key)
Set margin modes for assets.
Parameters
modes: List of{coin, mode_string}tuples; mode is"strictIsolated"or"noCross"opts: Optional keyword list (:private_key)
Update margin table IDs for assets.
Parameters
table_ids: List of{coin, table_id_integer}tuples, sorted by coinopts: Optional keyword list (:private_key)
Set open interest cap notionals for assets.
Parameters
caps: List of{coin, cap_integer}tuples, sorted by coinopts: Optional keyword list (:private_key)
Set oracle and mark prices for a DEX.
Parameters
dex: DEX name stringparams: 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)
Modify sub-deployer permissions for a DEX.
Parameters
dex: DEX name stringsub_deployers: List of maps with:variant,:user(address),:allowed(bool)opts: Optional keyword list (:private_key)