> ## Documentation Index
> Fetch the complete documentation index at: https://docs.melt.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Hyperliquid Integration

> How Melt integrates with HyperCore via precompiles and the HyperLiquid SDK

## HyperCore Precompiles

Melt contracts interact with HyperCore through precompile addresses — native system contracts on HyperEVM.

### Precompile Addresses

| Address                                      | Interface         | Purpose                           |
| -------------------------------------------- | ----------------- | --------------------------------- |
| `0x0000000000000000000000000000000000000801` | `ISpotBalance`    | Query spot balances               |
| `0x0000000000000000000000000000000000000810` | `ICoreUserExists` | Check if user exists on HyperCore |
| `0x3333333333333333333333333333333333333333` | `ICoreWriter`     | Send raw actions (spot transfers) |

The asset bridge prefix is `0x2000000000000000000000000000000000000000` — each HIP-1 token's bridge address is computed by adding the core index to this prefix.

### Asset Bridge

Each HIP-1 token has a dedicated asset bridge address computed from its core index:

```solidity theme={null}
function getAssetBridge(uint64 coreIndexId) internal pure returns (address) {
    return address(uint160(ASSET_BRIDGE_PREFIX) + coreIndexId);
}
```

The asset bridge is the gateway between HyperEVM and HyperCore spot balances.

### Spot Transfer

To send tokens from HyperEVM to a user's HyperCore spot balance:

```solidity theme={null}
HyperCoreLib.sendSpotTransfer(recipient, coreIndexId, amount);
```

This encodes a `SPOT_SEND` action and calls the `ICoreWriter` precompile.

## HyperLiquid Info API

The web app uses the HyperLiquid Info API for real-time market data:

* **Market tickers** — price, volume, 24h change
* **Order book** — real-time bid/ask depth
* **Candle data** — OHLCV for charting
* **Recent trades** — latest executed trades
* **User state** — positions, open orders, balances

## WebSocket Integration

Real-time data streams via WebSocket for:

* Order book updates
* Trade execution notifications
* Balance changes
