For the complete documentation index, see llms.txt. This page is also available as Markdown.

Integration Guide

Overview

Hypersurface is an on-chain options protocol for covered calls and cash-secured puts. You sell options to the protocol and receive premium. The trade lifecycle is:

1. Price    →  GET /optionsPrices (indicative pricing + Greeks)
2. Quote    →  POST /quote (protocol co-signs the order)
3. Approve  →  ERC-20 approve on TradeExecutor (one-time per token)
4. Trade    →  HedgedPool.trade() (on-chain, collateral pulled automatically)
5. Hold     →  Position locked until 08:00 UTC expiry
6. Settle   →  Controller.operate() (unlock collateral after expiry)
7. Withdraw →  HedgedPool.withdrawVaultCollateral() (get your tokens back)

You can also close early at any time by buying back the option (step 4 with positive amount).

Key Terms

Term
Description

HedgedPool

Entry point contract for trading

TradeExecutor

Handles collateral transfers (you approve this, never call it directly)

Controller

Gamma protocol vault operations (settlement, reads)

oToken

ERC-20 representing a specific option series

Vault

Gamma margin vault holding your collateral and short position

Premium

Payment received when selling an option (in USD₮0/USDC)

Covered Call

Sell upside on an asset you hold as collateral

Cash-Secured Put

Sell downside protection, backed by stablecoin collateral


Setup

Chain Configuration

HyperEVM

Property
Value

Chain ID

999

RPC URL

https://rpc.hyperliquid.xyz/evm

Block Explorer

https://explorer.hyperliquid.xyz

Native Currency

HYPE (18 decimals)

API Base URL

https://market-api-sh.hypersurface.io

Base

Property
Value

Chain ID

8453

RPC URL

https://mainnet.base.org

Block Explorer

https://basescan.org

Native Currency

ETH (18 decimals)

API Base URL

https://market-api-base.hypersurface.io

Contract Addresses

HyperEVM (Chain 999)

Contract
Address
Purpose

HedgedPool

0x0095aCDD705Cfcc11eAfFb6c19A28C0153ad196F

Entry point for trade(), buy-back premium approval target

TradeExecutor

0x25dD9EAae2e0b118a2CefdD229233654840BA7A0

Collateral approval target for sell trades

Controller

0x7730e6bfbfCE8Ff0b7a50b72D0601c209Eb818C4

Vault settlement via operate(), vault state reads

MarginPool

0x7D2e4b4d7ba55C423F5CCe194ae8194eFD1C6e35

Holds collateral and oTokens

Auction

0xf077393F8d2e6fB8151a53c5209686544a0E3749

Dutch IV-auction venue for takers

Base (Chain 8453)

Contract
Address
Purpose

HedgedPool

0x68893915f202e5DA2Ef01493463c50B2f68Df56d

Entry point for trade(), buy-back premium approval target

Controller

0x037F16e360db0053BAAcD78cDCfe735Af05f39bF

Vault settlement via operate(), vault state reads

Token Addresses

HyperEVM (Chain 999) -- Underlyings

Asset
Symbol
Address
Decimals

HYPE

wHYPE

0x5555555555555555555555555555555555555555

18

BTC

UBTC

0x9fdbda0a5e284c32744d2f17ee5c74b284993463

8

ETH

UETH

0xbe6727b535545c67d5caa73dea54865b92cf7907

18

SOL

USOL

0x068f321fa8fb9f0d135f290ef6a3e2813e1c8a29

9

XPL

UXPL

0x33af3c2540ba72054e044efe504867b39ae421f5

18

PUMP

UPUMP

0x27ec642013bcb3d80ca3706599d3cda04f6f4452

6

ENA

UENA

0x58538e6a46e07434d7e7375bc268d3cb839c0133

18

KNTQ

KNTQ

0x000000000000780555bd0bca3791f89f9542c2d6

18

kHYPE

kHYPE

0xfd739d4e423301ce9385c1fb8850539d657c296d

18

Premium token: USD₮0 at 0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb (6 decimals)

Base (Chain 8453) -- Underlyings

Asset
Symbol
Address
Decimals

ETH

WETH

0x4200000000000000000000000000000000000006

18

BTC

cbBTC

0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf

8

Premium token: USDC at 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (6 decimals)

Note: Strike increments are set on-chain and may change. To discover current active strikes and expiries, query the subgraph:

Or test strikes via the API — GET /optionsPrices?symbol=BTC-03APR26-65500-C will return pricing if that strike exists.


