Docs

Vault managers

Create a vault

Deploy a HyperVault and HyperPerpEngine pair through HyperVaultFactory, then fund it, set a keeper and run the first roll.

Markdown
On this page

This guide deploys a third-party vault on HyperEVM (chain 999) with one call to HyperVaultFactory.deployStrategyVault, then takes it to its first trade.

You need:

  • a wallet that passes canCreateVault (see step 1), with HYPE for gas and at least 20 USDC on HyperEVM (10 USDC creation fee, 10 USDC first deposit);
  • a keeper address for your trading bot (it can hold only gas);
  • viem 2.x or Foundry's cast.

Shared setup for the viem snippets:

client.ts
import { createPublicClient, createWalletClient, defineChain, http, type Address } from "viem";
import { privateKeyToAccount } from "viem/accounts";

// Placeholders: addresses publish at launch.
export const CONFIG = process.env.CONFIG as Address;   // HyperVaultConfig
export const FACTORY = process.env.FACTORY as Address; // HyperVaultFactory
export const USDC = process.env.USDC as Address;       // USDC on HyperEVM
export const VAULT = process.env.VAULT as Address;     // your vault, after step 6
export const ENGINE = process.env.ENGINE as Address;   // your engine, after step 6
export const KEEPER = process.env.KEEPER as Address;

export const hyperEvm = defineChain({
  id: 999,
  name: "HyperEVM",
  nativeCurrency: { name: "HYPE", symbol: "HYPE", decimals: 18 },
  rpcUrls: { default: { http: ["https://rpc.hyperliquid.xyz/evm"] } },
});

export const account = privateKeyToAccount(process.env.MANAGER_KEY as `0x${string}`);
export const publicClient = createPublicClient({ chain: hyperEvm, transport: http() });
export const wallet = createWalletClient({ account, chain: hyperEvm, transport: http() });

Check that you can create a vault#

HyperVaultConfig.creationMode starts at OFF, where only the council deploys, and only flagships. In WHITELISTED mode your address must be on the council's creator whitelist. In PERMISSIONLESS mode anyone can deploy. Ask the config directly:

import { parseAbi } from "viem";
import { CONFIG, account, publicClient } from "./client";

export const configAbi = parseAbi([
  "struct TierBounds { uint24 maxGrossBps; uint16 maxNetExposureBps; uint16 maxDailyLossBps; uint16 maxDrawdownBps; uint32 assetWeightMultiplierBps; }",
  "function canCreateVault(address creator, bool isFlagship) view returns (bool)",
  "function creationMode() view returns (uint8)",
  "function creationFeeUsdc() view returns (uint256)",
  "function maxCapForManager(address manager) view returns (uint256)",
  "function tierBounds(uint8 tier) view returns (TierBounds)",
  "function isAssetAllowedForVault(uint32 assetId, uint8 marketTier, uint8 vaultTier) view returns (bool allowed, uint16 maxWeightBps)",
]);

const allowed = await publicClient.readContract({
  address: CONFIG, abi: configAbi, functionName: "canCreateVault", args: [account.address, false],
});
const capCeiling = await publicClient.readContract({
  address: CONFIG, abi: configAbi, functionName: "maxCapForManager", args: [account.address],
});
console.log({ allowed, capCeiling }); // capCeiling defaults to 2,000,000 USDC (2_000_000e6)

If canCreateVault returns false, the deploy reverts with CreationNotAllowed(creator, isFlagship).

Choose the DNA#

DNA is permanent. The factory checks it against the global bounds and your tier's TierBounds (see the table on Vaults), then copies it into the engine with no setter.

FieldTypeRule
isFlagshipboolfalse for every third-party vault. Must equal vaultTier == FLAGSHIP.
marketTieruint81 (majors), 2 (top 50 + HIP-3) or 3 (long tail). You may trade every tier up to this one.
maxGrossBpsuint245,000–50,000 and at most the tier's maxGrossBps
maxNetExposureBpsuint16At most maxGrossBps, the tier cap (5,000 or 30,000) and the global cap (30,000)
maxDailyLossBpsuint1650–1,000, at most the tier cap
vaultTieruint81 INSTITUTIONAL or 2 COMMUNITY_ARENA
maxDrawdownBpsuint16200 up to the tier cap (2,500 institutional, 5,000 community arena)

