<!--
  Sourced from Lumerin-protocol/futures-marketplace@dev:docs/gitbook/02.Contract-Specifications.md
  Regenerated on every hashpower.io build — do not edit by hand.
  Canonical source: https://github.com/Lumerin-protocol/futures-marketplace/blob/dev/docs/gitbook/02.Contract-Specifications.md
-->
# Contract Specifications

This document describes the technical specifications and parameters of HPDX Hashprice Futures contracts. Current values can be found in the Contract Specs section of the [HPDX Futures application](https://hashpower.exchange/futures).

---

## Understanding Contract Specifications

These are the key values that define how each futures contract works. You'll see these values displayed in the trading interface.

### Contract Specifications

| Parameter              | What It Means                                                                                                                                                            |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Contract Unit**      | The amount of hashrate each contract represents (measured in hashes per second).                                                                                         |
| **Margin Requirement** | The percentage of contract value you must deposit as collateral. This protects both parties if prices move against you. Higher requirements mean more capital locked up. |
| **Maturity Time**      | The time at which the contract matures and becomes settleable. Stored on-chain as `expirationAt`.                                                                           |

### Contract frequency

| Parameter                 | What It Means                                                                                                 |
| ------------------------- | ------------------------------------------------------------------------------------------------------------- |
| **Available Expirations** | How far into the future you can trade. For example, if set to 4 contracts, you can trade up to 4 weeks ahead. |
| **Expiration Interval**   | Interval between two closest expiration dates in days.                                                          |

### Pricing & Settlement

| Parameter               | What It Means                                                                                                                                               |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Settlement Currency** | The currency used for all payments (e.g., USDC). This is what you deposit as margin and receive during settlement.                                          |
| **Tick Size**           | The smallest price movement allowed. Orders must be placed at prices that are multiples of this step (e.g., if the step is \$0.01, you cant bid at \$0.015) |
| **Tick Value**          | The value of a one-tick move for a single contract.                                                                                                         |
| **Contract Size**       | One contract settles one unit of mark price (no duration multiplier). PnL = `mark × netQuantity − netEntryValue`.                                           |

### Fees & Limits

| Parameter           | What It Means                                                                                           |
| ------------------- | ------------------------------------------------------------------------------------------------------- |
| **Maker / Taker Fee** | Charged on fills. Maker fee may be zero by default.                                                   |
| **Max Open Orders** | Maximum resting orders per address and delivery date (`MAX_ORDERS_PER_PARTICIPANT_PER_EXPIRATION` = 100). Quantity is signed `int256` (no 127 cap). |

---

## Settlement Functions, Events & Errors

As of contract version `3.0.0`, futures are **cash-settled** unilateral aggregates. The table
below summarizes the settlement-related surface. See [Settlement](./05.Delivery-Settlement.md)
for the full lifecycle.

### Functions

| Function                                         | Status | What It Does |
| ------------------------------------------------ | ------ | ------------ |
| `settlePosition(address user, uint256 expirationAt)` | Active | Permissionless. Pins the expiry settlement price on first use, marks that user's aggregate to the pin, routes PnL via the insurance fund, clears the aggregate, emits `PositionSettled`. |
| `settlePositions(address[], uint256[])`          | Active | Batch of `(user, expirationAt)` pairs; lengths must match. |
| `recordSettlementPrice(uint256)`                 | Active | Permissionless pin of `getMarketPrice()` at/after maturity; idempotent; emits `SettlementPriceRecorded`. |
| `settlementPrice(uint256)`                       | Active | Pinned settlement price (`0` until recorded). |
| `getUserPosition(address, uint256)`              | Active | `{ netQuantity, netEntryValue }` for that user+expiry. |
| `getActiveExpirationDates(address)`                | Active | Expiries where the user still has a non-zero aggregate. |
| `getMarketPrice()`                               | Active | Live oracle mark used for pinning and margin. |

### Events

| Event | Status | Meaning |
| ----- | ------ | ------- |
| `PositionSettled(user, expirationAt, closedQuantity, pnl, settlementPrice, settledBy)` | Active | User's aggregate cash-settled at the pinned price. |
| `SettlementPriceRecorded(expirationAt, price, recordedBy)` | Active | Expiry settlement price pinned (once). |

### Errors

`settlePosition` reverts with `PositionNotExists()` (flat at that expiry) or
`PositionExpirationNotStartedYet()` (before `expirationAt`).
`recordSettlementPrice` reverts with `SettlementDateNotReached()` before `expirationAt`.

---

## Read next

- [Margin System](./03.Margin-System.md) - How collateral and liquidation work
- [Trading Guide](./04.Trading-Guide.md) - Creating and managing orders
- [Settlement](./05.Delivery-Settlement.md) - Cash settlement of positions at maturity