API Reference

No authentication required. Trades are authenticated by the EIP-712 signature embedded in the order itself.

Base URLs

Chain
Base URL

HyperEVM

https://market-api-sh.hypersurface.io

Base

https://market-api-base.hypersurface.io

Endpoints

Method
Path
Description

GET

/optionsPrices

Indicative pricing for an option symbol

POST

/quote

Co-signed order ready for on-chain submission

GET

/underlyingPrices

Spot prices for underlying assets

GET

/health

Vol surface and price feed health status

Use symbol (singular) as the query parameter, not symbols.

Symbol Format

Part
Description
Examples

UNDERLYING

Asset symbol

HYPE, ETH, BTC, SOL, XPL, PUMP, ENA, KNTQ, kHYPE

DDMMMYY

Expiry date (08:00 UTC)

Use an available expiry date

STRIKE

Strike price in USD

25, 3000, 100000

C|P

Call or Put

C, P

Build-your-own URL guide:

  1. Pick the base URL for your chain.

  2. Pick your asset, an available expiry date, an available strike (query the subgraph or test via the API), and C or P.

  3. Assemble: https://market-api-sh.hypersurface.io/optionsPrices?symbol=HYPE-28MAR26-25-C

Strikes are set on-chain. Query the subgraph or test via the API to confirm availability. HYPE-28MAR26-25.50-C is invalid if that strike does not exist.

Note: To discover available expiry dates, query the subgraph for active oTokens:

Or try dates programmatically — the API returns an error for invalid expiries.

GET /optionsPrices

Try it live

Response:

Field
Type
Description

ask

float

Ask price in USD (cost to buy back)

bid

float

Bid price in USD (premium you receive when selling)

premium

float

Mid/mark premium in USD

probability_otm

float

Probability of expiring out-of-the-money (0 to 1)

Add &greeks=true for delta, gamma, theta, vega, and implied volatility:

Try it live

POST /quote

POST /quote returns a co-signed order ready for on-chain execution.

Covered call request:

Request Fields:

Field
Type
Required
Description

sign

boolean

Yes

Must be true to receive a co-signed order

order.account

address

Yes

Your wallet address (EOA) or your contract address

order.poolAddress

address

Yes

HedgedPool address for the target chain

order.underlying

address

Yes

Underlying token contract address

order.collateral

address

Yes

Collateral token address (underlying for calls, stablecoin for puts)

order.referrer

address

Yes

Referral address, or 0x0000000000000000000000000000000000000000

order.legs[0].symbol

string

Yes

Option symbol in UNDERLYING-DDMMMYY-STRIKE-C/P format

order.legs[0].amount

integer

Yes

Quantity scaled by 1e8. Negative = sell to protocol, Positive = buy back

The legs array must contain exactly 1 element. Multi-leg trades are not supported.

Response:

Response Fields:

Field
Scale
Description

strike

1e8

Strike price. "2500000000" = $25.00

expiration

unix

Expiry timestamp (08:00 UTC)

isPut

boolean

true = put, false = call

amount

1e8

Signed quantity. "-100000000" = selling 1 option

premium

1e6

Signed premium. "-3100000" = you receive $3.10

fee

1e6

Protocol fee in premium token units

validUntil

unix

Quote expiry. Request a fresh quote immediately before your on-chain tx

nonce

uint256

Unique nonce for replay protection

signature

-

Protocol's EIP-712 co-signature

Put request -- set collateral to the stablecoin address:

GET /health

Try it live

If a model or price feed status is not "OK", pricing for that asset may be unavailable. Wait for recovery before trading.

GET /underlyingPrices

Try it live


EOA Trading Guide

Complete start-to-finish guide for wallet users. See the Full Python Example for a copy-paste-ready version with all ABIs inline.

1

Approval Targets

Action
Token to Approve
Approve To
HyperEVM Address

Sell covered call

Underlying (e.g. wHYPE)

TradeExecutor

0x25dD9EAae2e0b118a2CefdD229233654840BA7A0

Sell cash-secured put

Stablecoin (USD₮0)

TradeExecutor

0x25dD9EAae2e0b118a2CefdD229233654840BA7A0

Buy back (close position)

Premium token (USD₮0)

HedgedPool

0x0095aCDD705Cfcc11eAfFb6c19A28C0153ad196F

Collateral approvals go to TradeExecutor. Buy-back premium approvals go to HedgedPool. Approving the wrong contract will revert your transaction.

2

Get a Signed Quote