Any rule broken reverts with InvalidPolicy().

Choose fees and the forecast job#

FieldTypeRule
mgmtFeeBpsuint160–200 per year, on external shares
perfFeeBpsuint161,000–2,500, above the per-share high-water mark
forecastShareBpsuint160–5,000, share of the net performance fee paid to the job's forecasters
forecastJobIduint64Required when the share is above 0. Job 1 (the flagship job) or a job bound to this vault.
managerFeeRecipientaddressRequired. Receives your share of both fees.

stepMarket trades the signal of forecastJobId, or job 1 when it is 0. A vault that pays a forecaster share usually follows that job's rounds. See Jobs and rounds. Out-of-bounds fees revert with InvalidPolicy(); a zero fee recipient reverts with ZeroAddress().

Choose the starting risk params#

EngineRiskParams are the engine's execution knobs. You can tighten them at once later and loosen them after 7 days.

FieldTypeDefault boundMeaning
minMarginRatioBpsuint161,000–10,000Equity over total notional. Below it, gross-increasing steps revert and anyone may flatten.
maxDailyTurnoverBpsuint325,000–100,000Traded notional per UTC day, in bps of day-start equity
maxStepBpsuint160–50,000Largest weight change per step. 0 means go straight to target.
maxSlippageBpsuint165–500Limit price distance from the oracle for IOC and GTC orders
makerOffsetBpsuint160–200Distance inside the oracle price for ALO orders
defaultTifuint81–31 ALO, 2 GTC, 3 IOC
maxIdleSecsuint321–14 daysAfter this long with no step or heartbeat, anyone may flatten

Out-of-bounds values revert with InvalidPolicy().

Approve the creation fee#

Third-party vaults pay creationFeeUsdc (10 USDC by default, at most 1,000 USDC) when the caller is not the council. The factory sends it straight to HyperRevenueRouter.notifyRevenue. Set maxCreationFeeUsdc in your params to the fee you read, so a fee change cannot surprise you.

import { erc20Abi } from "viem";
import { CONFIG, FACTORY, USDC, publicClient, wallet } from "./client";
import { configAbi } from "./check";

const fee = await publicClient.readContract({ address: CONFIG, abi: configAbi, functionName: "creationFeeUsdc" });
await wallet.writeContract({ address: USDC, abi: erc20Abi, functionName: "approve", args: [FACTORY, fee] });

If the live fee is above your maxCreationFeeUsdc, the deploy reverts with CreationFeeTooHigh(feeUsdc, maxFeeUsdc).

Deploy the vault#

This call deploys an engine proxy and a vault proxy, initializes both and registers them. The struct below matches DeployVaultParams in IHyperVaultPlatform.sol, field for field. VaultTier is a uint8 in the ABI.

import { parseAbi, parseEventLogs, parseUnits, zeroAddress } from "viem";
import { FACTORY, KEEPER, account, publicClient, wallet } from "./client";

