Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 2 additions & 30 deletions doc/api-reference/.gitbook/assets/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1600,9 +1600,6 @@ paths:

- `getBalance(address token)` - Get deposited balance for a token

- `getOrders(bytes32 orderbookId, bytes32[] txHashes)` - Get order
details by transaction hashes


**Orderbook Contract Address:**
`0x50d0000000000000000000000000000000000002`
Expand Down Expand Up @@ -1730,30 +1727,6 @@ paths:
key: 6R2nFEGb4xGg
key: XlJwFI7mJP9u
key: nbzs4eHBW7If
- object: block
type: list-item
isVoid: false
data: {}
nodes:
- object: block
type: paragraph
isVoid: false
data: {}
nodes:
- object: text
leaves:
- object: leaf
text: getOrders(bytes32 orderbookId, bytes32[] txHashes)
marks:
- object: mark
type: code
data: {}
- object: leaf
text: ' - Get order details by transaction hashes'
marks: []
key: MXKTYZTqD6z1
key: g0bZNpVaGpuM
key: 35iJh2oqJANL
key: yf4VkJn4QElq
- object: block
type: paragraph
Expand Down Expand Up @@ -1785,9 +1758,8 @@ paths:
transaction on the blockchain.</p><p>Use this method for read-only
operations on the orderbook contract, such
as:</p><ul><li><code>getBalance(address token)</code> - Get deposited
balance for a token</li><li><code>getOrders(bytes32 orderbookId,
bytes32[] txHashes)</code> - Get order details by transaction
hashes</li></ul><p><strong>Orderbook Contract Address:</strong>
balance for a token</li></ul><p><strong>Orderbook Contract
Address:</strong>
<code>0x50d0000000000000000000000000000000000002</code></p>
/eth_getTransactionReceipt:
post:
Expand Down
2 changes: 1 addition & 1 deletion doc/api-reference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ View transactions and accounts
{% hint style="info" %}
**Transaction hashes as identifiers.** Pod often uses the **transaction hash** — the value returned by `eth_sendRawTransaction` when the transaction was submitted — as the identifier for the entity that transaction created. For example, a bridge withdrawal's claim proof is fetched by the withdrawal tx hash, and account recovery references its target transaction by tx hash.

**Exception — orderbook orders.** A resting order is identified by a computed `order_id = keccak256(abi.encode(signer, nonce, sequence))`, **not** its `submitOrder` tx hash. The orderbook precompile's `cancel(orderbookId, canceledOrder, …)`, `update(orderbookId, updatedOrder, …)`, and `getOrders(orderbookId, orderIds)` all take this `order_id`; `ob_getOrders` returns it as `order_id` (and the originating tx hash separately as `tx_hash`). See the [Orderbook precompile](applications-precompiles/orderbook.md) for details.
**Exception — orderbook orders.** A resting order is identified by a computed `order_id = keccak256(abi.encode(signer, nonce, sequence))`, **not** its `submitOrder` tx hash. The orderbook precompile's `cancel(orderbookId, canceledOrder, …)` and `update(orderbookId, updatedOrder, …)` take this `order_id`; `ob_getOrders` returns it as `order_id` (and the originating tx hash separately as `tx_hash`). See the [Orderbook precompile](applications-precompiles/orderbook.md) for details.
{% endhint %}

Pod supports standard Ethereum RPC methods under the `eth_` namespace, with a few differences due to Pod's blockless architecture. Pod also introduces additional namespaces for protocol-specific and orderbook functionality:
Expand Down
26 changes: 2 additions & 24 deletions doc/api-reference/applications-precompiles/orderbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The **Orderbook precompile** is the on-chain execution surface for native markets — both **spot** and **perpetual**. The same contract, calls, and balances are shared across both market types; a market's behavior is determined by the `MarketType` set at creation.

Use it for **placing/canceling/updating orders**, **depositing/withdrawing funds**, **opening leveraged perpetual positions**, **arming take-profit / stop-loss triggers**, and **reading balances and order state**.
Use it for **placing/canceling/updating orders**, **depositing/withdrawing funds**, **opening leveraged perpetual positions**, **arming take-profit / stop-loss triggers**, and **reading balances**. Order state and history are not read through the precompile — use the `ob_` JSON-RPC endpoints (`ob_getOrders`, `ob_getFills`, …) instead; see [Read market data](../guides/read-market-data.md).

{% hint style="info" %}
**Orderbook precompile address:** `0x50d0000000000000000000000000000000000002`
Expand All @@ -19,7 +19,7 @@ Use it for **placing/canceling/updating orders**, **depositing/withdrawing funds
order_id = keccak256(abi.encode(address signer, uint64 nonce, uint32 sequence))
```

where `signer` is the order owner, `nonce` is the `submitOrder` transaction's nonce, and `sequence` is the intent's position inside a `submitBatch` envelope (`0` for a standalone `submitOrder`). Wherever a call references an existing order — `cancel(canceledOrder, …)`, `update(updatedOrder, …)`, and the `getOrders(orderIds, …)` read — pass this `order_id`. You can compute it yourself with the formula above, or read it back from `ob_getOrders`, which returns it as `order_id` (the originating `submitOrder` tx hash is exposed separately as `tx_hash`).
where `signer` is the order owner, `nonce` is the `submitOrder` transaction's nonce, and `sequence` is the intent's position inside a `submitBatch` envelope (`0` for a standalone `submitOrder`). Wherever a call references an existing order — `cancel(canceledOrder, …)` and `update(updatedOrder, …)` — pass this `order_id`. You can compute it yourself with the formula above, or read it back from `ob_getOrders`, which returns it as `order_id` (the originating `submitOrder` tx hash is exposed separately as `tx_hash`).
{% endhint %}

{% hint style="warning" %}
Expand Down Expand Up @@ -159,28 +159,6 @@ contract Orderbook {
*/
function getBalance(address token) public view returns (int256) {}

/**
* @notice Batched retrieval of order details by their order ids.
* @param orderbookId The identifier of the market.
* @param orderIds An array of `order_id`s representing the orders to fetch.
* @return An array of order structs containing:
* - orderId: The unique order identifier (`keccak256(abi.encode(signer, nonce, sequence))`).
* - side: The order side (Buy/Sell).
* - status: The current status (e.g., Open, Filled, Canceled).
* - remainingBase: The amount of base asset left to fill.
* - price: The limit price.
* - startTs: Timestamp when the order was included in the orderbook.
* - endTs: Timestamp when the order expires.
* - filledBase: Amount of base asset already filled.
* - filledQuote: Amount of quote asset spent/received.
*/
function getOrders(
bytes32 orderbookId,
bytes32[] calldata orderIds
) public view returns (
(bytes32, Side, uint16, uint256, uint256, uint128, uint128, uint256, uint256)[] memory
) {}

// --- Fund Management ---

/**
Expand Down
3 changes: 1 addition & 2 deletions doc/api-reference/json-rpc/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,7 @@ paths:

Use this method for read-only operations on the orderbook contract, such as:
- `getBalance(address token)` - Get deposited balance for a token
- `getOrders(bytes32 orderbookId, bytes32[] txHashes)` - Get order details by transaction hashes


**Orderbook Contract Address:** `0x50d0000000000000000000000000000000000002`
requestBody:
content:
Expand Down
Loading