3

Approve Collateral

4

Execute Trade

trade() function signature:

trade() returns the address of the oToken that was traded. An eth_call simulation returns it directly; from a sent transaction, read it from the emitted events.

Parameter
Type
Description

order

Order

Complete signed order from /quote response

traderVaultId

uint256

Your vault ID. Use 0 on first trade

autoCreateVault

bool

true on first trade to auto-create a vault

5

Parse Vault ID from Receipt

6

Buy Back (Close Early)

Buy back your option using trade() with a positive amount. You pay the current premium to close, then withdraw your collateral.

Approve HedgedPool for premium payment:

Request a buy-back quote (positive amount):

Execute the buy-back:

Then withdraw your collateral.

7

Settlement After Expiry

Options expire at 08:00 UTC on their expiry date. After expiry, you must settle your vault before you can withdraw collateral.

Settlement uses Controller.operate() with the SettleVault action type (7).

8

Settlement Payout

Option Type
Condition
You Receive

Covered Call

OTM (spot < strike)

Your underlying collateral returned

Covered Call

ITM (spot > strike)

Strike price in stablecoin (you delivered the underlying)

Cash-Secured Put

OTM (spot > strike)

Your stablecoin collateral returned

Cash-Secured Put

ITM (spot < strike)

Underlying asset (you bought at the strike price)

9

Withdraw Collateral

After settlement or a buy-back, withdraw collateral from your vault.

10

Position Tracking

Get vault state:

All fields are arrays, but in practice each contains 0 or 1 element.

Vault ID discovery:

  • First trade: Use autoCreateVault=true and parse MarginVaultOpened event from the receipt.

  • After the fact: Call Controller.getAccountVaultCounter(yourAddress). Vault IDs are sequential starting from 1.

Vault status check:

Contract Integration Guide

Complete guide for smart contracts and vaults. See the Full Solidity Example for a compilable contract with all interfaces inlined.

How It Works

  1. Your backend calls POST /quote with account = your contract address (the API co-signs the order for that address).

  2. Your keeper/owner calls your contract, passing in the signed order.

  3. Your contract calls HedgedPool.trade(order, vaultId, autoCreateVault).

  4. The TradeExecutor pulls collateral from msg.sender (your contract), not from the original caller.

Your contract must hold the collateral tokens and have approved TradeExecutor before the trade call. The /quote API co-signs the order -- your contract does not need to produce its own signature.

Setup (One-Time)

  1. Your contract approves TradeExecutor to spend its collateral tokens.

  2. Your contract calls Controller.setOperator(hedgedPoolAddress, true) so the protocol can manage vaults on its behalf.

Trading from a Contract

Buy Back from a Contract

Your backend gets a buy-back quote (positive amount) from /quote, and your contract forwards it to HedgedPool.trade().

Your contract must have approved HedgedPool for the premium token (USD₮0 or USDC) before the buy-back call.

Settlement from a Contract

Your contract calls Controller.operate() directly.

Collateral Withdrawal from a Contract


Auctions

The guide above covers selling options to the protocol. Hypersurface also runs auctions, where the protocol sells option inventory back to the market and any address can buy it.

The format is a Dutch auction priced in implied volatility: the offered price descends over a short window. A take is a single transaction: you pay premium in USDT0 and receive the oTokens. Access is permissionless, with no whitelist or sign-up. See Auctions for the user-facing overview.

Integration paths

  • On-chain. The Auction contract on HyperEVM is permissionless. Any address can read the current price and submit a take directly. The address is listed under Contract Addresses.

  • API. The same API that powers the auctions page is available to programmatic takers. The full auction API specification is provided on request while it is being finalized, and will be added to this guide after initial production use.

A take can revert even on a live auction. The most common case is NoEligibleHolders, which fires when the option series has no short holders to receive the surplus. Programmatic takers should simulate or handle reverts rather than assume a take always succeeds.

To request the auction API specification, or to discuss pricing and settlement, contact the team through Community & Support.


Subgraph (Goldsky)

Public GraphQL endpoints, no authentication required.

Chain
Endpoint

HyperEVM

https://api.goldsky.com/api/public/project_clysuc3c7f21y01ub6hd66nmp/subgraphs/hypersurface-sh-subgraph/latest/gn

Base

https://api.goldsky.com/api/public/project_clysuc3c7f21y01ub6hd66nmp/subgraphs/hypersurface-base-subgraph/latest/gn

Sample trades query (HyperEVM):


Reference