const factoryAbi = parseAbi([
  "struct VaultDna { bool isFlagship; uint8 marketTier; uint24 maxGrossBps; uint16 maxNetExposureBps; uint16 maxDailyLossBps; uint8 vaultTier; uint16 maxDrawdownBps; }",
  "struct FeeConfig { uint16 mgmtFeeBps; uint16 perfFeeBps; uint16 forecastShareBps; uint64 forecastJobId; address managerFeeRecipient; }",
  "struct EngineRiskParams { uint16 minMarginRatioBps; uint32 maxDailyTurnoverBps; uint16 maxStepBps; uint16 maxSlippageBps; uint16 makerOffsetBps; uint8 defaultTif; uint32 maxIdleSecs; }",
  "struct DeployVaultParams { string name; string symbol; address strategyManager; address keeper; address complianceAdmin; VaultDna dna; FeeConfig fees; EngineRiskParams risk; uint256 vaultCapUsdc; bool lockerCapEnabled; bool whitelistEnabled; bool whitelistTransfers; uint256 maxCreationFeeUsdc; }",
  "function deployStrategyVault(DeployVaultParams params) returns (address vault, address engine)",
  "event VaultDeployed(address indexed vault, address indexed engine, address indexed creator, address strategyManager, address complianceAdmin, address vaultProxyAdmin, address engineProxyAdmin, uint256 creationFeeUsdc, DeployVaultParams params)",
  "error CreationNotAllowed(address creator, bool isFlagship)",
  "error VaultCapCeilingExceeded(uint256 requestedCap, uint256 maxAllowedCap)",
  "error CreationFeeTooHigh(uint256 feeUsdc, uint256 maxFeeUsdc)",
  "error InvalidPolicy()",
  "error Unauthorized()",
  "error ZeroAddress()",
  "error ZeroAmount()",
]);

const params = {
  name: "Trend50",
  symbol: "dhT50",
  strategyManager: zeroAddress, // zero = you
  keeper: KEEPER,
  complianceAdmin: zeroAddress, // zero with a whitelist = the manager
  dna: {
    isFlagship: false,
    marketTier: 2,           // majors plus top 50 and HIP-3
    maxGrossBps: 20_000,     // 2x gross
    maxNetExposureBps: 10_000, // 1x net
    maxDailyLossBps: 300,    // 3% daily loss stop
    vaultTier: 2,            // COMMUNITY_ARENA
    maxDrawdownBps: 2_000,   // 20% below the high-water mark latches
  },
  fees: {
    mgmtFeeBps: 100,         // 1% per year
    perfFeeBps: 2_000,       // 20% above HWM
    forecastShareBps: 1_000, // 10% of the net perf fee to job 1's forecasters
    forecastJobId: 1n,
    managerFeeRecipient: account.address,
  },
  risk: {
    minMarginRatioBps: 1_500,
    maxDailyTurnoverBps: 20_000,
    maxStepBps: 2_500,
    maxSlippageBps: 30,
    makerOffsetBps: 2,
    defaultTif: 1,           // ALO
    maxIdleSecs: 3 * 86_400,
  },
  vaultCapUsdc: parseUnits("250000", 6),
  lockerCapEnabled: false,
  whitelistEnabled: false,
  whitelistTransfers: false,
  maxCreationFeeUsdc: parseUnits("10", 6),
} as const;

const { request } = await publicClient.simulateContract({
  account, address: FACTORY, abi: factoryAbi, functionName: "deployStrategyVault", args: [params],
});
const hash = await wallet.writeContract(request);
const receipt = await publicClient.waitForTransactionReceipt({ hash });

const [deployed] = parseEventLogs({ abi: factoryAbi, eventName: "VaultDeployed", logs: receipt.logs });
console.log("vault", deployed.args.vault, "engine", deployed.args.engine);

What the factory does in that transaction:

  1. Pulls the creation fee and sends it to HyperRevenueRouter.
  2. Deploys the engine and vault pair behind a 72-hour upgrade delay.
  3. Writes a VaultRecord (vaultRecord(vault), isVault(vault), engineOf(vault)) and adds 1 to managerActiveVaultCount(manager).
  4. Initializes the vault (fees, cap, keeper, whitelist) and the engine (DNA, risk params, the Core deposit wallet). It re-validates the DNA and risk params.
  5. At token launch, registers the vault with HyperBookRewards. Before the token this step is skipped.
  6. Emits VaultDeployed.

Reverts you can hit:

  • CreationNotAllowed(creator, isFlagship): the creation mode does not allow you.
  • InvalidPolicy(): empty name or symbol, or DNA, fees or risk params out of bounds.
  • ZeroAmount(): vaultCapUsdc is 0.
  • Unauthorized(): you named someone else as strategyManager. Only the council may.
  • VaultCapCeilingExceeded(requestedCap, maxAllowedCap): the cap is above maxCapForManager(you).
  • CreationFeeTooHigh(feeUsdc, maxFeeUsdc): the live fee is above your limit.
  • ZeroAddress(): missing fee recipient, or the protocol's router or upgrade controller is not wired.

