# Hyperliquid

Pear functions as a **non-custodial trading front-end** on Hyperliquid. We route your paired perpetual futures orders through **builder codes**, ensuring both legs (long & short) are executed efficiently and transparently—while you always maintain full fund control on Arbitrum.

***

#### 🛠️ Technical Workflow

1. **Builder Code Setup**
   * Each order dispatched through Pear includes a builder payload:

     `{"b": <PearBuilderAddress>, "f": <fee_in_tenths_of_bps>}`.
   * Users initially execute an `ApproveBuilderFee` transaction on Arbitrum to authorize Pear's builder address and max fee — fully on-chain\
     <https://hyperliquid.gitbook.io/hyperliquid-docs/trading/builder-codes>
2. **Perpetual Futures via Hyperliquid**
   * Pear supports fully **on-chain perp execution** on Hyperliquid’s orderbook. Both legs of a pair trade are **perps denominated in USDC** and executed on Arbitrum through Hyperliquid’s Layer‑1 solution routing.
3. **Atomic, Timestamp-Synced Execution**
   * Pear orchestrates simultaneous dispatch of long and short orders in the **same block**, ensuring near-identical execution time for each leg.
4. **Non-Custodial Flow**
   * You deposit collateral directly into Hyperliquid. Pear never holds your funds—it only manages and routes order creation, monitoring, and closure.
   * Your trades merely include Pear’s builder code for attribution and fee tracking.

#### 🧭 Step-by-Step Flow via Arbitrum

1. **Approve Permissions**: User submits `ApproveBuilderFee` transaction (one-time).
2. **Open Pair Trade**: User designs trade (e.g. long BTC, short ETH) via Pear.
3. **Routing Orders**: Pear formats two transactions, each including builder code, and sends to Hyperliquid on Arbitrum.
4. **Execution by Hyperliquid**: Both orders enter HypCore in the same block, executed and margin managed by Hyperliquid.
5. **Monitoring & Management**: Pear tracks positions via Hyperliquid API; users can view real-time PnL, funding, and close or adjust positions—all via Pear UI.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pearprotocol.io/integration-infrastructure/hyperliquid.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