Order Struct (Solidity)

These are the Solidity structs passed to HedgedPool.trade(). The /quote API returns these fields as JSON strings which you convert before submitting on-chain.

Collateral Requirements

The contract automatically calculates and pulls collateral from msg.sender during trade(). You do not pass a collateral amount.

Option Type
Collateral Token
Amount Required
Example

Covered Call

Underlying asset (e.g. wHYPE)

1:1 with option quantity

Sell 1 HYPE call = deposit 1 wHYPE (1e18 units)

Cash-Secured Put

Stablecoin (USD₮0 or USDC)

Strike price x quantity, minus premium

Sell 1 put at $25 strike = deposit up to 25 USD₮0 (25e6 units)

For puts, the premium is netted against the collateral requirement. If you sell a $25 put and receive $3.10 premium, the protocol pulls approximately $21.90 from your wallet as collateral (the exact amount depends on the margin calculator).

Decimal Conventions

Data Type
Scale
Example
Meaning

Strike (on-chain)

1e8

2500000000

$25.00

Premium (/quote)

1e6

"-3100000"

-$3.10 (you receive $3.10)

Premium (/optionsPrices)

float USD

3.10

$3.10

Amount (quantity)

1e8

-100000000

Sell 1 option

HYPE / ETH / ENA / XPL / KNTQ / kHYPE

1e18

1000000000000000000

1.0 token

BTC (UBTC / cbBTC)

1e8

100000000

1.0 BTC

SOL (USOL)

1e9

1000000000

1.0 SOL

PUMP (UPUMP)

1e6

1000000

1.0 PUMP

USD₮0 / USDC

1e6

1000000

$1.00

On-Chain Errors

Error
Description

SignatureInvalid()

Order signature verification failed

NonceAlreadyUsed(uint256)

Nonce has already been consumed (stale quote)

TooCloseToExpiration()

Trade rejected -- within 24h of expiry

InventoryCapExceeded(uint256, uint256)

Pool inventory cap reached. Args: (cap, inventoryBalance)

InvalidOrder()

Invalid amount/premium combination

InvalidUnderlying()

Underlying token not supported by the pool

InvalidPoolAddress()

Order's poolAddress does not match the contract

InvalidAccount()

order.account does not match msg.sender

Unauthorized()

Signer is not a registered quote provider

SeriesExpired()

Option expiry is in the past

InvalidLegsCount()

legs array must contain exactly 1 element

InsufficientBalance()

Insufficient token balance

ZeroValue()

Zero amount not allowed

API Errors

HTTP Code
Scenario
Description

400

Invalid symbol

Symbol format is malformed or unrecognized

400

Invalid parameters

Missing or incorrect query/body parameters

400

Expired option

The requested expiry date is in the past

400

No oToken

No oToken contract exists for this option series

403

Access restricted

The requested action is not permitted for this wallet

404

Asset not found

The underlying asset is not supported on this chain

422

ITM rejection

Selling in-the-money options is not allowed

500

Internal error

API encountered an unexpected error

503

Unhealthy feed

Vol surface or price feed is stale or unavailable

Error response format:

format_order_for_contract() Python Helper

Converts the /quote API response into the format expected by HedgedPool.trade().

ActionArgs Struct

Action type reference:

Action
Type
Purpose

OpenVault

0

Open a new margin vault

MintShortOption

1

Mint (write) an option

BurnShortOption

2

Burn (close) an option

DepositCollateral

5

Deposit collateral into a vault

WithdrawCollateral

6

Withdraw collateral from a vault

SettleVault

7

Settle an expired vault

Redeem

8

Redeem expired long oTokens

Full Example: Python Trading Bot

HypersurfaceClient class with all ABIs inline. pip install web3 requests then run.


Full Example: Solidity Vault Contract

Solidity vault that trades options via Hypersurface. All interfaces inlined -- only needs OpenZeppelin.

Deployment and usage:

  1. Deploy MinimalOptionsVault on HyperEVM.

  2. Call approveCollateral(wHYPE_address, type(uint256).max) for each collateral token.

  3. Call approvePremium(type(uint256).max) for buy-backs.

  4. Call deposit(wHYPE_address, amount) to fund the contract with collateral.

  5. Your backend calls POST /quote with account = your contract address.

  6. Call executeTrade(order, true) for the first trade, executeTrade(order, false) for subsequent trades into the same vault.

  7. After expiry, call settleVault(vaultId), then withdrawCollateral(...), then sweep(token, amount).

Last updated