Set the keeper#

The keeper is the hot address your bot signs with. It can trade, bridge, deploy idle USDC to the engine and roll early. It cannot change fees, risk params or the manager. Change it any time; the change is instant.

import { parseAbi } from "viem";
import { VAULT, wallet } from "./client";

const NEW_KEEPER = "0x..." as const; // your bot's address
const vaultAbi = parseAbi(["function setKeeper(address keeper)"]);
await wallet.writeContract({ address: VAULT, abi: vaultAbi, functionName: "setKeeper", args: [NEW_KEEPER] });

Only the manager or the council can call it (Unauthorized() otherwise). A zero keeper is allowed; then only you and the council can trade.

Make the first deposit#

Seed the vault with your own capital. The minimum request is 10 USDC (DepositBelowMinimum(amount, minAmount) below that). The very first roll that mints shares sends 1 share (1e6 units, 1 USDC at the starting price) to 0x…dEaD, so a tiny first deposit cannot distort the share price.

import { erc20Abi, parseAbi, parseUnits } from "viem";
import { USDC, VAULT, account, wallet } from "./client";

const amount = parseUnits("1000", 6);
const depositAbi = parseAbi([
  "function requestDeposit(uint256 assets, address controller, address owner) returns (uint256)",
]);
await wallet.writeContract({ address: USDC, abi: erc20Abi, functionName: "approve", args: [VAULT, amount] });
await wallet.writeContract({
  address: VAULT, abi: depositAbi, functionName: "requestDeposit", args: [amount, account.address, account.address],
});

When the council enables skin in the game, outside deposits are capped by your own stake: the free starter cap (50,000 USDC by default) plus 20 times your co-investment. See Risk.

Run the first roll and fund the engine#

The vault's clock starts on the UTC day of deployment. The first roll is due from the next 00:00 UTC. Your keeper rolls between 00:00 and 02:00; after that, anyone can.

import { parseAbi, parseUnits } from "viem";
import { ENGINE, VAULT, account, wallet } from "./client";

const opsAbi = parseAbi([
  "function roll()",
  "function realize(address user)",
  "function deployToEngine(uint256 usdcAmount)",
  "function bridgeUsdcToCore(uint256 usdcAmount, uint32 destinationDex)",
]);

await wallet.writeContract({ address: VAULT, abi: opsAbi, functionName: "roll" });
await wallet.writeContract({ address: VAULT, abi: opsAbi, functionName: "realize", args: [account.address] });
await wallet.writeContract({ address: VAULT, abi: opsAbi, functionName: "deployToEngine", args: [parseUnits("900", 6)] });
await wallet.writeContract({ address: ENGINE, abi: opsAbi, functionName: "bridgeUsdcToCore", args: [parseUnits("900", 6), 0] });

roll() reverts with RollNotDue() if the vault already rolled today, and Unauthorized() if a non-role calls it before 02:00 UTC. bridgeUsdcToCore sends USDC to perp dex 0 (0) or to spot (4294967295, type(uint32).max). It opens a 30-second bridge window: deposits, rolls and steps revert with BridgeInFlight() until it closes. A second bridge within 2 minutes reverts with BridgeTooSoon(nextAllowedAt).

Before you step an asset, confirm it is open to your vault with isAssetAllowedForVault(assetId, marketTier, vaultTier) on the config. Every stepped market must also be listed in HyperSignalBook.

Where to go next#

These docs describe the architecture and smart contracts across Hyperliquid L1 (HyperEVM) (chain id 999) and Robinhood Chain (chain id 4663). Nothing here is investment advice or a promise of returns. DegenHive is not affiliated with, endorsed by, or sponsored by Hyperliquid, Robinhood Markets, Inc., Nasdaq, Inc., or their affiliates.