Hyperliquid 백서

Hyperliquid

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 27쪽 중 5쪽

eturn; } const endMarketCap = totalSupply * endPx; if (endMarketCap > MAX_MARKET_CAP_BILLIONS_END * 1e9) { displayAlert( `Market cap must be &#x3C;${MAX_MARKET_CAP_BILLIONS_END}B USDC at Hyperliquidity end price`, "error" ); return; } if (endMarketCap &#x3C; MIN_MARKET_CAP_BILLIONS_END * 1e9) { displayAlert( `Market cap must be >${MIN_MARKET_CAP_BILLIONS_END}B USDC at Hyperliquidity end price`, "error" ); return; } if (totalSupply * startPx > MAX_MARKET_CAP_MILLIONS_START * 1e6) { displayAlert( `Market cap must be &#x3C;${MAX_MARKET_CAP_MILLIONS_START}M USDC at Hyperliquidity start price`, "error" ); return; } if (orderCount &#x3C; 10) { displayAlert("Hyperliquidity must have at least 10 orders", "error"); return; } if ((orderSz * orderCount) / totalSupply &#x3C;= 0.01) { displayAlert("Hyperliquidity must be >1% of total supply", "error"); return; } if (usdcNeeded > webData.clearinghouseState.withdrawable) { displayAlert( "Insufficient perps USDC to deploy seeded levels", "error" ); return; } </code></pre> # Trading # Fees Fees are based on your rolling 14 day volume and are assessed at the end of each day in UTC. Sub-account volume counts toward the master account and all sub-accounts share the same fee tier. Vault volume is treated separately from the master account. Referral rewards apply for a user's first $1B in volume and referral discounts apply for a user's first $25M in volume. Maker rebates are paid out continuously on each trade directly to the trading wallet.&#x20; There are separate fee schedules for perps vs spot. Perps and spot volume will be counted together to determine your fee tier, and spot volume will count double toward your fee tier. i.e., `(14d weighted volume) = (14d perps volume) + 2 * (14d spot volume)`. For each user, there is one fee tier across all assets, including perps, HIP-3 perps, and spot. When growth mode is activated for an HIP-3 perp, protocol fees, rebates, volume contributions, and L1 user rate limit contributions are reduced by 90%. HIP-3 deployers can configure an additional fee share between 0-300% (0-100% for growth mode). If the share is above 100%, the protocol fee is also increased to be equal to the deployer fee. Spot pairs between two spot quote assets have 80% lower taker fees, maker rebates, and user volume contribution. [Aligned quote assets](/hyperliquid-docs/hypercore/aligned-quote-assets) benefit from 20% lower taker fees, 50% better maker rebates, and 20% more volume contribution toward fee tiers. ### Perps fee tiers | | | Base rate | | Diamond | | Platinum | | Gold | | Silver | | Bronze | | Wood | | | ---- | ----------------------- | --------- | ------ | ------- | ------- | -------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | | Tier | 14d weighted volume ($) | Taker | Maker | Taker | Maker | Taker | Maker | Taker | Maker | Taker | Maker | Taker | Maker | Taker | Maker | | 0 | | 0.045% | 0.015% | 0.0270% | 0.0090% | 0.0315% | 0.0105% | 0.0360% | 0.0120% | 0.0383% | 0.0128% | 0.0405% | 0.0135% | 0.0428% | 0.0143% | | 1 | >5M | 0.040% | 0.012% | 0.0240% | 0.0072% | 0.0280% | 0.0084% | 0.0320% | 0.0096% | 0.0340% | 0.0102% | 0.0360% | 0.0108% | 0.0380% | 0.0114% | | 2 | >25M | 0.035% | 0.008% | 0.0210% | 0.0048% | 0.0245% | 0.0056% | 0.0280% | 0.0064% | 0.0298% | 0.0068% | 0.0315% | 0.0072% | 0.0333% | 0.0076% | | 3 | >100M | 0.030% | 0.004% | 0.0180% | 0.0024% | 0.0210% | 0.0028% | 0.0240% | 0.0032% | 0.0255% | 0.0034% | 0.0270% | 0.0036% | 0.0285% | 0.0038% | | 4 | >500M | 0.028% | 0.000% | 0.0168% | 0.0000% | 0.0196% | 0.0000% | 0.0224% | 0.0000% | 0.0238% | 0.0000% | 0.0252% | 0.0000% | 0.0266% | 0.0000% | | 5 | >2B | 0.026% | 0.000% | 0.0156% | 0.0000% | 0.0182% | 0.0000% | 0.0208% | 0.0000% | 0.0221% | 0.0000% | 0.0234% | 0.0000% | 0.0247% | 0.0000% | | 6 | >7B | 0.024% | 0.000% | 0.0144% | 0.0000% | 0.0168% | 0.0000% | 0.0192% | 0.0000% | 0.0204% | 0.0000% | 0.0216% | 0.0000% | 0.0228% | 0.0000% | ### Spot fee tiers | Spot | | Base rate | | Diamond | | Platinum | | Gold | | Silver | | Bronze | | Wood | | | ---- | ----------------------- | --------- | ------ | ------- | ------- | -------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | | Tier | 14d weighted volume ($) | Taker | Maker | Taker | Maker | Taker | Maker | Taker | Maker | Taker | Maker | Taker | Maker | Taker | Maker | | 0 | | 0.070% | 0.040% | 0.0420% | 0.0240% | 0.0490% | 0.0280% | 0.0560% | 0.0320% | 0.0595% | 0.0340% | 0.0630% | 0.0360% | 0.0665% | 0.0380% | | 1 | >5M | 0.060% | 0.030% | 0.0360% | 0.0180% | 0.0420% | 0.0210% | 0.0480% | 0.0240% | 0.0510% | 0.0255% | 0.0540% | 0.0270% | 0.0570% | 0.0285% | | 2 | >25M | 0.050% | 0.020% | 0.0300% | 0.0120% | 0.0350% | 0.0140% | 0.0400% | 0.0160% | 0.0425% | 0.0170% | 0.0450% | 0.0180% | 0.0475% | 0.0190% | | 3 | >100M | 0.040% | 0.010% | 0.0240% | 0.0060% | 0.0280% | 0.0070% | 0.0320% | 0.0080% | 0.0340% | 0.0085% | 0.0360% | 0.0090% | 0.0380% | 0.0095% | | 4 | >500M | 0.035% | 0.000% | 0.0210% | 0.0000% | 0.0245% | 0.0000% | 0.0280% | 0.0000% | 0.0298% | 0.0000% | 0.0315% | 0.0000% | 0.0333% | 0.0000% | | 5 | >2B | 0.030% | 0.000% | 0.0180% | 0.0000% | 0.0210% | 0.0000% | 0.0240% | 0.0000% | 0.0255% | 0.0000% | 0.0270% | 0.0000% | 0.0285% | 0.0000% | | 6 | >7B | 0.025% | 0.000% | 0.0150% | 0.0000% | 0.0175% | 0.0000% | 0.0200% | 0.0000% | 0.0213% | 0.0000% | 0.0225% | 0.0000% | 0.0238% | 0.0000% | ### Staking tiers | Tier | HYPE staked | Trading fee discount | | -------- | ----------- | -------------------- | | Wood | >10 | 5% | | Bronze | >100 | 10% | | Silver | >1,000 | 15% | | Gold | >10,000 | 20% | | Platinum | >100,000 | 30% | | Diamond | >500,000 | 40% | ### Maker rebates | Tier | 14d weighted maker volume | Maker fee | | ---- | ------------------------- | --------- | | 1 | >0.5% | -0.001% | | 2 | >1.5% | -0.002% | | 3 | >3.0% | -0.003% | On most other protocols, the team or insiders are the main beneficiaries of fees. On Hyperliquid, fees are entirely directed to the community (HLP, the assistance fund, and deployers). Spot and HIP-3 perp deployers may choose to keep up to 50% of trading fees generated by their deployed assets. The assistance fund uses the system address `0xfefefefefefefefefefefefefefefefefefefefe`. It converts trading fees to HYPE in a fully automated manner as part of the L1 execution. HYPE in the assistance fund is burned, removing the tokens permanently from the circulating and total supply. ### Growth mode for HIP-3 perps When a deployer activates growth mode, there is a ≥90% reduction on the all-in fees. Rebates and volume contributions will also be ≥90% lower. Growth mode applies on top of other multipliers, such as staking discounts. The following two conditions apply for growth mode: 1. The deployer fee scale must be set between 0 and 10. As a reminder, deployer fee scale is the amount the deployer keeps as a percentage of the user’s fees before applying aligned stablecoin collateral discount, if applicable. For more information, see: [HIP-3 deployer actions](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/hip-3-deployer-actions). Setting growth mode has a 30 day cooldown per asset. 2. The markets must be entirely disjoint from existing validator-operated perps to prevent parasitic volume. For example, the below are not eligible for growth mode. This list of examples is illustrative and not comprehensive. Similar to delistings, the ultimate decider for disabling ineligible growth mode perps is onchain validator vote. 1. Crypto perps against any collateral&#x20; 2. Perps on crypto indexes, ETFs, or other baskets of crypto assets&#x20; 3. Perps on mathematical combinations including crypto assets, such as a linear combination of BTC and another asset’s price 4. Perps on vehicles or wrappers that hold primarily crypto assets&#x20; 5. Perps tracking gold price, because PAXG-USDC already tracks gold price&#x20; In summary, the baseline all-in taker rate under growth mode will be between 0.0045%-0.009% (5-10x lower than the 0.045% baseline fee for validator-operated perps). ### Staking linking A "staking user" and a "trading user" can be linked so that the staking user's HYPE staked can be attributed to the trading user's fees. A few important points to note: * The staking user and the trading user must be controlled by the same user. For security purposes, the staking user will be able to unilaterally transfer all funds from the trading user to the staking user's account in a single irreversible transaction. A trading user should therefore never link to a staking user that is controlled by another user. * A staking user may send EIP-712 signed action with primary type `HyperliquidTransaction:StakingLinkDisableTradingUser` and payload `{tradingUser: String, nonce: Number}` that renders the trading user unusable and funds locked. In 1 year after locking, the funds from the trading user are automatically transferred to the staking user. This action is irreversible and not recommended under normal operation. * Linking is permanent. Unlinking is not supported. * The staking user will not receive any staking-related fee discount after being linked. * Linking requires the trading user to send an action first, and then the staking user to finalize the link. See "Link Staking" at app.hyperliquid.xyz/portfolio for details.&#x20; * No action is required if you plan to trade and stake from the same address.&#x20; ### Outcome tokens Outcome trading only charges fees when closing or settling, not when opening outcome positions. Only fee-paying volume is counted for outcome trading. There are 6 cases for outcome trades which are special cases of this logic: 1\. Minting, no one pays fee: no volume is counted 2a. Normal Trade where one side pays fee: both users get `fee_paying_px * sz` 2b. Normal Trade where no one pays fee: no volume is counted 3a. Burning, both sides pay fee: both users get `(maker_px + taker_px) * sz = 1 * sz` 3b. Burning, only taker pays fee: both users get `taker_px * sz` 4\. Settlement: each user gets `settle_fraction * sz` Outcome trading does not support rebates. Users who would receive rebates for spot and perp trading pay zero fees on maker orders. ### Fee formula for developers ```typescript type Args = | { type: "spot"; isStablePair: boolean; } | { type: "perp"; deployerFeeScale: number; growthMode: boolean; }; function feeRates( fees: { makerRate: number; takerRate: number }, // fees from userFees info endpoint activeReferralDiscount: number, // number from userFees info endpoint isAlignedQuoteToken: boolean, args: Args, ) { const scaleIfStablePair = args.type === "spot" && args.isStablePair ? 0.2 : 1; let scaleIfHip3 = 1; let growthModeScale = 1; let deployerShare = 0; if (args.type === "perp") { scaleIfHip3 = args.deployerFeeScale < 1 ? args.deployerFeeScale + 1 : args.deployerFeeScale * 2; deployerShare = args.deployerFeeScale < 1 ? args.deployerFeeScale / (1 + args.deployerFeeScale) : 0.5; growthModeScale = args.growthMode ? 0.1 : 1; } let makerPercentage = fees.makerRate * 100 * scaleIfStablePair * growthModeScale; if (makerPercentage > 0) { makerPercentage *= scaleIfHip3 * (1 - activeReferralDiscount); } else { const makerRebateScaleIfAlignedQuoteToken = isAlignedQuoteToken ? (1 - deployerShare) * 1.5 + deployerShare : 1; makerPercentage *= makerRebateScaleIfAlignedQuoteToken; } let takerPercentage = fees.takerRate * 100 * scaleIfStablePair * scaleIfHip3 * growthModeScale * (1 - activeReferralDiscount); if (isAlignedQuoteToken) { const takerScaleIfAlignedQuoteToken = isAlignedQuoteToken ? (1 - deployerShare) * 0.8 + deployerShare : 1; takerPercentage *= takerScaleIfAlignedQuoteToken; } return { makerPercentage, takerPercentage }; } ``` # Sub-accounts Up to 10 sub-accounts can be created after reaching $100,000 in volume. Every additional $100M in volume enables the ability to create 1 additional sub-account, up to a maximum of 50 sub-accounts.&#x20; Sub-accounts share the same fee tiers as the master account, but referral discounts do not apply to sub-accounts.&#x20; The number of API wallets available starts at 3 for all master accounts and increases by 2 per sub-account. Refer to the [API Docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#subaccounts-and-vaults) for trading via sub-account.&#x20; # Builder codes *Note: The term "builder" in the context of builder codes does not refer to block builders within consensus, but rather "defi builders" who build applications on Hyperliquid.* **Builder codes** allow builders to receive a fee on fills that they send on behalf of a user. They are set per-order for maximal flexibility. The user must approve a maximum builder fee for each builder, and can revoke permissions at any time. Builder codes are processed entirely onchain as part of the fee logic. In order to use builder codes, the end user would first approve a max fee for the builder address via the `ApproveBuilderFee` action. This action must be signed by the user's main wallet, not an agent/API wallet. The builder must have at least 100 USDC in perps account value and must use standard as the account abstraction mode. Builder codes currently only apply to fees that are collected in the quote or collateral asset. In other words, builder codes do not apply to the buying side of spot trades but apply to both sides of perp trades. Builder fees charged can be at most 0.1% on perps and 1% on spot. Once the authorization is complete, future order actions sent on behalf of the user may include an optional builder parameter: `{"b": address, "f": number}`. `b` is the address of the builder and `f` is the builder fee to charge in tenths of basis points. I.e. a value of 10 means 1 basis point.&#x20; Builders can claim fees from builder codes through the usual referral reward claim process. Each user can have a maximum of 10 active builder code approvals at a time. For example code see the Python SDK <https://github.com/hyperliquid-dex/hyperliquid-python-sdk/blob/master/examples/basic_builder_fee.py> ### API for builders The approved maximum builder fee for a user can be queried via an info request `{"type": "maxBuilderFee", "user": "0x...", "builder": "0x..."}.` The total builder fees collected for a builder is part of the referral state response from info request `{"type": "referral", "user": "0x..."}`. The trades that use a particular builder code are uploaded in compressed LZ4 format to `https://stats-data.hyperliquid.xyz/Mainnet/builder_fills/{builder_address}/{YYYYMMDD}.csv.lz4`e.g. `https://stats-data.hyperliquid.xyz/Mainnet/builder_fills/0x123.../20241031.csv.lz4`&#x20; Important: Note that these URLs are case sensitive, and require that `builder_address`be entirely lowercase.&#x20; # Perpetual assets Hyperliquid currently supports trading of 100+ assets. Assets are added according to community input. Ultimately Hyperliquid will feature a decentralized and permissionless listing process.&#x20; Max leverage varies by asset, ranging from 3x to 40x. Maintenance margin is half of the initial margin at max leverage. E.g., if max leverage is 20x, the maintenance margin is 2.5%. # Contract specifications ### Crypto Perps Hyperliquid perpetuals are derivatives products without expiration date. Instead, they rely on funding payments to ensure convergence to the underlying spot price over time. See [Funding](/hyperliquid-docs/trading/funding) for more information.&#x20; Hyperliquid has one main style of margining for perpetual contracts: USDC margining, USDT denominated linear contracts. That is, the oracle price is denominated in USDT, but the collateral is USDC. This allows for the best combination of liquidity and accessibility. Note that no conversions with the USDC/USDT exchange rate are applied, so these contracts are technically quanto contracts where USDT pnl is denominated in USDC. When the spot asset's primary source of liquidity is USDC denominated, the oracle price is denominated in USDC. Currently, the only USDC-denominated perpetual contracts are PURR-USD and HYPE-USD, where the most liquid spot oracle source is Hyperliquid spot. Hyperliquid's contract specifications are simpler than most platforms. There are few contract-specific details and no address-specific restrictions. | | | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | Instrument type | Linear perpetual | | Contract | 1 unit of underlying spot asset | | Underlying asset / ticker | Hyperliquid oracle index of underlying spot asset | | Initial margin fraction | 1 / (leverage set by user) | | Maintenance margin fraction | Half of maximum initial margin fraction | | Mark price | See [here](/hyperliquid-docs/trading/robust-price-indices) | | Delivery / expiration | N/A (funding payments every hour) | | Position limit | N/A | | Account type | Per-wallet cross or isolated margin | | Funding impact notional | <p>20000 USDC for BTC and ETH</p><p>6000 USDC for all other assets </p> | | Maximum market order value | $30,000,000 for max leverage >= 25, $5,000,000 for max leverage in \[20, 25), $2,000,000 for max leverage in \[10, 20), otherwise $500,000 | | Maximum limit order value | 10 \* maximum market order value | ### Recurring outcomes Recurring outcomes are automatically deployed and settled by the protocol on a fixed cadence. The specification for the current instance of the recurring outcome is found in the `description` field of `outcomeMeta` . #### Binary&#x20; ``` class:priceBinary|underlying:BTC|expiry:20260503-0600|targetPrice:78213|period:1d" ``` The target price is computed using a linear interpolation between the mark price updates immediately before and immediately after the settlement timestamp. Precisely, the contract settles to YES if and only if `markPrice0 + (settlementTime - t0) / (t1 - t0) * (markPrice1 - markPrice0) ≥ targetPrice` where `t0` and `t1` are the timestamps of mark price updates immediately before and after `settlementTime` #### Multi-price&#x20; ``` "class:priceBucket|underlying:BTC|expiry:20260507-0745|priceThresholds:81538,81783|period:15m" ``` There are three price buckets depending on the target price at the time of settlement: `< P1`, `[P1, P2)` and `≥ P2.` Exactly one of the 3 outcomes settles to 1, and the others settle to 0. The target price computation uses the same interpolation as binary markets described above. ### Uniqueness There is guaranteed to be at most one recurring series for each `(seriesType, underlying, period)` combination. # Margining Margin computations follow similar formulas to major centralized derivatives exchanges. ### Margin Mode When opening a position, a margin mode is selected. *Cross margin* is the default, which allows for maximal capital efficiency by sharing collateral between all other cross margin positions. *Isolated margin* is also supported, which allows an asset's collateral to be constrained to that asset. Liquidations in that asset do not affect other isolated positions or cross positions. Similarly, cross liquidations or other isolated liquidations do not affect the original isolated position.&#x20; Some assets are *strict isolated*, which functions the same as isolated margin with the additional constraint that margin cannot be removed. Margin is proportionally removed as the position is closed.&#x20; ### HIP-3 Margin Modes When users have perp positions across multiple DEXs, cross margin behaves different depending on the user's account abstraction. For unified account and portfolio margin, the user's cross margin positions in DEXs with the same collateral all share margin. For standard abstraction, cros
프로젝트로 돌아가기